summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjinbaohong <jinbaohong@synology.com>2026-01-28 10:06:38 +0300
committerSasha Levin <sashal@kernel.org>2026-03-04 15:21:52 +0300
commite00549dd86f5aaf04d14ba4822134cbc481adbd1 (patch)
tree790b246473f674fc460d5df0b9eec19b3f79a2d6
parent2f926875dffe2226ea26d129e16d9092cccd03aa (diff)
downloadlinux-e00549dd86f5aaf04d14ba4822134cbc481adbd1.tar.xz
btrfs: continue trimming remaining devices on failure
[ Upstream commit 912d1c6680bdb40b72b1b9204706f32b6eb842c3 ] Commit 93bba24d4b5a ("btrfs: Enhance btrfs_trim_fs function to handle error better") intended to make device trimming continue even if one device fails, tracking failures and reporting them at the end. However, it used 'break' instead of 'continue', causing the loop to exit on the first device failure. Fix this by replacing 'break' with 'continue'. Fixes: 93bba24d4b5a ("btrfs: Enhance btrfs_trim_fs function to handle error better") CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Robbie Ko <robbieko@synology.com> Signed-off-by: jinbaohong <jinbaohong@synology.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/btrfs/extent-tree.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 5dd7ac7cbb0b..c052c8df05fb 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6592,7 +6592,7 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range)
if (ret) {
dev_failed++;
dev_ret = ret;
- break;
+ continue;
}
}
mutex_unlock(&fs_devices->device_list_mutex);