[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <026cb22e882ff96040207fbc31d61aaa972ad531.camel@kernel.org>
Date: Fri, 15 Mar 2024 14:34:27 -0400
From: Jeff Layton <jlayton@...nel.org>
To: David Howells <dhowells@...hat.com>
Cc: Marc Dionne <marc.dionne@...istor.com>, Christian Brauner
<brauner@...nel.org>, netfs@...ts.linux.dev, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fscache: Fix error handling in fscache_begin_operation()
On Fri, 2024-03-15 at 14:48 +0000, David Howells wrote:
>
> Fix fscache_begin_operation() to clear cres->cache_priv on error, otherwise
> fscache_resources_valid() will report it as being valid.
>
> Signed-off-by: David Howells <dhowells@...hat.com>
> Reported-by: Marc Dionne <marc.dionne@...istor.com>
> cc: Jeff Layton <jlayton@...nel.org>
> cc: netfs@...ts.linux.dev
> cc: linux-fsdevel@...r.kernel.org
> ---
> fs/netfs/fscache_io.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/netfs/fscache_io.c b/fs/netfs/fscache_io.c
> index ad57e4412c6d..cfd58ad95e7c 100644
> --- a/fs/netfs/fscache_io.c
> +++ b/fs/netfs/fscache_io.c
> @@ -83,8 +83,10 @@ static int fscache_begin_operation(struct netfs_cache_resources *cres,
> cres->debug_id = cookie->debug_id;
> cres->inval_counter = cookie->inval_counter;
>
> - if (!fscache_begin_cookie_access(cookie, why))
> + if (!fscache_begin_cookie_access(cookie, why)) {
> + cres->cache_priv = NULL;
> return -ENOBUFS;
> + }
>
> again:
> spin_lock(&cookie->lock);
>
>
Reviewed-by: Jeff Layton <jlayton@...nel.org>
Powered by blists - more mailing lists