public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fscache: Fix error handling in fscache_begin_operation()
@ 2024-03-15 14:48 David Howells
  2024-03-15 18:34 ` Jeff Layton
  2024-03-18  8:48 ` Christian Brauner
  0 siblings, 2 replies; 3+ messages in thread
From: David Howells @ 2024-03-15 14:48 UTC (permalink / raw)
  To: Jeff Layton
  Cc: dhowells, Marc Dionne, Christian Brauner, netfs, linux-fsdevel,
	linux-kernel

    
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@redhat.com>
Reported-by: Marc Dionne <marc.dionne@auristor.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.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);


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] fscache: Fix error handling in fscache_begin_operation()
  2024-03-15 14:48 [PATCH] fscache: Fix error handling in fscache_begin_operation() David Howells
@ 2024-03-15 18:34 ` Jeff Layton
  2024-03-18  8:48 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2024-03-15 18:34 UTC (permalink / raw)
  To: David Howells
  Cc: Marc Dionne, Christian Brauner, netfs, linux-fsdevel,
	linux-kernel

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@redhat.com>
> Reported-by: Marc Dionne <marc.dionne@auristor.com>
> cc: Jeff Layton <jlayton@kernel.org>
> cc: netfs@lists.linux.dev
> cc: linux-fsdevel@vger.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@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fscache: Fix error handling in fscache_begin_operation()
  2024-03-15 14:48 [PATCH] fscache: Fix error handling in fscache_begin_operation() David Howells
  2024-03-15 18:34 ` Jeff Layton
@ 2024-03-18  8:48 ` Christian Brauner
  1 sibling, 0 replies; 3+ messages in thread
From: Christian Brauner @ 2024-03-18  8:48 UTC (permalink / raw)
  To: Jeff Layton, David Howells
  Cc: Christian Brauner, Marc Dionne, netfs, linux-fsdevel,
	linux-kernel

On Fri, 15 Mar 2024 14:48:26 +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.
> 
> 

Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] fscache: Fix error handling in fscache_begin_operation()
      https://git.kernel.org/vfs/vfs/c/d86f1160d819

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-18  8:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-15 14:48 [PATCH] fscache: Fix error handling in fscache_begin_operation() David Howells
2024-03-15 18:34 ` Jeff Layton
2024-03-18  8:48 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox