Skip to content

Commit df95a9d

Browse files
author
J. Bruce Fields
committed
knfsd: cache unregistration needn't return error
There's really nothing much the caller can do if cache unregistration fails. And indeed, all any caller does in this case is print an error and continue. So just return void and move the printk's inside cache_unregister. Acked-by: NeilBrown <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent d5c3428 commit df95a9d

File tree

6 files changed

+14
-20
lines changed

6 files changed

+14
-20
lines changed

fs/nfsd/export.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,10 +1670,8 @@ nfsd_export_shutdown(void)
16701670

16711671
exp_writelock();
16721672

1673-
if (cache_unregister(&svc_expkey_cache))
1674-
printk(KERN_ERR "nfsd: failed to unregister expkey cache\n");
1675-
if (cache_unregister(&svc_export_cache))
1676-
printk(KERN_ERR "nfsd: failed to unregister export cache\n");
1673+
cache_unregister(&svc_expkey_cache);
1674+
cache_unregister(&svc_export_cache);
16771675
svcauth_unix_purge();
16781676

16791677
exp_writeunlock();

fs/nfsd/nfs4idmap.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,8 @@ nfsd_idmap_init(void)
474474
void
475475
nfsd_idmap_shutdown(void)
476476
{
477-
if (cache_unregister(&idtoname_cache))
478-
printk(KERN_ERR "nfsd: failed to unregister idtoname cache\n");
479-
if (cache_unregister(&nametoid_cache))
480-
printk(KERN_ERR "nfsd: failed to unregister nametoid cache\n");
477+
cache_unregister(&idtoname_cache);
478+
cache_unregister(&nametoid_cache);
481479
}
482480

483481
/*

include/linux/sunrpc/cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ extern void cache_flush(void);
170170
extern void cache_purge(struct cache_detail *detail);
171171
#define NEVER (0x7FFFFFFF)
172172
extern void cache_register(struct cache_detail *cd);
173-
extern int cache_unregister(struct cache_detail *cd);
173+
extern void cache_unregister(struct cache_detail *cd);
174174

175175
extern void qword_add(char **bpp, int *lp, char *str);
176176
extern void qword_addhex(char **bpp, int *lp, char *buf, int blen);

net/sunrpc/auth_gss/svcauth_gss.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,9 +1396,7 @@ gss_svc_init(void)
13961396
void
13971397
gss_svc_shutdown(void)
13981398
{
1399-
if (cache_unregister(&rsc_cache))
1400-
printk(KERN_ERR "auth_rpcgss: failed to unregister rsc cache\n");
1401-
if (cache_unregister(&rsi_cache))
1402-
printk(KERN_ERR "auth_rpcgss: failed to unregister rsi cache\n");
1399+
cache_unregister(&rsc_cache);
1400+
cache_unregister(&rsi_cache);
14031401
svc_auth_unregister(RPC_AUTH_GSS);
14041402
}

net/sunrpc/cache.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,15 +343,15 @@ void cache_register(struct cache_detail *cd)
343343
schedule_delayed_work(&cache_cleaner, 0);
344344
}
345345

346-
int cache_unregister(struct cache_detail *cd)
346+
void cache_unregister(struct cache_detail *cd)
347347
{
348348
cache_purge(cd);
349349
spin_lock(&cache_list_lock);
350350
write_lock(&cd->hash_lock);
351351
if (cd->entries || atomic_read(&cd->inuse)) {
352352
write_unlock(&cd->hash_lock);
353353
spin_unlock(&cache_list_lock);
354-
return -EBUSY;
354+
goto out;
355355
}
356356
if (current_detail == cd)
357357
current_detail = NULL;
@@ -373,7 +373,9 @@ int cache_unregister(struct cache_detail *cd)
373373
/* module must be being unloaded so its safe to kill the worker */
374374
cancel_delayed_work_sync(&cache_cleaner);
375375
}
376-
return 0;
376+
return;
377+
out:
378+
printk(KERN_ERR "nfsd: failed to unregister %s cache\n", cd->name);
377379
}
378380

379381
/* clean cache tries to find something to clean

net/sunrpc/sunrpc_syms.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,8 @@ cleanup_sunrpc(void)
9898
cleanup_socket_xprt();
9999
unregister_rpc_pipefs();
100100
rpc_destroy_mempool();
101-
if (cache_unregister(&ip_map_cache))
102-
printk(KERN_ERR "sunrpc: failed to unregister ip_map cache\n");
103-
if (cache_unregister(&unix_gid_cache))
104-
printk(KERN_ERR "sunrpc: failed to unregister unix_gid cache\n");
101+
cache_unregister(&ip_map_cache);
102+
cache_unregister(&unix_gid_cache);
105103
#ifdef RPC_DEBUG
106104
rpc_unregister_sysctl();
107105
#endif

0 commit comments

Comments
 (0)