[patch] xfsprogs: repair never return if device removed

Ajeet Yadav ajeet.yadav.77 at gmail.com
Tue Feb 1 01:08:33 CST 2011


xfsprogs: repair hang in find secondary sb on device removal

xfs_repair does not handle read() error, while searching secondary
superblock.This problem is identified with a simple test case.

Delete primary superblock of xfs partition with
        #dd if=/dev/zero of=/dev/sda1 bs=512 count=1
        #sync
Run xfs_repair,
While its searching for secondary superblock, remove the storage.
xfs_repair will loop in never ending ............

Signed-off-by: Ajeet Yadav <ajeet.yadav.77 at gmail.com>

diff -Nurp xfsprogs-3.0.5/repair/sb.c xfsprogs-3.0.5-dirty/repair/sb.c
--- xfsprogs-3.0.5/repair/sb.c  2011-01-28 20:23:02.000000000 +0900
+++ xfsprogs-3.0.5-dirty/repair/sb.c    2011-02-01 15:46:35.000000000 +0900
@@ -122,7 +122,7 @@ find_secondary_sb(xfs_sb_t *rsb)
                        done = 1;
                }

-               if (!done && (bsize = read(x.dfd, sb, BSIZE)) == 0)  {
+               if (!done && (bsize = read(x.dfd, sb, BSIZE)) <= 0)  {
                        done = 1;
                }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://oss.sgi.com/pipermail/xfs/attachments/20110201/51f79c67/attachment.htm>


More information about the xfs mailing list