From: Eric Sandeen Date: Tue, 7 Apr 2015 00:04:11 +0000 (+1000) Subject: xfs_repair: don't clear . or .. in process_dir2_data X-Git-Tag: v3.2.3-rc1~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b8ec08a1346d3a52a4ac4d4a414fc36aae272ee7;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: don't clear . or .. in process_dir2_data process_dir2_data() has special . and .. processing; it is able to correct these inodes, so there is no reason to clear them. Do this before we adjust a length 0 filename to length 1, so that we don't take this action on an accidentally created "." name from a hidden dotfile. Signed-off-by: Eric Sandeen Reviewed-by: Brian Foster Signed-off-by: Dave Chinner --- diff --git a/repair/dir2.c b/repair/dir2.c index 9e6c67d1f..c6d618dcd 100644 --- a/repair/dir2.c +++ b/repair/dir2.c @@ -1318,6 +1318,18 @@ _("entry \"%*.*s\" at block %d offset %" PRIdPTR " in directory inode %" PRIu64 dep->namelen, dep->namelen, dep->name, da_bno, (intptr_t)ptr - (intptr_t)d, ino, clearreason, ent_ino); + + /* + * We have a special dot & dotdot fixer-upper below which can + * sort out the proper inode number, so don't clear it. + */ + if ((dep->namelen == 1 && dep->name[0] == '.') || + (dep->namelen == 2 && + dep->name[0] == '.' && dep->name[1] == '.')) { + clearino = 0; + clearreason = NULL; + } + /* * If the name length is 0 (illegal) make it 1 and blast * the entry.