xfs_repair: detect invalid zero-sized symlink inodes
PATCH 1/1 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.
--- repair/dinode.c | 5 +++++ 1 file changed, 5 insertions(+)
repair/dinode.c +5 -0
@@ -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
Signature · 1 line
2.7.4
Quoted 8 lines · Brian Foster
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_repairdoesn't even detect the problem. Thus the user has no path to recovery.
Quoted 6 lines
Update
xfs_repairto 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 <[email protected]>Signed-off-by Brian Foster <[email protected]>
Looks good,
--D
Quoted 27 lines
--- repair/dinode.c | 5 +++++ 1 file changed, 5 insertions(+)repair/dinode.c +5
-0@@ -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 Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
repair/dinode.c process_symlink( · line 1388
Quoted 1 line
repair/dinode.c +1
-0+if (be64_to_cpu (dino->di_size) ==0 ) {
You can drop the be64_to_cpu if you're only comparing with 0.
Otherwise this looks fine: