This patch marks device as failed for the write/flush errors
so that it can be brought out of the RW device list. However
if the chunk render is incomplete due to missing of a device
then the volume/raid fails, so this situation is handled by
calling btrfs_handle_fs_error() which puts the whole FS to
RDONLY.
Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
This patch is to replace
[PATCH v8 2/2] btrfs: check device for critical errors and mark failed
fs/btrfs/volumes.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index 05b150c03995..53397d077e91 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -501,6 +501,7 @@ int btrfs_finish_chunk_alloc(struct btrfs_trans_handle *trans,
u64 chunk_offset, u64 chunk_size);
int btrfs_remove_chunk(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 chunk_offset);
+void btrfs_mark_device_failed(struct btrfs_device *dev);
static inline int btrfs_dev_stats_dirty(struct btrfs_device *dev)
{
@@ -513,6 +514,10 @@ static inline void btrfs_dev_stat_inc(struct btrfs_device *dev,
atomic_inc(dev->dev_stat_values + index);
smp_mb__before_atomic();
atomic_inc(&dev->dev_stats_ccnt);
+
+ if (index == BTRFS_DEV_STAT_WRITE_ERRS ||
+ index == BTRFS_DEV_STAT_FLUSH_ERRS)
+ btrfs_mark_device_failed(dev);
}
static inline int btrfs_dev_stat_read(struct btrfs_device *dev,
--
2.13.1
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html