[Ocfs2-tools-devel] [PATCH 1/1] Fsck.ocfs2: Correctly check i_size for directory in a sparse filesystem.
Tristan Ye
tristan.ye at oracle.com
Mon Mar 8 02:13:14 PST 2010
As we know, i_size(in clusters) of an sparse file shouldn't be less
than its cluster offset, while it's not the case for a directory inode.
We therefore need to let fsck.ocfs2 handle this correctly on a sparse fs.
Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
fsck.ocfs2/pass1.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/fsck.ocfs2/pass1.c b/fsck.ocfs2/pass1.c
index 0763259..8035bb6 100644
--- a/fsck.ocfs2/pass1.c
+++ b/fsck.ocfs2/pass1.c
@@ -935,8 +935,16 @@ size_cluster_check:
expected *= fs->fs_clustersize;
unexpected = expected - fs->fs_clustersize;
- /* i_size is checked for symlinks elsewhere */
- if (!S_ISLNK(di->i_mode) && di->i_size <= unexpected &&
+ /*
+ * NOTE:
+ * - i_size is checked for symlinks elsewhere
+ * - We're not going to check this for dirs
+ * since it would be legal for a dir inode
+ * whose i_size(in clusters) was less than
+ * i_clusters, even in a sparse filesystem
+ */
+ if (!S_ISLNK(di->i_mode) && !S_ISDIR(di->i_mode) &&
+ di->i_size <= unexpected &&
prompt(ost, PY, PR_INODE_SPARSE_SIZE, "Inode %"PRIu64
" has a size of %"PRIu64" but has %"PRIu64
" blocks of actual data. "
--
1.5.5
More information about the Ocfs2-tools-devel
mailing list