summary refs log tree commit diff
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2021-09-27 18:38:10 +0100
committerMark Brown <broonie@kernel.org>2021-09-27 18:38:10 +0100
commit59c4e190b10cd2d6edccb5c238a3d2bda071a018 (patch)
tree394e0d2a793ada03c280e066cd34f9ce7bf6633a /fs/btrfs/volumes.c
parent6840615f85f6046039ebc4989870ddb12892b7fc (diff)
parent5816b3e6577eaa676ceb00a848f0fd65fe2adc29 (diff)
downloadlinux-59c4e190b10cd2d6edccb5c238a3d2bda071a018.tar.gz
Merge tag 'v5.15-rc3' into spi-5.15
Linux 5.15-rc3
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 464485aa7318..2ec3b8ac8fa3 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1137,6 +1137,19 @@ static void btrfs_close_one_device(struct btrfs_device *device)
 	atomic_set(&device->dev_stats_ccnt, 0);
 	extent_io_tree_release(&device->alloc_state);
 
+	/*
+	 * Reset the flush error record. We might have a transient flush error
+	 * in this mount, and if so we aborted the current transaction and set
+	 * the fs to an error state, guaranteeing no super blocks can be further
+	 * committed. However that error might be transient and if we unmount the
+	 * filesystem and mount it again, we should allow the mount to succeed
+	 * (btrfs_check_rw_degradable() should not fail) - if after mounting the
+	 * filesystem again we still get flush errors, then we will again abort
+	 * any transaction and set the error state, guaranteeing no commits of
+	 * unsafe super blocks.
+	 */
+	device->last_flush_error = 0;
+
 	/* Verify the device is back in a pristine state  */
 	ASSERT(!test_bit(BTRFS_DEV_STATE_FLUSH_SENT, &device->dev_state));
 	ASSERT(!test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state));