Skip to contentSkip to conversation

fs: Do not check for valid page->mapping in page_cache_pipe_buf_confirm

PATCH In review Abhi Das 1 participant 2 messages May 26, 2016 – Jun 28, 2016 VFS

lore
Share & tools
lore

Abhi Das

author
#0 lore raw

PATCH 1/1 fs: Do not check for valid page->mapping in page_cache_pipe_buf_confirm

If the page is truncated after being spliced into the pipe, it's probably not invalid.

For filesystems that invalidate pages, we used to return -ENODATA even though the data is there, it's just possibly different from what was spliced into the pipe. We shouldn't have to throw away the buffer or return error in this case.

CC Miklos Szeredi <[email protected]>
CC Jens Axboe <[email protected]>
CC Al Viro <[email protected]>
---
 fs/splice.c | 9 ---------
 1 file changed, 9 deletions(-)
fs/splice.c +0 -9
index dd9bf7e..b9899b99 100644
@@ -106,15 +106,6 @@ static int page_cache_pipe_buf_confirm(struct pipe_inode_info *pipe,
 		lock_page(page);
 
 		/*
-		 * Page got truncated/unhashed. This will cause a 0-byte
-		 * splice, if this is the first page.
-		 */
-		if (!page->mapping) {
-			err = -ENODATA;
-			goto error;
-		}
-
-		/*
 		 * Uh oh, read-error from disk.
 		 */
 		if (!PageUptodate(page)) {
Signature · 1 line
2.4.3
#1 lore raw

----- Original Message -----

Quoted 43 lines

From: "Abhi Das" <[email protected]>
To: cluster-devel at redhat.com, linux-kernel at vger.kernel.org, linux-fsdevel at vger.kernel.org
Cc: "Abhi Das" <[email protected]>, "Miklos Szeredi" <[email protected]>, "Jens Axboe" <[email protected]>, "Al Viro" <[email protected]>
Sent: Wednesday, May 25, 2016 10:24:45 PM
Subject: [PATCH] fs: Do not check for valid page->mapping in page_cache_pipe_buf_confirm

If the page is truncated after being spliced into the pipe, it's probably not invalid.

For filesystems that invalidate pages, we used to return -ENODATA even though the data is there, it's just possibly different from what was spliced into the pipe. We shouldn't have to throw away the buffer or return error in this case.

CC Miklos Szeredi <[email protected]>
CC Jens Axboe <[email protected]>
CC Al Viro <[email protected]>
---
 fs/splice.c | 9 ---------
 1 file changed, 9 deletions(-)
fs/splice.c +0 -9
index dd9bf7e..b9899b99 100644
@@ -106,15 +106,6 @@ static int page_cache_pipe_buf_confirm(struct
 pipe_inode_info *pipe,
 		lock_page(page);
 
 		/*
-		 * Page got truncated/unhashed. This will cause a 0-byte
-		 * splice, if this is the first page.
-		 */
-		if (!page->mapping) {
-			err = -ENODATA;
-			goto error;
-		}
-
-		/*
 		 * Uh oh, read-error from disk.
 		 */
Quoted 5 lines

if (!PageUptodate(page)) {
--
2.4.3

Hi Jens/Al,

Any comments on this patch? FWIW, I've done some testing on GFS2 w/ this patch and it seems to be holding up ok. The test is designed to verify writes using splice reads and even if the pages were truncated, the data read in from the spliced pipe looks consistent with what was expected.

Cheers!
--Abhi