[PATCH 05/13] cifs: Tell the VFS that readpage was synchronous

From: Matthew Wilcox (Oracle)
Date: Thu Sep 17 2020 - 11:16:19 EST


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@xxxxxxxxxxxxx>
---
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