]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: continue trimming remaining devices on failure
authorjinbaohong <jinbaohong@synology.com>
Wed, 28 Jan 2026 07:06:38 +0000 (07:06 +0000)
committerSasha Levin <sashal@kernel.org>
Wed, 4 Mar 2026 12:21:22 +0000 (07:21 -0500)
[ 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>
fs/btrfs/extent-tree.c

index a48ba97bb369495a14e7ccfc908eac9a1c14d445..08b7109299472d2f3579f17f931c810ee6baa168 100644 (file)
@@ -6601,7 +6601,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);