From: Brian Foster Date: Mon, 10 Apr 2017 22:32:04 +0000 (-0500) Subject: xfs_repair: detect invalid zero-sized symlink inodes X-Git-Tag: v4.11.0-rc1~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=948ade7529f43d7b96aeebdd15a1a7ad1ad0f224;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: detect invalid zero-sized symlink inodes Mathias Troiden reproduced a filesystem corruption that resulted in a zero-sized local format symlink inode. This is invalid state and results in an inode that cannot be accessed or modified. The kernel detects this problem on inode access, fails and warns the user to umount and run xfs_repair. Unfortunately, xfs_repair doesn't even detect the problem. Thus the user has no path to recovery. Update xfs_repair to check for invalid zero-sized symlinks and flag them as corrupted. This results in tossing the inode, but returns the fs to a valid state. Reported-by: Mathias Troiden Signed-off-by: Brian Foster Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/repair/dinode.c b/repair/dinode.c index 8d014097b..d664f87a7 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -1385,6 +1385,11 @@ process_symlink( return(1); } + if (be64_to_cpu(dino->di_size) == 0) { + do_warn(_("zero size symlink in inode %" PRIu64 "\n"), lino); + return 1; + } + /* * have to check symlink component by component. * get symlink contents into data area