Skip to content

Commit

Permalink
NFSD: Mark filecache "down" if init fails
Browse files Browse the repository at this point in the history
[ 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 <[email protected]>
Fixes: c7b824c ("NFSD: Replace the "init once" mechanism")
Signed-off-by: Chuck Lever <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
chucklever authored and gregkh committed Oct 17, 2024
1 parent e0e14dd commit ca5b423
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/nfsd/filecache.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,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_filecache_wq = alloc_workqueue("nfsd_filecache", 0, 0);
Expand Down Expand Up @@ -769,6 +769,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);
Expand Down

0 comments on commit ca5b423

Please sign in to comment.