]> Git Repo - linux.git/commitdiff
fscache: Fix error handling in fscache_begin_operation()
authorDavid Howells <[email protected]>
Fri, 15 Mar 2024 14:48:26 +0000 (14:48 +0000)
committerChristian Brauner <[email protected]>
Mon, 18 Mar 2024 09:33:48 +0000 (10:33 +0100)
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Jeff Layton <[email protected]>
Reported-by: Marc Dionne <[email protected]>
cc: Jeff Layton <[email protected]>
cc: [email protected]
cc: [email protected]
Signed-off-by: Christian Brauner <[email protected]>
fs/netfs/fscache_io.c

index ad572f7ee897b9d26d2439a6a1178332d2a2e547..43a651ed826413d8ea60dcb240950e2a074aca28 100644 (file)
@@ -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);
This page took 0.054844 seconds and 4 git commands to generate.