]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fs: Add the __data_racy annotation to backing_dev_info.ra_pages
authorBart Van Assche <bvanassche@acm.org>
Fri, 14 Nov 2025 21:04:06 +0000 (13:04 -0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 18 Nov 2025 22:00:11 +0000 (15:00 -0700)
Some but not all .ra_pages changes happen while block layer I/O is paused
with blk_mq_freeze_queue(). Filesystems may read .ra_pages even while
block layer I/O is paused, e.g. from inside their .fadvise callback.
Annotating all .ra_pages reads with READ_ONCE() would be cumbersome.
Hence, add the __data_racy annotatation to the .ra_pages member
variable.

Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/backing-dev-defs.h

index c5c9d89c73edcce2b510a201e64b607fe083b136..30f4bd9ff7c8fcc601a6e77bd2ab43f9a4dd6dec 100644 (file)
@@ -168,7 +168,9 @@ struct backing_dev_info {
        u64 id;
        struct rb_node rb_node; /* keyed by ->id */
        struct list_head bdi_list;
-       unsigned long ra_pages; /* max readahead in PAGE_SIZE units */
+       /* max readahead in PAGE_SIZE units */
+       unsigned long __data_racy ra_pages;
+
        unsigned long io_pages; /* max allowed IO size */
 
        struct kref refcnt;     /* Reference counter for the structure */