[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0f0a4357afaa3cc98f306de555e816146654245f.camel@kernel.org>
Date: Mon, 29 Jan 2024 07:41:56 -0500
From: Jeff Layton <jlayton@...nel.org>
To: David Howells <dhowells@...hat.com>, Christian Brauner
<christian@...uner.io>
Cc: Eric Van Hensbergen <ericvh@...nel.org>, Dominique Martinet
<asmadeus@...ewreck.org>, Matthew Wilcox <willy@...radead.org>,
netfs@...ts.linux.dev, linux-afs@...ts.infradead.org,
linux-cifs@...r.kernel.org, linux-nfs@...r.kernel.org,
ceph-devel@...r.kernel.org, v9fs@...ts.linux.dev,
linux-erofs@...ts.ozlabs.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org, Marc Dionne
<marc.dionne@...istor.com>
Subject: Re: [PATCH 1/2] netfs: Fix i_dio_count leak on DIO read past i_size
On Mon, 2024-01-29 at 09:49 +0000, David Howells wrote:
> From: Marc Dionne <marc.dionne@...istor.com>
>
> 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 <marc.dionne@...istor.com>
> Signed-off-by: David Howells <dhowells@...hat.com>
> cc: Jeff Layton <jlayton@...nel.org>
> cc: linux-afs@...ts.infradead.org
> cc: netfs@...ts.linux.dev
> cc: linux-fsdevel@...r.kernel.org
> ---
> fs/netfs/io.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/netfs/io.c b/fs/netfs/io.c
> index e8ff1e61ce79..4261ad6c55b6 100644
> --- a/fs/netfs/io.c
> +++ b/fs/netfs/io.c
> @@ -748,6 +748,8 @@ int netfs_begin_read(struct netfs_io_request *rreq, bool sync)
>
> if (!rreq->submitted) {
> netfs_put_request(rreq, false, netfs_rreq_trace_put_no_submit);
> + if (rreq->origin == NETFS_DIO_READ)
> + inode_dio_end(rreq->inode);
> ret = 0;
> goto out;
> }
>
>
Reviewed-by: Jeff Layton <jlayton@...nel.org>
Powered by blists - more mailing lists