]> Git Repo - J-linux.git/commitdiff
NFSD: Mark filecache "down" if init fails
authorChuck Lever <[email protected]>
Sat, 21 Sep 2024 18:25:37 +0000 (14:25 -0400)
committerChuck Lever <[email protected]>
Mon, 23 Sep 2024 14:37:20 +0000 (10:37 -0400)
NeilBrown says:
> The handling of NFSD_FILE_CACHE_UP is strange.  nfsd_file_cache_init()
> sets it, but doesn't clear it on failure.  So if nfsd_file_cache_init()
> fails for some reason, nfsd_file_cache_shutdown() would still try to
> clean up if it was called.

Reported-by: NeilBrown <[email protected]>
Fixes: c7b824c3d06c ("NFSD: Replace the "init once" mechanism")
Signed-off-by: Chuck Lever <[email protected]>
fs/nfsd/filecache.c

index 24e8f1fbcebbb7385dd3ec34ac2605d31bc4d564..2603183305b42cc6a8efa63fc72fc46d6683307b 100644 (file)
@@ -723,7 +723,7 @@ nfsd_file_cache_init(void)
 
        ret = rhltable_init(&nfsd_file_rhltable, &nfsd_file_rhash_params);
        if (ret)
-               return ret;
+               goto out;
 
        ret = -ENOMEM;
        nfsd_file_slab = KMEM_CACHE(nfsd_file, 0);
@@ -775,6 +775,8 @@ nfsd_file_cache_init(void)
 
        INIT_DELAYED_WORK(&nfsd_filecache_laundrette, nfsd_file_gc_worker);
 out:
+       if (ret)
+               clear_bit(NFSD_FILE_CACHE_UP, &nfsd_file_flags);
        return ret;
 out_notifier:
        lease_unregister_notifier(&nfsd_file_lease_notifier);
This page took 0.051221 seconds and 4 git commands to generate.