SUNRPC: Drop all entries from cache_detail when cache_purge()
authorKinglong Mee <kinglongmee@gmail.com>
Wed, 8 Feb 2017 01:54:33 +0000 (09:54 +0800)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 8 Feb 2017 21:49:32 +0000 (16:49 -0500)
commit471a930ad7d1b868456e835a67169a661ec73f65
tree0b4cc18a4de82c303aceaa5ab72511acf21ebace
parent81fa3275f95ac357188fe3ca81b8e7c75360c88d
SUNRPC: Drop all entries from cache_detail when cache_purge()

User always free the cache_detail after sunrpc_destroy_cache_detail(),
so, it must cleanup up entries that left in the cache_detail,
otherwise, NULL reference may be caused when using the left entries.

Also, NeriBrown suggests "write a stand-alone cache_purge()."

v3, move the cache_fresh_unlocked() out of write lock,
v2, a stand-alone cache_purge(), not only for sunrpc_destroy_cache_detail

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
net/sunrpc/cache.c