xfs
[Top] [All Lists]

Re: [patch] xfsprogs: repair never return if device removed

To: xfs@xxxxxxxxxxx
Subject: Re: [patch] xfsprogs: repair never return if device removed
From: Ajeet Yadav <ajeet.yadav.77@xxxxxxxxx>
Date: Tue, 1 Feb 2011 16:08:33 +0900
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=Ay+aWucWbr9YqzBnDYKBkEHOEZQOjizJjfgHKEEOpsI=; b=rDuG0w6n5nu8PH67QW93MGuwRIFsa467dLaNvFNVaq08S6cueSbQIGa4Q5grRWbpbd ZIygVWRS4jwMakSv3mZXuuQWBlnDey7YKGHKbTbiUdUhPZVFTP0gwkQDxsxRJVIAHchY UXLvxtgPyI/obZ1tpI6FVpqPMWA8YgfYQ7yAs=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=RL6zCfTTdgS1uvZDWBeabNgbQH59Ss6nkU7hTeNNu8uVWo+tg6IR2dPfX+XvEZRHcS RfXr4T+sccEO3+Ul9NDn+a8JTCXAQWb4DcvgYcFif26OR7H5S8fbVYuwModuhe5FNaOZ g98EJyhpumB9+voWn7LZmqhoGg8dgU7kB3W2k=
In-reply-to: <AANLkTikyOfkbtxN3Et5YZRJ2rPpdsVouJkyRW4fDbUG7@xxxxxxxxxxxxxx>
References: <AANLkTimoZE8kD2Qz+ynZhceGuHqZxe9VSHKXho_tbdWi@xxxxxxxxxxxxxx> <AANLkTikyOfkbtxN3Et5YZRJ2rPpdsVouJkyRW4fDbUG7@xxxxxxxxxxxxxx>
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;
                }
 
<Prev in Thread] Current Thread [Next in Thread>