Skip to content

Commit 449ac55

Browse files
dhowellsbrauner
authored andcommitted
fscache: Fix error handling in fscache_begin_operation()
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> Link: https://lore.kernel.org/r/3933237.1710514106@warthog.procyon.org.uk Reviewed-by: Jeff Layton <jlayton@kernel.org> 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 Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 59a55a6 commit 449ac55

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/netfs/fscache_io.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ static int fscache_begin_operation(struct netfs_cache_resources *cres,
8383
cres->debug_id = cookie->debug_id;
8484
cres->inval_counter = cookie->inval_counter;
8585

86-
if (!fscache_begin_cookie_access(cookie, why))
86+
if (!fscache_begin_cookie_access(cookie, why)) {
87+
cres->cache_priv = NULL;
8788
return -ENOBUFS;
89+
}
8890

8991
again:
9092
spin_lock(&cookie->lock);

0 commit comments

Comments
 (0)