[PATCH] mm, netfs: Fix readahead bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;-).

David
---
commit 9c0931285131c3b65ab4b58b614c30c7feb1dbd4
Author: David Howells <dhowells@xxxxxxxxxx>
Date:   Thu Apr 8 13:39:54 2021 +0100

    netfs: readahead fixes

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);





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux