]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Btrfs: do not merge rbios if their fail stripe index are not identical
authorLiu Bo <bo.li.liu@oracle.com>
Mon, 11 Dec 2017 21:56:31 +0000 (14:56 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 22 Jan 2018 15:08:20 +0000 (16:08 +0100)
Since fail stripe index in rbio would be used to decide which
algorithm reconstruction would be run, we cannot merge rbios if
their's fail striped indexes are different, otherwise, one of the two
reconstructions would fail.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/raid56.c

index 945e940d23689c6879ba04897eb4a61490535379..7b382eeada72bd5d5000f94a74ae7bd078f9b54e 100644 (file)
@@ -600,6 +600,25 @@ static int rbio_can_merge(struct btrfs_raid_bio *last,
        if (last->operation == BTRFS_RBIO_REBUILD_MISSING)
                return 0;
 
+       if (last->operation == BTRFS_RBIO_READ_REBUILD) {
+               int fa = last->faila;
+               int fb = last->failb;
+               int cur_fa = cur->faila;
+               int cur_fb = cur->failb;
+
+               if (last->faila >= last->failb) {
+                       fa = last->failb;
+                       fb = last->faila;
+               }
+
+               if (cur->faila >= cur->failb) {
+                       cur_fa = cur->failb;
+                       cur_fb = cur->faila;
+               }
+
+               if (fa != cur_fa || fb != cur_fb)
+                       return 0;
+       }
        return 1;
 }