Skip to content

Commit dc0d0f8

Browse files
committed
NFSD: Mark filecache "down" if init fails
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: c7b824c ("NFSD: Replace the "init once" mechanism") Signed-off-by: Chuck Lever <[email protected]>
1 parent 509abfc commit dc0d0f8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/nfsd/filecache.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ nfsd_file_cache_init(void)
723723

724724
ret = rhltable_init(&nfsd_file_rhltable, &nfsd_file_rhash_params);
725725
if (ret)
726-
return ret;
726+
goto out;
727727

728728
ret = -ENOMEM;
729729
nfsd_file_slab = KMEM_CACHE(nfsd_file, 0);
@@ -775,6 +775,8 @@ nfsd_file_cache_init(void)
775775

776776
INIT_DELAYED_WORK(&nfsd_filecache_laundrette, nfsd_file_gc_worker);
777777
out:
778+
if (ret)
779+
clear_bit(NFSD_FILE_CACHE_UP, &nfsd_file_flags);
778780
return ret;
779781
out_notifier:
780782
lease_unregister_notifier(&nfsd_file_lease_notifier);

0 commit comments

Comments
 (0)