From 2e4741acb76ad4c0aa3d7a3eb8ae5d14992f4e21 Mon Sep 17 00:00:00 2001 From: Ajeet Yadav Date: Tue, 1 Feb 2011 14:33:32 -0700 Subject: [PATCH] xfs_repair: handle negative errors from read xfs_repair does not handle read() errors while searching for secondary superblocks. This problem is identified with a simple test case: (1) delete primary superblock of xfs partition with #dd if=/dev/zero of=/dev/sda1 bs=512 count=1 #sync (2) run xfs_repair, and remove the storage while it is searching for secondary superblocks xfs_repair will loop forever, printing ............ Signed-off-by: Ajeet Yadav Signed-off-by: Christoph Hellwig --- repair/sb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repair/sb.c b/repair/sb.c index ba58f2eeb..0ee23453d 100644 --- a/repair/sb.c +++ b/repair/sb.c @@ -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; } -- 2.47.2