mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] btrfs: raid56: do blk_check_plugged check twice while writing
@ 2022-03-19  1:18 Yusuf Khan
  2022-03-19 18:31 ` Sweet Tea Dorminy
  0 siblings, 1 reply; 2+ messages in thread
From: Yusuf Khan @ 2022-03-19  1:18 UTC (permalink / raw)
  To: linux-btrfs; +Cc: linux-kernel, dsterba, josef, clm, Yusuf Khan

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@gmail.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


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

end of thread, other threads:[~2022-03-19 18:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19  1:18 [PATCH] btrfs: raid56: do blk_check_plugged check twice while writing Yusuf Khan
2022-03-19 18:31 ` Sweet Tea Dorminy

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

all inboxes | Powered by JetHome®