Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: Add the __data_racy annotation to backing_dev_info.ra_pages

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>

authored by

Bart Van Assche and committed by
Jens Axboe
42adb2d4 152c331b

+3 -1
+3 -1
include/linux/backing-dev-defs.h
··· 168 168 u64 id; 169 169 struct rb_node rb_node; /* keyed by ->id */ 170 170 struct list_head bdi_list; 171 - unsigned long ra_pages; /* max readahead in PAGE_SIZE units */ 171 + /* max readahead in PAGE_SIZE units */ 172 + unsigned long __data_racy ra_pages; 173 + 172 174 unsigned long io_pages; /* max allowed IO size */ 173 175 174 176 struct kref refcnt; /* Reference counter for the structure */