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@xxxxxxxxx>
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;
}
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@xxxxxxxxx>
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;
}
_______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs