public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] xfsprogs: repair never return if device removed
@ 2011-01-28 11:31 Ajeet Yadav
  2011-01-31  2:41 ` Ajeet Yadav
  0 siblings, 1 reply; 5+ messages in thread
From: Ajeet Yadav @ 2011-01-28 11:31 UTC (permalink / raw)
  To: xfs


[-- Attachment #1.1: Type: text/plain, Size: 321 bytes --]

xfsprogs all version, delete primary superblock of xfs partition

dd if=/dev/zero of=/dev/sda1 bs=512 count=1
sync

Run xfs_repair in partition, while its searching for secondary superblock,
remove the disk (USB) xfs_repair will never exit and will loop in never
ending ............

Please find patch attached with mail

[-- Attachment #1.2: Type: text/html, Size: 420 bytes --]

[-- Attachment #2: xfs_repair_hang_on_device_removal.patch --]
[-- Type: application/octet-stream, Size: 517 bytes --]

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-01-28 20:21:06.000000000 +0900
@@ -122,8 +122,9 @@ 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;
+			do_warn(_("Couldn't find candidate secondary superblock, exiting...\n"));
 		}
 
 		do_warn(".");

[-- Attachment #3: Type: text/plain, Size: 121 bytes --]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] xfsprogs: repair never return if device removed
  2011-01-28 11:31 [patch] xfsprogs: repair never return if device removed Ajeet Yadav
@ 2011-01-31  2:41 ` Ajeet Yadav
  2011-02-01  7:08   ` Ajeet Yadav
  2011-02-01 21:14   ` Christoph Hellwig
  0 siblings, 2 replies; 5+ messages in thread
From: Ajeet Yadav @ 2011-01-31  2:41 UTC (permalink / raw)
  To: xfs


[-- Attachment #1.1: Type: text/plain, Size: 949 bytes --]

I did not receive and response / reviews on patch.

diff -Nurp xfsprogs/repair/sb.c xfsprogs-dirty/repair/sb.c

--- xfsprogs/repair/sb.c 2011-01-28 20:23:02.000000000 +0900

+++ xfsprogs-dirty/repair/sb.c 2011-01-28 20:21:06.000000000 +0900

@@ -122,8 +122,9 @@ 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;

+ do_warn(_("Couldn't find candidate secondary superblock, exiting...\n"));

}

do_warn(".");

On Fri, Jan 28, 2011 at 8:31 PM, Ajeet Yadav <ajeet.yadav.77@gmail.com>wrote:

> xfsprogs all version, delete primary superblock of xfs partition
>
> dd if=/dev/zero of=/dev/sda1 bs=512 count=1
> sync
>
> Run xfs_repair in partition, while its searching for secondary superblock,
> remove the disk (USB) xfs_repair will never exit and will loop in never
> ending ............
>
> Please find patch attached with mail
>

[-- Attachment #1.2: Type: text/html, Size: 1469 bytes --]

[-- Attachment #2: Type: text/plain, Size: 121 bytes --]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] xfsprogs: repair never return if device removed
  2011-01-31  2:41 ` Ajeet Yadav
@ 2011-02-01  7:08   ` Ajeet Yadav
  2011-02-01 21:39     ` Christoph Hellwig
  2011-02-01 21:14   ` Christoph Hellwig
  1 sibling, 1 reply; 5+ messages in thread
From: Ajeet Yadav @ 2011-02-01  7:08 UTC (permalink / raw)
  To: xfs


[-- Attachment #1.1: Type: text/plain, Size: 1011 bytes --]

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@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;
                }

[-- Attachment #1.2: Type: text/html, Size: 1193 bytes --]

[-- Attachment #2: Type: text/plain, Size: 121 bytes --]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] xfsprogs: repair never return if device removed
  2011-01-31  2:41 ` Ajeet Yadav
  2011-02-01  7:08   ` Ajeet Yadav
@ 2011-02-01 21:14   ` Christoph Hellwig
  1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2011-02-01 21:14 UTC (permalink / raw)
  To: Ajeet Yadav; +Cc: xfs

On Mon, Jan 31, 2011 at 11:41:16AM +0900, Ajeet Yadav wrote:
> I did not receive and response / reviews on patch.

The patch looks good, but we'll need a Signed-off-by line to
apply it.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] xfsprogs: repair never return if device removed
  2011-02-01  7:08   ` Ajeet Yadav
@ 2011-02-01 21:39     ` Christoph Hellwig
  0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2011-02-01 21:39 UTC (permalink / raw)
  To: Ajeet Yadav; +Cc: xfs

Thanks, applied.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-01 21:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-28 11:31 [patch] xfsprogs: repair never return if device removed Ajeet Yadav
2011-01-31  2:41 ` Ajeet Yadav
2011-02-01  7:08   ` Ajeet Yadav
2011-02-01 21:39     ` Christoph Hellwig
2011-02-01 21:14   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox