Message ID | 1234933.1617886271@warthog.procyon.org.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mm, netfs: Fix readahead bits | expand |
On Thu, Apr 08, 2021 at 01:51:11PM +0100, David Howells wrote: > Hi Willy, Jeff, > > I think we need the attached change to readahead_expand() to fix the oops seen > when it tries to dereference ractl->ra when called indirectly from > netfs_write_begin(). > > netfs_write_begin() should also be using DEFINE_READAHEAD() rather than > manually initialising the ractl variable so that Willy can find it;-). ACK. Please fold into the appropriate patches.
diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c index 762a15350242..1d3b50c5db6d 100644 --- a/fs/netfs/read_helper.c +++ b/fs/netfs/read_helper.c @@ -1065,12 +1065,7 @@ int netfs_write_begin(struct file *file, struct address_space *mapping, loff_t size; int ret; - struct readahead_control ractl = { - .file = file, - .mapping = mapping, - ._index = index, - ._nr_pages = 0, - }; + DEFINE_READAHEAD(ractl, file, NULL, mapping, index); retry: page = grab_cache_page_write_begin(mapping, index, 0); diff --git a/mm/readahead.c b/mm/readahead.c index 65215c48f25c..f02dbebf1cef 100644 --- a/mm/readahead.c +++ b/mm/readahead.c @@ -706,8 +706,10 @@ void readahead_expand(struct readahead_control *ractl, return; } ractl->_nr_pages++; - ra->size++; - ra->async_size++; + if (ra) { + ra->size++; + ra->async_size++; + } } } EXPORT_SYMBOL(readahead_expand);