Skip to content

Commit

Permalink
sunrpc/cache: use list_del_init for the list_head entries in cache_de…
Browse files Browse the repository at this point in the history
…ferred_req

Using list_del_init is generally safer than list_del, and it will
allow us, in a subsequent patch, to see if an entry has already been
processed or not.

Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]>
  • Loading branch information
neilbrown authored and J. Bruce Fields committed Sep 18, 2009
1 parent c082657 commit 67e7328
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/sunrpc/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,8 @@ static int cache_defer_req(struct cache_req *req, struct cache_head *item)
if (++cache_defer_cnt > DFR_MAX) {
dreq = list_entry(cache_defer_list.prev,
struct cache_deferred_req, recent);
list_del(&dreq->recent);
list_del(&dreq->hash);
list_del_init(&dreq->recent);
list_del_init(&dreq->hash);
cache_defer_cnt--;
}
spin_unlock(&cache_defer_lock);
Expand Down Expand Up @@ -564,7 +564,7 @@ static void cache_revisit_request(struct cache_head *item)
dreq = list_entry(lp, struct cache_deferred_req, hash);
lp = lp->next;
if (dreq->item == item) {
list_del(&dreq->hash);
list_del_init(&dreq->hash);
list_move(&dreq->recent, &pending);
cache_defer_cnt--;
}
Expand All @@ -590,7 +590,7 @@ void cache_clean_deferred(void *owner)

list_for_each_entry_safe(dreq, tmp, &cache_defer_list, recent) {
if (dreq->owner == owner) {
list_del(&dreq->hash);
list_del_init(&dreq->hash);
list_move(&dreq->recent, &pending);
cache_defer_cnt--;
}
Expand Down

0 comments on commit 67e7328

Please sign in to comment.