* [PATCH v3 00/18] Allow readpage to return a locked page
@ 2020-10-16 16:04 Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 01/18] cachefiles: Handle readpage error correctly Matthew Wilcox (Oracle)
` (17 more replies)
0 siblings, 18 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel
Cc: Matthew Wilcox (Oracle),
linux-mm, David Howells, Steve French, linux-cifs, Nicolas Pitre,
Tyler Hicks, ecryptfs, Theodore Ts'o, Andreas Dilger,
linux-ext4, Miklos Szeredi, Hans de Goede
I've dropped the conversion of readpage implementations to synchronous
from this patchset. I realised I'd neglected the requirement for making
the sleep killable, and that turns out to be more convoluted to fix.
So these patches add:
- An error-path bugfix for cachefiles.
- The ability for the filesystem to tell the caller of ->readpage
that the read was successful and the page was not unlocked. This is
a performance improvement for some scenarios that I think are rare.
- Mildly improved error handling for ext4.
v2: https://lore.kernel.org/linux-fsdevel/20201009143104.22673-1-willy@infradead.org/
v1: https://lore.kernel.org/linux-fsdevel/20200917151050.5363-1-willy@infradead.org/
Matthew Wilcox (Oracle) (18):
cachefiles: Handle readpage error correctly
swap: Call aops->readahead if appropriate
fs: Add AOP_UPDATED_PAGE return value
mm/filemap: Inline wait_on_page_read into its one caller
9p: Tell the VFS that readpage was synchronous
afs: Tell the VFS that readpage was synchronous
ceph: Tell the VFS that readpage was synchronous
cifs: Tell the VFS that readpage was synchronous
cramfs: Tell the VFS that readpage was synchronous
ecryptfs: Tell the VFS that readpage was synchronous
ext4: Tell the VFS that readpage was synchronous
ext4: Return error from ext4_readpage
fuse: Tell the VFS that readpage was synchronous
hostfs: Tell the VFS that readpage was synchronous
jffs2: Tell the VFS that readpage was synchronous
ubifs: Tell the VFS that readpage was synchronous
udf: Tell the VFS that readpage was synchronous
vboxsf: Tell the VFS that readpage was synchronous
Documentation/filesystems/locking.rst | 7 +++---
Documentation/filesystems/vfs.rst | 21 +++++++++++------
fs/9p/vfs_addr.c | 6 ++++-
fs/afs/file.c | 3 ++-
fs/buffer.c | 15 +++++++-----
fs/cachefiles/rdwr.c | 9 ++++++++
fs/ceph/addr.c | 9 ++++----
fs/cifs/file.c | 8 +++++--
fs/cramfs/inode.c | 5 ++--
fs/ecryptfs/mmap.c | 11 +++++----
fs/ext4/inline.c | 9 +++++---
fs/ext4/readpage.c | 24 +++++++++++--------
fs/fuse/file.c | 2 ++
fs/hostfs/hostfs_kern.c | 2 ++
fs/jffs2/file.c | 6 +++--
fs/ubifs/file.c | 16 ++++++++-----
fs/udf/file.c | 3 +--
fs/vboxsf/file.c | 2 ++
include/linux/fs.h | 5 ++++
mm/filemap.c | 33 +++++++++++++--------------
mm/page_io.c | 27 ++++++++++++++++++++--
mm/readahead.c | 3 ++-
22 files changed, 151 insertions(+), 75 deletions(-)
--
2.28.0
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v3 01/18] cachefiles: Handle readpage error correctly
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 02/18] swap: Call aops->readahead if appropriate Matthew Wilcox (Oracle)
` (16 subsequent siblings)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, David Howells, stable
If ->readpage returns an error, it has already unlocked the page.
Fixes: 5e929b33c393 ("CacheFiles: Handle truncate unlocking the page we're reading")
Cc: stable@vger.kernel.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/cachefiles/rdwr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
index 3080cda9e824..8bda092e60c5 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -121,7 +121,7 @@ static int cachefiles_read_reissue(struct cachefiles_object *object,
_debug("reissue read");
ret = bmapping->a_ops->readpage(NULL, backpage);
if (ret < 0)
- goto unlock_discard;
+ goto discard;
}
/* but the page may have been read before the monitor was installed, so
@@ -138,6 +138,7 @@ static int cachefiles_read_reissue(struct cachefiles_object *object,
unlock_discard:
unlock_page(backpage);
+discard:
spin_lock_irq(&object->work_lock);
list_del(&monitor->op_link);
spin_unlock_irq(&object->work_lock);
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 02/18] swap: Call aops->readahead if appropriate
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 01/18] cachefiles: Handle readpage error correctly Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 03/18] fs: Add AOP_UPDATED_PAGE return value Matthew Wilcox (Oracle)
` (15 subsequent siblings)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm
Some filesystems have a synchronous readpage and an asynchronous
readahead. Call the readahead operation if we're trying to do swap
readahead.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
mm/page_io.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/mm/page_io.c b/mm/page_io.c
index e485a6e8a6cd..faf5ccb42946 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -367,6 +367,24 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
return ret;
}
+static int mapping_readpage(struct file *file, struct address_space *mapping,
+ struct page *page, bool synchronous)
+{
+ struct readahead_control ractl = {
+ .file = file,
+ .mapping = mapping,
+ ._index = page->index,
+ ._nr_pages = 1,
+ };
+
+ if (!synchronous && mapping->a_ops->readahead) {
+ mapping->a_ops->readahead(&ractl);
+ return 0;
+ }
+
+ return mapping->a_ops->readpage(file, page);
+}
+
int swap_readpage(struct page *page, bool synchronous)
{
struct bio *bio;
@@ -395,9 +413,9 @@ int swap_readpage(struct page *page, bool synchronous)
if (data_race(sis->flags & SWP_FS)) {
struct file *swap_file = sis->swap_file;
- struct address_space *mapping = swap_file->f_mapping;
- ret = mapping->a_ops->readpage(swap_file, page);
+ ret = mapping_readpage(swap_file, swap_file->f_mapping,
+ page, synchronous);
if (!ret)
count_vm_event(PSWPIN);
goto out;
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 03/18] fs: Add AOP_UPDATED_PAGE return value
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 01/18] cachefiles: Handle readpage error correctly Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 02/18] swap: Call aops->readahead if appropriate Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 04/18] mm/filemap: Inline wait_on_page_read into its one caller Matthew Wilcox (Oracle)
` (14 subsequent siblings)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm
Allow synchronous ->readpage implementations to execute more
efficiently by skipping the re-locking of the page.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
Documentation/filesystems/locking.rst | 7 ++++---
Documentation/filesystems/vfs.rst | 21 ++++++++++++++-------
fs/buffer.c | 15 +++++++++------
fs/cachefiles/rdwr.c | 8 ++++++++
include/linux/fs.h | 5 +++++
mm/filemap.c | 15 +++++++++++++--
mm/page_io.c | 7 ++++++-
mm/readahead.c | 3 ++-
8 files changed, 61 insertions(+), 20 deletions(-)
diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst
index 64f94a18d97e..06a7a8bf2362 100644
--- a/Documentation/filesystems/locking.rst
+++ b/Documentation/filesystems/locking.rst
@@ -269,7 +269,7 @@ locking rules:
ops PageLocked(page) i_rwsem
====================== ======================== =========
writepage: yes, unlocks (see below)
-readpage: yes, unlocks
+readpage: yes, may unlock
writepages:
set_page_dirty no
readahead: yes, unlocks
@@ -294,8 +294,9 @@ swap_deactivate: no
->write_begin(), ->write_end() and ->readpage() may be called from
the request handler (/dev/loop).
-->readpage() unlocks the page, either synchronously or via I/O
-completion.
+->readpage() may return AOP_UPDATED_PAGE if the page is now Uptodate
+or 0 if the page will be unlocked asynchronously by I/O completion.
+If it returns -errno, it should unlock the page.
->readahead() unlocks the pages that I/O is attempted on like ->readpage().
diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst
index ca52c82e5bb5..16248c299aaa 100644
--- a/Documentation/filesystems/vfs.rst
+++ b/Documentation/filesystems/vfs.rst
@@ -643,7 +643,7 @@ set_page_dirty to write data into the address_space, and writepage and
writepages to writeback data to storage.
Adding and removing pages to/from an address_space is protected by the
-inode's i_mutex.
+inode's i_rwsem held exclusively.
When data is written to a page, the PG_Dirty flag should be set. It
typically remains set until writepage asks for it to be written. This
@@ -757,12 +757,19 @@ cache in your filesystem. The following members are defined:
``readpage``
called by the VM to read a page from backing store. The page
- will be Locked when readpage is called, and should be unlocked
- and marked uptodate once the read completes. If ->readpage
- discovers that it needs to unlock the page for some reason, it
- can do so, and then return AOP_TRUNCATED_PAGE. In this case,
- the page will be relocated, relocked and if that all succeeds,
- ->readpage will be called again.
+ will be Locked and !Uptodate when readpage is called. Ideally,
+ the filesystem will bring the page Uptodate and return
+ AOP_UPDATED_PAGE. If the filesystem encounters an error, it
+ should unlock the page and return a negative errno without marking
+ the page Uptodate. It does not need to mark the page as Error.
+ If the filesystem returns 0, this means the page will be unlocked
+ asynchronously by I/O completion. The VFS will wait for the
+ page to be unlocked, so there is no advantage to executing this
+ operation asynchronously.
+
+ The filesystem can also return AOP_TRUNCATED_PAGE to indicate
+ that it had to unlock the page to avoid a deadlock. The caller
+ will re-check the page cache and call ->readpage again.
``writepages``
called by the VM to write out pages associated with the
diff --git a/fs/buffer.c b/fs/buffer.c
index 50bbc99e3d96..1d5337517dcd 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2856,14 +2856,17 @@ int nobh_truncate_page(struct address_space *mapping,
/* Ok, it's mapped. Make sure it's up-to-date */
if (!PageUptodate(page)) {
err = mapping->a_ops->readpage(NULL, page);
- if (err) {
+ if (err < 0) {
put_page(page);
goto out;
- }
- lock_page(page);
- if (!PageUptodate(page)) {
- err = -EIO;
- goto unlock;
+ } else if (err == 0) {
+ lock_page(page);
+ if (!PageUptodate(page)) {
+ err = -EIO;
+ goto unlock;
+ }
+ } else {
+ err = 0;
}
if (page_has_buffers(page))
goto has_buffers;
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
index 8bda092e60c5..cc4cc535caf5 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
@@ -122,6 +122,10 @@ static int cachefiles_read_reissue(struct cachefiles_object *object,
ret = bmapping->a_ops->readpage(NULL, backpage);
if (ret < 0)
goto discard;
+ if (ret == AOP_UPDATED_PAGE) {
+ ret = 0;
+ goto unlock_discard;
+ }
}
/* but the page may have been read before the monitor was installed, so
@@ -285,6 +289,8 @@ static int cachefiles_read_backing_file_one(struct cachefiles_object *object,
ret = bmapping->a_ops->readpage(NULL, backpage);
if (ret < 0)
goto read_error;
+ if (ret == AOP_UPDATED_PAGE)
+ unlock_page(backpage);
/* set the monitor to transfer the data across */
monitor_backing_page:
@@ -523,6 +529,8 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
ret = bmapping->a_ops->readpage(NULL, backpage);
if (ret < 0)
goto read_error;
+ if (ret == AOP_UPDATED_PAGE)
+ unlock_page(backpage);
/* add the netfs page to the pagecache and LRU, and set the
* monitor to transfer the data across */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7519ae003a08..badf80e133fd 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -273,6 +273,10 @@ struct iattr {
* reference, it should drop it before retrying. Returned
* by readpage().
*
+ * @AOP_UPDATED_PAGE: The readpage method has brought the page Uptodate
+ * without releasing the page lock. This is suitable for synchronous
+ * implementations of readpage.
+ *
* address_space_operation functions return these large constants to indicate
* special semantics to the caller. These are much larger than the bytes in a
* page to allow for functions that return the number of bytes operated on in a
@@ -282,6 +286,7 @@ struct iattr {
enum positive_aop_returns {
AOP_WRITEPAGE_ACTIVATE = 0x80000,
AOP_TRUNCATED_PAGE = 0x80001,
+ AOP_UPDATED_PAGE = 0x80002,
};
#define AOP_FLAG_CONT_EXPAND 0x0001 /* called from cont_expand */
diff --git a/mm/filemap.c b/mm/filemap.c
index 1aaea26556cc..95b68ec1f22c 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2254,8 +2254,13 @@ ssize_t generic_file_buffered_read(struct kiocb *iocb,
* PG_error will be set again if readpage fails.
*/
ClearPageError(page);
- /* Start the actual read. The read will unlock the page. */
+ /* Start the actual read. The read may unlock the page. */
error = mapping->a_ops->readpage(filp, page);
+ if (error == AOP_UPDATED_PAGE) {
+ unlock_page(page);
+ error = 0;
+ goto page_ok;
+ }
if (unlikely(error)) {
if (error == AOP_TRUNCATED_PAGE) {
@@ -2619,7 +2624,7 @@ vm_fault_t filemap_fault(struct vm_fault *vmf)
*/
if (unlikely(!PageUptodate(page)))
goto page_not_uptodate;
-
+page_ok:
/*
* We've made it this far and we had to drop our mmap_lock, now is the
* time to return to the upper layer and have it re-find the vma and
@@ -2654,6 +2659,8 @@ vm_fault_t filemap_fault(struct vm_fault *vmf)
ClearPageError(page);
fpin = maybe_unlock_mmap_for_io(vmf, fpin);
error = mapping->a_ops->readpage(file, page);
+ if (error == AOP_UPDATED_PAGE)
+ goto page_ok;
if (!error) {
wait_on_page_locked(page);
if (!PageUptodate(page))
@@ -2867,6 +2874,10 @@ static struct page *do_read_cache_page(struct address_space *mapping,
err = filler(data, page);
else
err = mapping->a_ops->readpage(data, page);
+ if (err == AOP_UPDATED_PAGE) {
+ unlock_page(page);
+ goto out;
+ }
if (err < 0) {
put_page(page);
diff --git a/mm/page_io.c b/mm/page_io.c
index faf5ccb42946..f141a171d09c 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -376,13 +376,18 @@ static int mapping_readpage(struct file *file, struct address_space *mapping,
._index = page->index,
._nr_pages = 1,
};
+ int ret;
if (!synchronous && mapping->a_ops->readahead) {
mapping->a_ops->readahead(&ractl);
return 0;
}
- return mapping->a_ops->readpage(file, page);
+ ret = mapping->a_ops->readpage(file, page);
+ if (ret != AOP_UPDATED_PAGE)
+ return ret;
+ unlock_page(page);
+ return 0;
}
int swap_readpage(struct page *page, bool synchronous)
diff --git a/mm/readahead.c b/mm/readahead.c
index 3c9a8dd7c56c..f182fa731ab3 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -142,7 +142,8 @@ static void read_pages(struct readahead_control *rac, struct list_head *pages,
rac->_nr_pages = 0;
} else {
while ((page = readahead_page(rac))) {
- aops->readpage(rac->file, page);
+ if (aops->readpage(rac->file, page) == AOP_UPDATED_PAGE)
+ unlock_page(page);
put_page(page);
}
}
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 04/18] mm/filemap: Inline wait_on_page_read into its one caller
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (2 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 03/18] fs: Add AOP_UPDATED_PAGE return value Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 05/18] 9p: Tell the VFS that readpage was synchronous Matthew Wilcox (Oracle)
` (13 subsequent siblings)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, Christoph Hellwig
Having this code inline helps the function read more easily.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
mm/filemap.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index 95b68ec1f22c..0ef06d515532 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2834,18 +2834,6 @@ EXPORT_SYMBOL(filemap_page_mkwrite);
EXPORT_SYMBOL(generic_file_mmap);
EXPORT_SYMBOL(generic_file_readonly_mmap);
-static struct page *wait_on_page_read(struct page *page)
-{
- if (!IS_ERR(page)) {
- wait_on_page_locked(page);
- if (!PageUptodate(page)) {
- put_page(page);
- page = ERR_PTR(-EIO);
- }
- }
- return page;
-}
-
static struct page *do_read_cache_page(struct address_space *mapping,
pgoff_t index,
int (*filler)(void *, struct page *),
@@ -2876,7 +2864,10 @@ static struct page *do_read_cache_page(struct address_space *mapping,
err = mapping->a_ops->readpage(data, page);
if (err == AOP_UPDATED_PAGE) {
unlock_page(page);
- goto out;
+ } else if (!err) {
+ wait_on_page_locked(page);
+ if (!PageUptodate(page))
+ err = -EIO;
}
if (err < 0) {
@@ -2884,9 +2875,6 @@ static struct page *do_read_cache_page(struct address_space *mapping,
return ERR_PTR(err);
}
- page = wait_on_page_read(page);
- if (IS_ERR(page))
- return page;
goto out;
}
if (PageUptodate(page))
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 05/18] 9p: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (3 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 04/18] mm/filemap: Inline wait_on_page_read into its one caller Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 06/18] afs: " Matthew Wilcox (Oracle)
` (12 subsequent siblings)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, Dominique Martinet
The 9p readpage implementation was already synchronous, so use
AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Dominique Martinet <asmadeus@codewreck.org>
---
fs/9p/vfs_addr.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index cce9ace651a2..506ca0ba2ec7 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -65,7 +65,7 @@ static int v9fs_fid_readpage(void *data, struct page *page)
SetPageUptodate(page);
v9fs_readpage_to_fscache(inode, page);
- retval = 0;
+ return AOP_UPDATED_PAGE;
done:
unlock_page(page);
@@ -280,6 +280,10 @@ static int v9fs_write_begin(struct file *filp, struct address_space *mapping,
goto out;
retval = v9fs_fid_readpage(v9inode->writeback_fid, page);
+ if (retval == AOP_UPDATED_PAGE) {
+ retval = 0;
+ goto out;
+ }
put_page(page);
if (!retval)
goto start;
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 06/18] afs: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (4 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 05/18] 9p: Tell the VFS that readpage was synchronous Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 07/18] ceph: " Matthew Wilcox (Oracle)
` (11 subsequent siblings)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, David Howells
The afs readpage implementation was already synchronous, so use
AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/afs/file.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/afs/file.c b/fs/afs/file.c
index 371d1488cc54..4aa2ad3bea6a 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -367,7 +367,8 @@ int afs_page_filler(void *data, struct page *page)
BUG_ON(PageFsCache(page));
}
#endif
- unlock_page(page);
+ _leave(" = AOP_UPDATED_PAGE");
+ return AOP_UPDATED_PAGE;
}
_leave(" = 0");
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 07/18] ceph: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (5 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 06/18] afs: " Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 08/18] cifs: " Matthew Wilcox (Oracle)
` (10 subsequent siblings)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, Jeff Layton
The ceph readpage implementation was already synchronous, so use
AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
---
fs/ceph/addr.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 6ea761c84494..b2bf8bf7a312 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -291,10 +291,11 @@ static int ceph_do_readpage(struct file *filp, struct page *page)
static int ceph_readpage(struct file *filp, struct page *page)
{
int r = ceph_do_readpage(filp, page);
- if (r != -EINPROGRESS)
- unlock_page(page);
- else
- r = 0;
+ if (r == -EINPROGRESS)
+ return 0;
+ if (r == 0)
+ return AOP_UPDATED_PAGE;
+ unlock_page(page);
return r;
}
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 08/18] cifs: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (6 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 07/18] ceph: " Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 09/18] cramfs: " Matthew Wilcox (Oracle)
` (9 subsequent siblings)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, Steve French, linux-cifs
The cifs readpage implementation was already synchronous, so use
AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/cifs/file.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index be46fab4c96d..533b151a9143 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -4537,7 +4537,8 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
/* send this page to the cache */
cifs_readpage_to_fscache(file_inode(file), page);
- rc = 0;
+ kunmap(page);
+ return AOP_UPDATED_PAGE;
io_error:
kunmap(page);
@@ -4677,7 +4678,10 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,
* an error, we don't need to return it. cifs_write_end will
* do a sync write instead since PG_uptodate isn't set.
*/
- cifs_readpage_worker(file, page, &page_start);
+ int err = cifs_readpage_worker(file, page, &page_start);
+
+ if (err == AOP_UPDATED_PAGE)
+ goto out;
put_page(page);
oncethru = 1;
goto start;
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 09/18] cramfs: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (7 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 08/18] cifs: " Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 10/18] ecryptfs: " Matthew Wilcox (Oracle)
` (8 subsequent siblings)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, Nicolas Pitre
The cramfs readpage implementation was already synchronous, so use
AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/cramfs/inode.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index 912308600d39..7a642146c074 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -916,15 +916,14 @@ static int cramfs_readpage(struct file *file, struct page *page)
flush_dcache_page(page);
kunmap(page);
SetPageUptodate(page);
- unlock_page(page);
- return 0;
+ return AOP_UPDATED_PAGE;
err:
kunmap(page);
ClearPageUptodate(page);
SetPageError(page);
unlock_page(page);
- return 0;
+ return -EIO;
}
static const struct address_space_operations cramfs_aops = {
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 10/18] ecryptfs: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (8 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 09/18] cramfs: " Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 11/18] ext4: " Matthew Wilcox (Oracle)
` (7 subsequent siblings)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, Tyler Hicks, ecryptfs
The ecryptfs readpage implementation was already synchronous, so use
AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ecryptfs/mmap.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 019572c6b39a..dee35181d789 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -219,12 +219,13 @@ static int ecryptfs_readpage(struct file *file, struct page *page)
}
}
out:
- if (rc)
- ClearPageUptodate(page);
- else
- SetPageUptodate(page);
- ecryptfs_printk(KERN_DEBUG, "Unlocking page with index = [0x%.16lx]\n",
+ ecryptfs_printk(KERN_DEBUG, "Returning page with index = [0x%.16lx]\n",
page->index);
+ if (!rc) {
+ SetPageUptodate(page);
+ return AOP_UPDATED_PAGE;
+ }
+ ClearPageUptodate(page);
unlock_page(page);
return rc;
}
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 11/18] ext4: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (9 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 10/18] ecryptfs: " Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-18 14:24 ` Theodore Y. Ts'o
2020-10-16 16:04 ` [PATCH v3 12/18] ext4: Return error from ext4_readpage Matthew Wilcox (Oracle)
` (6 subsequent siblings)
17 siblings, 1 reply; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel
Cc: Matthew Wilcox (Oracle),
linux-mm, Theodore Ts'o, Andreas Dilger, linux-ext4
The ext4 inline data readpage implementation was already synchronous,
so use AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ext4/inline.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 75c97bca0815..2a489243e4de 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -490,7 +490,8 @@ static int ext4_read_inline_page(struct inode *inode, struct page *page)
zero_user_segment(page, len, PAGE_SIZE);
SetPageUptodate(page);
brelse(iloc.bh);
-
+ if (ret >= 0)
+ return AOP_UPDATED_PAGE;
out:
return ret;
}
@@ -514,12 +515,14 @@ int ext4_readpage_inline(struct inode *inode, struct page *page)
else if (!PageUptodate(page)) {
zero_user_segment(page, 0, PAGE_SIZE);
SetPageUptodate(page);
+ ret = AOP_UPDATED_PAGE;
}
up_read(&EXT4_I(inode)->xattr_sem);
- unlock_page(page);
- return ret >= 0 ? 0 : ret;
+ if (ret < 0)
+ unlock_page(page);
+ return ret;
}
static int ext4_convert_inline_data_to_extent(struct address_space *mapping,
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 12/18] ext4: Return error from ext4_readpage
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (10 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 11/18] ext4: " Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-18 14:25 ` Theodore Y. Ts'o
2020-10-16 16:04 ` [PATCH v3 13/18] fuse: Tell the VFS that readpage was synchronous Matthew Wilcox (Oracle)
` (5 subsequent siblings)
17 siblings, 1 reply; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel
Cc: Matthew Wilcox (Oracle),
linux-mm, Theodore Ts'o, Andreas Dilger, linux-ext4
The error returned from ext4_map_blocks() was being discarded, leading
to the generic -EIO being returned to userspace. Now ext4 can return
more precise errors.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/ext4/readpage.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c
index f014c5e473a9..00a024f3a954 100644
--- a/fs/ext4/readpage.c
+++ b/fs/ext4/readpage.c
@@ -237,7 +237,7 @@ int ext4_mpage_readpages(struct inode *inode,
sector_t blocks[MAX_BUF_PER_PAGE];
unsigned page_block;
struct block_device *bdev = inode->i_sb->s_bdev;
- int length;
+ int length, err = 0;
unsigned relative_block = 0;
struct ext4_map_blocks map;
unsigned int nr_pages = rac ? readahead_count(rac) : 1;
@@ -301,14 +301,9 @@ int ext4_mpage_readpages(struct inode *inode,
map.m_lblk = block_in_file;
map.m_len = last_block - block_in_file;
- if (ext4_map_blocks(NULL, inode, &map, 0) < 0) {
- set_error_page:
- SetPageError(page);
- zero_user_segment(page, 0,
- PAGE_SIZE);
- unlock_page(page);
- goto next_page;
- }
+ err = ext4_map_blocks(NULL, inode, &map, 0);
+ if (err < 0)
+ goto err;
}
if ((map.m_flags & EXT4_MAP_MAPPED) == 0) {
fully_mapped = 0;
@@ -395,6 +390,15 @@ int ext4_mpage_readpages(struct inode *inode,
} else
last_block_in_bio = blocks[blocks_per_page - 1];
goto next_page;
+ set_error_page:
+ err = -EIO;
+ err:
+ if (rac) {
+ SetPageError(page);
+ zero_user_segment(page, 0, PAGE_SIZE);
+ }
+ unlock_page(page);
+ goto next_page;
confused:
if (bio) {
submit_bio(bio);
@@ -410,7 +414,7 @@ int ext4_mpage_readpages(struct inode *inode,
}
if (bio)
submit_bio(bio);
- return 0;
+ return err;
}
int __init ext4_init_post_read_processing(void)
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 13/18] fuse: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (11 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 12/18] ext4: Return error from ext4_readpage Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-20 14:13 ` Miklos Szeredi
2020-10-16 16:04 ` [PATCH v3 14/18] hostfs: " Matthew Wilcox (Oracle)
` (4 subsequent siblings)
17 siblings, 1 reply; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, Miklos Szeredi
The fuse readpage implementation was already synchronous, so use
AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/fuse/file.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 6611ef3269a8..7aa5626bc582 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -850,6 +850,8 @@ static int fuse_readpage(struct file *file, struct page *page)
err = fuse_do_readpage(file, page);
fuse_invalidate_atime(inode);
+ if (!err)
+ return AOP_UPDATED_PAGE;
out:
unlock_page(page);
return err;
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 14/18] hostfs: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (12 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 13/18] fuse: Tell the VFS that readpage was synchronous Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 15/18] jffs2: " Matthew Wilcox (Oracle)
` (3 subsequent siblings)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, Richard Weinberger
The hostfs readpage implementation was already synchronous, so use
AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Richard Weinberger <richard@nod.at>
---
fs/hostfs/hostfs_kern.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index c070c0d8e3e9..c49221c09c4b 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -455,6 +455,8 @@ static int hostfs_readpage(struct file *file, struct page *page)
out:
flush_dcache_page(page);
kunmap(page);
+ if (!ret)
+ return AOP_UPDATED_PAGE;
unlock_page(page);
return ret;
}
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 15/18] jffs2: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (13 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 14/18] hostfs: " Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 16/18] ubifs: " Matthew Wilcox (Oracle)
` (2 subsequent siblings)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, Richard Weinberger
The jffs2 readpage implementation was already synchronous, so use
AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Richard Weinberger <richard@nod.at>
---
fs/jffs2/file.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index f8fb89b10227..959a74027041 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
@@ -116,15 +116,17 @@ int jffs2_do_readpage_unlock(void *data, struct page *pg)
return ret;
}
-
static int jffs2_readpage (struct file *filp, struct page *pg)
{
struct jffs2_inode_info *f = JFFS2_INODE_INFO(pg->mapping->host);
int ret;
mutex_lock(&f->sem);
- ret = jffs2_do_readpage_unlock(pg->mapping->host, pg);
+ ret = jffs2_do_readpage_nolock(pg->mapping->host, pg);
mutex_unlock(&f->sem);
+ if (!ret)
+ return AOP_UPDATED_PAGE;
+ unlock_page(pg);
return ret;
}
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 16/18] ubifs: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (14 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 15/18] jffs2: " Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 17/18] udf: " Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 18/18] vboxsf: " Matthew Wilcox (Oracle)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, Richard Weinberger
The ubifs readpage implementation was already synchronous, so use
AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Richard Weinberger <richard@nod.at>
---
fs/ubifs/file.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index b77d1637bbbc..82633509c45e 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -772,7 +772,6 @@ static int ubifs_do_bulk_read(struct ubifs_info *c, struct bu_info *bu,
if (err)
goto out_warn;
- unlock_page(page1);
ret = 1;
isize = i_size_read(inode);
@@ -892,11 +891,16 @@ static int ubifs_bulk_read(struct page *page)
static int ubifs_readpage(struct file *file, struct page *page)
{
- if (ubifs_bulk_read(page))
- return 0;
- do_readpage(page);
- unlock_page(page);
- return 0;
+ int err;
+
+ err = ubifs_bulk_read(page);
+ if (err == 0)
+ err = do_readpage(page);
+ if (err < 0) {
+ unlock_page(page);
+ return err;
+ }
+ return AOP_UPDATED_PAGE;
}
static int do_writepage(struct page *page, int len)
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 17/18] udf: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (15 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 16/18] ubifs: " Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 18/18] vboxsf: " Matthew Wilcox (Oracle)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, Jan Kara
The udf inline data readpage implementation was already synchronous,
so use AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Jan Kara <jack@suse.cz>
---
fs/udf/file.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/udf/file.c b/fs/udf/file.c
index 628941a6b79a..52bbe92d7c43 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -61,9 +61,8 @@ static int udf_adinicb_readpage(struct file *file, struct page *page)
{
BUG_ON(!PageLocked(page));
__udf_adinicb_readpage(page);
- unlock_page(page);
- return 0;
+ return AOP_UPDATED_PAGE;
}
static int udf_adinicb_writepage(struct page *page,
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 18/18] vboxsf: Tell the VFS that readpage was synchronous
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
` (16 preceding siblings ...)
2020-10-16 16:04 ` [PATCH v3 17/18] udf: " Matthew Wilcox (Oracle)
@ 2020-10-16 16:04 ` Matthew Wilcox (Oracle)
17 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-10-16 16:04 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Matthew Wilcox (Oracle), linux-mm, Hans de Goede
The vboxsf inline data readpage implementation was already synchronous,
so use AOP_UPDATED_PAGE to avoid cycling the page lock.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
fs/vboxsf/file.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/vboxsf/file.c b/fs/vboxsf/file.c
index c4ab5996d97a..c2a144e5cb5a 100644
--- a/fs/vboxsf/file.c
+++ b/fs/vboxsf/file.c
@@ -228,6 +228,8 @@ static int vboxsf_readpage(struct file *file, struct page *page)
}
kunmap(page);
+ if (!err)
+ return AOP_UPDATED_PAGE;
unlock_page(page);
return err;
}
--
2.28.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH v3 11/18] ext4: Tell the VFS that readpage was synchronous
2020-10-16 16:04 ` [PATCH v3 11/18] ext4: " Matthew Wilcox (Oracle)
@ 2020-10-18 14:24 ` Theodore Y. Ts'o
0 siblings, 0 replies; 23+ messages in thread
From: Theodore Y. Ts'o @ 2020-10-18 14:24 UTC (permalink / raw)
To: Matthew Wilcox (Oracle)
Cc: linux-fsdevel, linux-mm, Andreas Dilger, linux-ext4
On Fri, Oct 16, 2020 at 05:04:36PM +0100, Matthew Wilcox (Oracle) wrote:
> The ext4 inline data readpage implementation was already synchronous,
> so use AOP_UPDATED_PAGE to avoid cycling the page lock.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 12/18] ext4: Return error from ext4_readpage
2020-10-16 16:04 ` [PATCH v3 12/18] ext4: Return error from ext4_readpage Matthew Wilcox (Oracle)
@ 2020-10-18 14:25 ` Theodore Y. Ts'o
2020-10-18 15:04 ` Matthew Wilcox
0 siblings, 1 reply; 23+ messages in thread
From: Theodore Y. Ts'o @ 2020-10-18 14:25 UTC (permalink / raw)
To: Matthew Wilcox (Oracle)
Cc: linux-fsdevel, linux-mm, Andreas Dilger, linux-ext4
On Fri, Oct 16, 2020 at 05:04:37PM +0100, Matthew Wilcox (Oracle) wrote:
> The error returned from ext4_map_blocks() was being discarded, leading
> to the generic -EIO being returned to userspace. Now ext4 can return
> more precise errors.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
This change is independent of the synchronous readpage changes,
correct? Or am I missing something?
Cheers,
- Ted
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 12/18] ext4: Return error from ext4_readpage
2020-10-18 14:25 ` Theodore Y. Ts'o
@ 2020-10-18 15:04 ` Matthew Wilcox
0 siblings, 0 replies; 23+ messages in thread
From: Matthew Wilcox @ 2020-10-18 15:04 UTC (permalink / raw)
To: Theodore Y. Ts'o; +Cc: linux-fsdevel, linux-mm, Andreas Dilger, linux-ext4
On Sun, Oct 18, 2020 at 10:25:57AM -0400, Theodore Y. Ts'o wrote:
> On Fri, Oct 16, 2020 at 05:04:37PM +0100, Matthew Wilcox (Oracle) wrote:
> > The error returned from ext4_map_blocks() was being discarded, leading
> > to the generic -EIO being returned to userspace. Now ext4 can return
> > more precise errors.
> >
> > Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
>
> This change is independent of the synchronous readpage changes,
> correct? Or am I missing something?
It's a step along the way. If you want to queue it up independently of
the other changes, I see no problem with that. The requirement to make
a synchronous ->readpage killable is making the conversion quite thorny
and I'm not sure I'm going to get it done this merge window.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 13/18] fuse: Tell the VFS that readpage was synchronous
2020-10-16 16:04 ` [PATCH v3 13/18] fuse: Tell the VFS that readpage was synchronous Matthew Wilcox (Oracle)
@ 2020-10-20 14:13 ` Miklos Szeredi
0 siblings, 0 replies; 23+ messages in thread
From: Miklos Szeredi @ 2020-10-20 14:13 UTC (permalink / raw)
To: Matthew Wilcox (Oracle); +Cc: linux-fsdevel, linux-mm
On Fri, Oct 16, 2020 at 6:04 PM Matthew Wilcox (Oracle)
<willy@infradead.org> wrote:
>
> The fuse readpage implementation was already synchronous, so use
> AOP_UPDATED_PAGE to avoid cycling the page lock.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Miklos Szeredi <mszeredi@redhat.com>
Thanks,
Miklos
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2020-10-20 14:14 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16 16:04 [PATCH v3 00/18] Allow readpage to return a locked page Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 01/18] cachefiles: Handle readpage error correctly Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 02/18] swap: Call aops->readahead if appropriate Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 03/18] fs: Add AOP_UPDATED_PAGE return value Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 04/18] mm/filemap: Inline wait_on_page_read into its one caller Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 05/18] 9p: Tell the VFS that readpage was synchronous Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 06/18] afs: " Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 07/18] ceph: " Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 08/18] cifs: " Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 09/18] cramfs: " Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 10/18] ecryptfs: " Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 11/18] ext4: " Matthew Wilcox (Oracle)
2020-10-18 14:24 ` Theodore Y. Ts'o
2020-10-16 16:04 ` [PATCH v3 12/18] ext4: Return error from ext4_readpage Matthew Wilcox (Oracle)
2020-10-18 14:25 ` Theodore Y. Ts'o
2020-10-18 15:04 ` Matthew Wilcox
2020-10-16 16:04 ` [PATCH v3 13/18] fuse: Tell the VFS that readpage was synchronous Matthew Wilcox (Oracle)
2020-10-20 14:13 ` Miklos Szeredi
2020-10-16 16:04 ` [PATCH v3 14/18] hostfs: " Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 15/18] jffs2: " Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 16/18] ubifs: " Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 17/18] udf: " Matthew Wilcox (Oracle)
2020-10-16 16:04 ` [PATCH v3 18/18] vboxsf: " Matthew Wilcox (Oracle)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).