From: Greg Kroah-Hartman Date: Tue, 18 Oct 2022 17:37:39 +0000 (+0200) Subject: drop btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch X-Git-Tag: v6.0.3~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bff0ecb5ce5571ac376e058401f3ef8fe03c7fb0;p=thirdparty%2Fkernel%2Fstable-queue.git drop btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch --- diff --git a/queue-5.10/btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch b/queue-5.10/btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch deleted file mode 100644 index df3925eda76..00000000000 --- a/queue-5.10/btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 438159f7b94039cb4e8a1c77ed00c1474fd1c45c Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 5 Sep 2022 18:32:23 +0200 -Subject: btrfs: add KCSAN annotations for unlocked access to block_rsv->full - -From: David Sterba - -[ Upstream commit 748f553c3c4c4f175c6c834358632aff802d72cf ] - -KCSAN reports that there's unlocked access mixed with locked access, -which is technically correct but is not a bug. To avoid false alerts at -least from KCSAN, add annotation and use a wrapper whenever ->full is -accessed for read outside of lock. - -It is used as a fast check and only advisory. In the worst case the -block reserve is found !full and becomes full in the meantime, but -properly handled. - -Depending on the value of ->full, btrfs_block_rsv_release decides -where to return the reservation, and block_rsv_release_bytes handles a -NULL pointer for block_rsv and if it's not NULL then it double checks -the full status under a lock. - -Link: https://lore.kernel.org/linux-btrfs/CAAwBoOJDjei5Hnem155N_cJwiEkVwJYvgN-tQrwWbZQGhFU=cA@mail.gmail.com/ -Link: https://lore.kernel.org/linux-btrfs/YvHU/vsXd7uz5V6j@hungrycats.org -Reported-by: Zygo Blaxell -Signed-off-by: David Sterba -Signed-off-by: Sasha Levin ---- - fs/btrfs/block-rsv.c | 2 +- - fs/btrfs/block-rsv.h | 9 +++++++++ - fs/btrfs/transaction.c | 4 ++-- - 3 files changed, 12 insertions(+), 3 deletions(-) - -diff --git a/fs/btrfs/block-rsv.c b/fs/btrfs/block-rsv.c -index bc920afe23bf..692a1739bef6 100644 ---- a/fs/btrfs/block-rsv.c -+++ b/fs/btrfs/block-rsv.c -@@ -285,7 +285,7 @@ u64 btrfs_block_rsv_release(struct btrfs_fs_info *fs_info, - */ - if (block_rsv == delayed_rsv) - target = global_rsv; -- else if (block_rsv != global_rsv && !delayed_rsv->full) -+ else if (block_rsv != global_rsv && !btrfs_block_rsv_full(delayed_rsv)) - target = delayed_rsv; - - if (target && block_rsv->space_info != target->space_info) -diff --git a/fs/btrfs/block-rsv.h b/fs/btrfs/block-rsv.h -index 0b6ae5302837..f0431547acf2 100644 ---- a/fs/btrfs/block-rsv.h -+++ b/fs/btrfs/block-rsv.h -@@ -90,4 +90,13 @@ static inline void btrfs_unuse_block_rsv(struct btrfs_fs_info *fs_info, - btrfs_block_rsv_release(fs_info, block_rsv, 0, NULL); - } - -+/* -+ * Fast path to check if the reserve is full, may be carefully used outside of -+ * locks. -+ */ -+static inline bool btrfs_block_rsv_full(const struct btrfs_block_rsv *rsv) -+{ -+ return data_race(rsv->full); -+} -+ - #endif /* BTRFS_BLOCK_RSV_H */ -diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c -index 8daa9e4eb1d2..3cfa7cce266e 100644 ---- a/fs/btrfs/transaction.c -+++ b/fs/btrfs/transaction.c -@@ -608,7 +608,7 @@ start_transaction(struct btrfs_root *root, unsigned int num_items, - */ - num_bytes = btrfs_calc_insert_metadata_size(fs_info, num_items); - if (flush == BTRFS_RESERVE_FLUSH_ALL && -- delayed_refs_rsv->full == 0) { -+ btrfs_block_rsv_full(delayed_refs_rsv) == 0) { - delayed_refs_bytes = num_bytes; - num_bytes <<= 1; - } -@@ -633,7 +633,7 @@ start_transaction(struct btrfs_root *root, unsigned int num_items, - if (rsv->space_info->force_alloc) - do_chunk_alloc = true; - } else if (num_items == 0 && flush == BTRFS_RESERVE_FLUSH_ALL && -- !delayed_refs_rsv->full) { -+ !btrfs_block_rsv_full(delayed_refs_rsv)) { - /* - * Some people call with btrfs_start_transaction(root, 0) - * because they can be throttled, but have some other mechanism --- -2.35.1 - diff --git a/queue-5.10/series b/queue-5.10/series index 257a2bf969b..5bbd91a317c 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -404,7 +404,6 @@ arm64-dts-imx8mq-librem5-add-bq25895-as-max17055-s-p.patch arm-orion-fix-include-path.patch btrfs-scrub-try-to-fix-super-block-errors.patch btrfs-check-superblock-to-ensure-the-fs-was-not-modi.patch -btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch arm64-dts-uniphier-add-usb-device-support-for-pxs3-r.patch selftests-cpu-hotplug-use-return-instead-of-exit.patch clk-zynqmp-fix-stack-out-of-bounds-in-strncpy.patch diff --git a/queue-5.15/btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch b/queue-5.15/btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch deleted file mode 100644 index 7aaa0b114aa..00000000000 --- a/queue-5.15/btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 4524d3949d0bf4877bf901de76095f3818c3f1dc Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 5 Sep 2022 18:32:23 +0200 -Subject: btrfs: add KCSAN annotations for unlocked access to block_rsv->full - -From: David Sterba - -[ Upstream commit 748f553c3c4c4f175c6c834358632aff802d72cf ] - -KCSAN reports that there's unlocked access mixed with locked access, -which is technically correct but is not a bug. To avoid false alerts at -least from KCSAN, add annotation and use a wrapper whenever ->full is -accessed for read outside of lock. - -It is used as a fast check and only advisory. In the worst case the -block reserve is found !full and becomes full in the meantime, but -properly handled. - -Depending on the value of ->full, btrfs_block_rsv_release decides -where to return the reservation, and block_rsv_release_bytes handles a -NULL pointer for block_rsv and if it's not NULL then it double checks -the full status under a lock. - -Link: https://lore.kernel.org/linux-btrfs/CAAwBoOJDjei5Hnem155N_cJwiEkVwJYvgN-tQrwWbZQGhFU=cA@mail.gmail.com/ -Link: https://lore.kernel.org/linux-btrfs/YvHU/vsXd7uz5V6j@hungrycats.org -Reported-by: Zygo Blaxell -Signed-off-by: David Sterba -Signed-off-by: Sasha Levin ---- - fs/btrfs/block-rsv.c | 2 +- - fs/btrfs/block-rsv.h | 9 +++++++++ - fs/btrfs/transaction.c | 4 ++-- - 3 files changed, 12 insertions(+), 3 deletions(-) - -diff --git a/fs/btrfs/block-rsv.c b/fs/btrfs/block-rsv.c -index 04a6226e0388..3e0eb69b6d4e 100644 ---- a/fs/btrfs/block-rsv.c -+++ b/fs/btrfs/block-rsv.c -@@ -285,7 +285,7 @@ u64 btrfs_block_rsv_release(struct btrfs_fs_info *fs_info, - */ - if (block_rsv == delayed_rsv) - target = global_rsv; -- else if (block_rsv != global_rsv && !delayed_rsv->full) -+ else if (block_rsv != global_rsv && !btrfs_block_rsv_full(delayed_rsv)) - target = delayed_rsv; - - if (target && block_rsv->space_info != target->space_info) -diff --git a/fs/btrfs/block-rsv.h b/fs/btrfs/block-rsv.h -index 0b6ae5302837..f0431547acf2 100644 ---- a/fs/btrfs/block-rsv.h -+++ b/fs/btrfs/block-rsv.h -@@ -90,4 +90,13 @@ static inline void btrfs_unuse_block_rsv(struct btrfs_fs_info *fs_info, - btrfs_block_rsv_release(fs_info, block_rsv, 0, NULL); - } - -+/* -+ * Fast path to check if the reserve is full, may be carefully used outside of -+ * locks. -+ */ -+static inline bool btrfs_block_rsv_full(const struct btrfs_block_rsv *rsv) -+{ -+ return data_race(rsv->full); -+} -+ - #endif /* BTRFS_BLOCK_RSV_H */ -diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c -index 642cd2b55fa0..6b6a1a277f01 100644 ---- a/fs/btrfs/transaction.c -+++ b/fs/btrfs/transaction.c -@@ -619,7 +619,7 @@ start_transaction(struct btrfs_root *root, unsigned int num_items, - */ - num_bytes = btrfs_calc_insert_metadata_size(fs_info, num_items); - if (flush == BTRFS_RESERVE_FLUSH_ALL && -- delayed_refs_rsv->full == 0) { -+ btrfs_block_rsv_full(delayed_refs_rsv) == 0) { - delayed_refs_bytes = num_bytes; - num_bytes <<= 1; - } -@@ -644,7 +644,7 @@ start_transaction(struct btrfs_root *root, unsigned int num_items, - if (rsv->space_info->force_alloc) - do_chunk_alloc = true; - } else if (num_items == 0 && flush == BTRFS_RESERVE_FLUSH_ALL && -- !delayed_refs_rsv->full) { -+ !btrfs_block_rsv_full(delayed_refs_rsv)) { - /* - * Some people call with btrfs_start_transaction(root, 0) - * because they can be throttled, but have some other mechanism --- -2.35.1 - diff --git a/queue-5.15/series b/queue-5.15/series index b1c7d376284..36f86719194 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -541,7 +541,6 @@ btrfs-change-the-lockdep-class-of-free-space-inode-s.patch btrfs-scrub-try-to-fix-super-block-errors.patch btrfs-don-t-print-information-about-space-cache-or-t.patch btrfs-check-superblock-to-ensure-the-fs-was-not-modi.patch -btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch arm64-dts-uniphier-add-usb-device-support-for-pxs3-r.patch arm-9242-1-kasan-only-map-modules-if-config_kasan_vm.patch selftests-cpu-hotplug-use-return-instead-of-exit.patch diff --git a/queue-5.19/btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch b/queue-5.19/btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch deleted file mode 100644 index bcef590419e..00000000000 --- a/queue-5.19/btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 89489c0edd36ee5ab911d4152849aa4d96e85ac5 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 5 Sep 2022 18:32:23 +0200 -Subject: btrfs: add KCSAN annotations for unlocked access to block_rsv->full - -From: David Sterba - -[ Upstream commit 748f553c3c4c4f175c6c834358632aff802d72cf ] - -KCSAN reports that there's unlocked access mixed with locked access, -which is technically correct but is not a bug. To avoid false alerts at -least from KCSAN, add annotation and use a wrapper whenever ->full is -accessed for read outside of lock. - -It is used as a fast check and only advisory. In the worst case the -block reserve is found !full and becomes full in the meantime, but -properly handled. - -Depending on the value of ->full, btrfs_block_rsv_release decides -where to return the reservation, and block_rsv_release_bytes handles a -NULL pointer for block_rsv and if it's not NULL then it double checks -the full status under a lock. - -Link: https://lore.kernel.org/linux-btrfs/CAAwBoOJDjei5Hnem155N_cJwiEkVwJYvgN-tQrwWbZQGhFU=cA@mail.gmail.com/ -Link: https://lore.kernel.org/linux-btrfs/YvHU/vsXd7uz5V6j@hungrycats.org -Reported-by: Zygo Blaxell -Signed-off-by: David Sterba -Signed-off-by: Sasha Levin ---- - fs/btrfs/block-rsv.c | 2 +- - fs/btrfs/block-rsv.h | 9 +++++++++ - fs/btrfs/transaction.c | 4 ++-- - 3 files changed, 12 insertions(+), 3 deletions(-) - -diff --git a/fs/btrfs/block-rsv.c b/fs/btrfs/block-rsv.c -index b3ee49b0b1e8..7a586fccddda 100644 ---- a/fs/btrfs/block-rsv.c -+++ b/fs/btrfs/block-rsv.c -@@ -286,7 +286,7 @@ u64 btrfs_block_rsv_release(struct btrfs_fs_info *fs_info, - */ - if (block_rsv == delayed_rsv) - target = global_rsv; -- else if (block_rsv != global_rsv && !delayed_rsv->full) -+ else if (block_rsv != global_rsv && !btrfs_block_rsv_full(delayed_rsv)) - target = delayed_rsv; - - if (target && block_rsv->space_info != target->space_info) -diff --git a/fs/btrfs/block-rsv.h b/fs/btrfs/block-rsv.h -index 3b67ff08d434..fe97f4112028 100644 ---- a/fs/btrfs/block-rsv.h -+++ b/fs/btrfs/block-rsv.h -@@ -91,4 +91,13 @@ static inline void btrfs_unuse_block_rsv(struct btrfs_fs_info *fs_info, - btrfs_block_rsv_release(fs_info, block_rsv, 0, NULL); - } - -+/* -+ * Fast path to check if the reserve is full, may be carefully used outside of -+ * locks. -+ */ -+static inline bool btrfs_block_rsv_full(const struct btrfs_block_rsv *rsv) -+{ -+ return data_race(rsv->full); -+} -+ - #endif /* BTRFS_BLOCK_RSV_H */ -diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c -index 875b801ab3d7..eec5c17b7c5a 100644 ---- a/fs/btrfs/transaction.c -+++ b/fs/btrfs/transaction.c -@@ -624,7 +624,7 @@ start_transaction(struct btrfs_root *root, unsigned int num_items, - */ - num_bytes = btrfs_calc_insert_metadata_size(fs_info, num_items); - if (flush == BTRFS_RESERVE_FLUSH_ALL && -- delayed_refs_rsv->full == 0) { -+ btrfs_block_rsv_full(delayed_refs_rsv) == 0) { - delayed_refs_bytes = num_bytes; - num_bytes <<= 1; - } -@@ -649,7 +649,7 @@ start_transaction(struct btrfs_root *root, unsigned int num_items, - if (rsv->space_info->force_alloc) - do_chunk_alloc = true; - } else if (num_items == 0 && flush == BTRFS_RESERVE_FLUSH_ALL && -- !delayed_refs_rsv->full) { -+ !btrfs_block_rsv_full(delayed_refs_rsv)) { - /* - * Some people call with btrfs_start_transaction(root, 0) - * because they can be throttled, but have some other mechanism --- -2.35.1 - diff --git a/queue-5.19/series b/queue-5.19/series index a7b8a992239..f5cecb32d63 100644 --- a/queue-5.19/series +++ b/queue-5.19/series @@ -733,7 +733,6 @@ btrfs-scrub-try-to-fix-super-block-errors.patch btrfs-don-t-print-information-about-space-cache-or-t.patch btrfs-call-__btrfs_remove_free_space_cache_locked-on.patch btrfs-check-superblock-to-ensure-the-fs-was-not-modi.patch -btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch arm64-dts-uniphier-add-usb-device-support-for-pxs3-r.patch arm-9233-1-stacktrace-skip-frame-pointer-boundary-ch.patch arm-9234-1-stacktrace-avoid-duplicate-saving-of-exce.patch diff --git a/queue-6.0/btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch b/queue-6.0/btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch deleted file mode 100644 index b00612f9837..00000000000 --- a/queue-6.0/btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 1d1a3f9298043318b9ce0d9ef5bba16c97e97c8b Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 5 Sep 2022 18:32:23 +0200 -Subject: btrfs: add KCSAN annotations for unlocked access to block_rsv->full - -From: David Sterba - -[ Upstream commit 748f553c3c4c4f175c6c834358632aff802d72cf ] - -KCSAN reports that there's unlocked access mixed with locked access, -which is technically correct but is not a bug. To avoid false alerts at -least from KCSAN, add annotation and use a wrapper whenever ->full is -accessed for read outside of lock. - -It is used as a fast check and only advisory. In the worst case the -block reserve is found !full and becomes full in the meantime, but -properly handled. - -Depending on the value of ->full, btrfs_block_rsv_release decides -where to return the reservation, and block_rsv_release_bytes handles a -NULL pointer for block_rsv and if it's not NULL then it double checks -the full status under a lock. - -Link: https://lore.kernel.org/linux-btrfs/CAAwBoOJDjei5Hnem155N_cJwiEkVwJYvgN-tQrwWbZQGhFU=cA@mail.gmail.com/ -Link: https://lore.kernel.org/linux-btrfs/YvHU/vsXd7uz5V6j@hungrycats.org -Reported-by: Zygo Blaxell -Signed-off-by: David Sterba -Signed-off-by: Sasha Levin ---- - fs/btrfs/block-rsv.c | 2 +- - fs/btrfs/block-rsv.h | 9 +++++++++ - fs/btrfs/transaction.c | 4 ++-- - 3 files changed, 12 insertions(+), 3 deletions(-) - -diff --git a/fs/btrfs/block-rsv.c b/fs/btrfs/block-rsv.c -index 06be0644dd37..046caf14a4bb 100644 ---- a/fs/btrfs/block-rsv.c -+++ b/fs/btrfs/block-rsv.c -@@ -286,7 +286,7 @@ u64 btrfs_block_rsv_release(struct btrfs_fs_info *fs_info, - */ - if (block_rsv == delayed_rsv) - target = global_rsv; -- else if (block_rsv != global_rsv && !delayed_rsv->full) -+ else if (block_rsv != global_rsv && !btrfs_block_rsv_full(delayed_rsv)) - target = delayed_rsv; - - if (target && block_rsv->space_info != target->space_info) -diff --git a/fs/btrfs/block-rsv.h b/fs/btrfs/block-rsv.h -index 0c183709be00..578c3497a455 100644 ---- a/fs/btrfs/block-rsv.h -+++ b/fs/btrfs/block-rsv.h -@@ -92,4 +92,13 @@ static inline void btrfs_unuse_block_rsv(struct btrfs_fs_info *fs_info, - btrfs_block_rsv_release(fs_info, block_rsv, 0, NULL); - } - -+/* -+ * Fast path to check if the reserve is full, may be carefully used outside of -+ * locks. -+ */ -+static inline bool btrfs_block_rsv_full(const struct btrfs_block_rsv *rsv) -+{ -+ return data_race(rsv->full); -+} -+ - #endif /* BTRFS_BLOCK_RSV_H */ -diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c -index 6e3b2cb6a04a..255b0c0e1674 100644 ---- a/fs/btrfs/transaction.c -+++ b/fs/btrfs/transaction.c -@@ -635,7 +635,7 @@ start_transaction(struct btrfs_root *root, unsigned int num_items, - */ - num_bytes = btrfs_calc_insert_metadata_size(fs_info, num_items); - if (flush == BTRFS_RESERVE_FLUSH_ALL && -- delayed_refs_rsv->full == 0) { -+ btrfs_block_rsv_full(delayed_refs_rsv) == 0) { - delayed_refs_bytes = num_bytes; - num_bytes <<= 1; - } -@@ -660,7 +660,7 @@ start_transaction(struct btrfs_root *root, unsigned int num_items, - if (rsv->space_info->force_alloc) - do_chunk_alloc = true; - } else if (num_items == 0 && flush == BTRFS_RESERVE_FLUSH_ALL && -- !delayed_refs_rsv->full) { -+ !btrfs_block_rsv_full(delayed_refs_rsv)) { - /* - * Some people call with btrfs_start_transaction(root, 0) - * because they can be throttled, but have some other mechanism --- -2.35.1 - diff --git a/queue-6.0/series b/queue-6.0/series index c3f66700315..7f0ec1f8e5b 100644 --- a/queue-6.0/series +++ b/queue-6.0/series @@ -821,7 +821,6 @@ btrfs-scrub-try-to-fix-super-block-errors.patch btrfs-don-t-print-information-about-space-cache-or-t.patch btrfs-call-__btrfs_remove_free_space_cache_locked-on.patch btrfs-check-superblock-to-ensure-the-fs-was-not-modi.patch -btrfs-add-kcsan-annotations-for-unlocked-access-to-b.patch arm64-dts-uniphier-add-usb-device-support-for-pxs3-r.patch arm-9233-1-stacktrace-skip-frame-pointer-boundary-ch.patch arm-9234-1-stacktrace-avoid-duplicate-saving-of-exce.patch