VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   57 Tags
author: Anand Jain <anand.jain@oracle.com> 2021-07-04 19:14:39 +0800 committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2021-07-28 14:37:38 +0200 commit: a02b54480573dc45976f55f1b9c50b19dc94e70d parent: 020d8ceab3412776ff4b921bfe5e630019bbbf18
Commit Summary:
btrfs: check for missing device in btrfs_trim_fs
Diffstat:
1 file changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index d2f39a122d89..7e79467c08ff 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6034,6 +6034,9 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range)
 	mutex_lock(&fs_info->fs_devices->device_list_mutex);
 	devices = &fs_info->fs_devices->devices;
 	list_for_each_entry(device, devices, dev_list) {
+		if (test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state))
+			continue;
+
 		ret = btrfs_trim_free_extents(device, &group_trimmed);
 		if (ret) {
 			dev_failed++;