Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfsd: cleanup nfsd_file_lru_dispose()

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

Trond Myklebust and committed by
J. Bruce Fields
36ebbdb9 28c7d86b

+6 -7
+6 -7
fs/nfsd/filecache.c
··· 256 256 nfsd_reset_boot_verifier(net_generic(nf->nf_net, nfsd_net_id)); 257 257 --nfsd_file_hashtbl[nf->nf_hashval].nfb_count; 258 258 hlist_del_rcu(&nf->nf_node); 259 - if (!list_empty(&nf->nf_lru)) 260 - list_lru_del(&nfsd_file_lru, &nf->nf_lru); 261 259 atomic_long_dec(&nfsd_filecache_count); 262 260 } 263 261 ··· 264 266 { 265 267 if (test_and_clear_bit(NFSD_FILE_HASHED, &nf->nf_flags)) { 266 268 nfsd_file_do_unhash(nf); 269 + if (!list_empty(&nf->nf_lru)) 270 + list_lru_del(&nfsd_file_lru, &nf->nf_lru); 267 271 return true; 268 272 } 269 273 return false; ··· 402 402 static void 403 403 nfsd_file_lru_dispose(struct list_head *head) 404 404 { 405 - while(!list_empty(head)) { 406 - struct nfsd_file *nf = list_first_entry(head, 407 - struct nfsd_file, nf_lru); 408 - list_del_init(&nf->nf_lru); 405 + struct nfsd_file *nf; 406 + 407 + list_for_each_entry(nf, head, nf_lru) { 409 408 spin_lock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); 410 409 nfsd_file_do_unhash(nf); 411 410 spin_unlock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); 412 - nfsd_file_put_noref(nf); 413 411 } 412 + nfsd_file_dispose_list(head); 414 413 } 415 414 416 415 static unsigned long