Skip to content

Commit 2147caa

Browse files
Marc Dionnebrauner
authored andcommitted
netfs: Fix i_dio_count leak on DIO read past i_size
If netfs_begin_read gets a NETFS_DIO_READ request that begins past i_size, it won't perform any i/o and just return 0. This will leak an increment to i_dio_count that is done at the top of the function. This can cause subsequent buffered read requests to block indefinitely, waiting for a non existing dio operation to complete. Add a inode_dio_end() for the NETFS_DIO_READ case, before returning. Signed-off-by: Marc Dionne <[email protected]> Signed-off-by: David Howells <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jeff Layton <[email protected]> cc: Jeff Layton <[email protected]> cc: <[email protected]> cc: <[email protected]> cc: <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 41bccc9 commit 2147caa

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/netfs/io.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ int netfs_begin_read(struct netfs_io_request *rreq, bool sync)
748748

749749
if (!rreq->submitted) {
750750
netfs_put_request(rreq, false, netfs_rreq_trace_put_no_submit);
751+
if (rreq->origin == NETFS_DIO_READ)
752+
inode_dio_end(rreq->inode);
751753
ret = 0;
752754
goto out;
753755
}

0 commit comments

Comments
 (0)