Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit 4ab0723

Browse files
chucklevergregkh
authored andcommitted
NFSD: Mark filecache "down" if init fails
[ Upstream commit dc0d0f8 ] 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 <neilb@suse.de> Fixes: c7b824c ("NFSD: Replace the "init once" mechanism") Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 1fab023 commit 4ab0723

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/nfsd/filecache.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ nfsd_file_cache_init(void)
718718

719719
ret = rhltable_init(&nfsd_file_rhltable, &nfsd_file_rhash_params);
720720
if (ret)
721-
return ret;
721+
goto out;
722722

723723
ret = -ENOMEM;
724724
nfsd_filecache_wq = alloc_workqueue("nfsd_filecache", 0, 0);
@@ -770,6 +770,8 @@ nfsd_file_cache_init(void)
770770

771771
INIT_DELAYED_WORK(&nfsd_filecache_laundrette, nfsd_file_gc_worker);
772772
out:
773+
if (ret)
774+
clear_bit(NFSD_FILE_CACHE_UP, &nfsd_file_flags);
773775
return ret;
774776
out_notifier:
775777
lease_unregister_notifier(&nfsd_file_lease_notifier);

0 commit comments

Comments
 (0)