[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220319011840.16213-1-yusisamerican@gmail.com>
Date: Fri, 18 Mar 2022 18:18:40 -0700
From: Yusuf Khan <yusisamerican@...il.com>
To: linux-btrfs@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, dsterba@...e.com,
josef@...icpanda.com, clm@...com,
Yusuf Khan <yusisamerican@...il.com>
Subject: [PATCH] btrfs: raid56: do blk_check_plugged check twice while writing
Do the check to see if the drive was connected twice in case that
the first was a fluke.
Signed-off-by: Yusuf Khan <yusisamerican@...il.com>
---
fs/btrfs/raid56.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 0e239a4c3b26..f652900d7569 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1750,18 +1750,23 @@ int raid56_parity_write(struct bio *bio, struct btrfs_io_context *bioc,
cb = blk_check_plugged(btrfs_raid_unplug, fs_info, sizeof(*plug));
if (cb) {
- plug = container_of(cb, struct btrfs_plug_cb, cb);
- if (!plug->info) {
- plug->info = fs_info;
- INIT_LIST_HEAD(&plug->rbio_list);
+ cpu_relax();
+ cb = blk_check_plugged(btrfs_raid_unplug, fs_info, sizeof(*plug));
+ if (cb) {
+ plug = container_of(cb, struct btrfs_plug_cb, cb);
+ if (!plug->info) {
+ plug->info = fs_info;
+ INIT_LIST_HEAD(&plug->rbio_list);
+ }
+ list_add_tail(&rbio->plug_list, &plug->rbio_list);
+ return 0;
}
- list_add_tail(&rbio->plug_list, &plug->rbio_list);
- ret = 0;
- } else {
- ret = __raid56_parity_write(rbio);
- if (ret)
- btrfs_bio_counter_dec(fs_info);
+ btrfs_warn(fs_info,
+"during a write operation, the first check to see if the drive was plugged in failed, seccond check succeeded, write continued");
}
+ ret = __raid56_parity_write(rbio);
+ if (ret)
+ btrfs_bio_counter_dec(fs_info);
return ret;
}
--
2.25.1
Powered by blists - more mailing lists