Skip to content

Commit

Permalink
staging: lustre: fix to use list_for_each_entry_safe() when delete items
Browse files Browse the repository at this point in the history
Since we will remove items off the list using list_del_init() we need
to use a safe version of the list_for_each_entry() macro aptly named
list_for_each_entry_safe().

Signed-off-by: Wei Yongjun <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Wei Yongjun authored and gregkh committed May 17, 2013
1 parent 49c144c commit f13ab92
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/lustre/lustre/osc/osc_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -2620,7 +2620,7 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj,
{
struct client_obd *cli = osc_cli(obj);
struct osc_extent *ext;
struct osc_async_page *oap;
struct osc_async_page *oap, *tmp;
int page_count = 0;
int mppr = cli->cl_max_pages_per_rpc;
pgoff_t start = CL_PAGE_EOF;
Expand All @@ -2639,7 +2639,7 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj,

ext = osc_extent_alloc(obj);
if (ext == NULL) {
list_for_each_entry(oap, list, oap_pending_item) {
list_for_each_entry_safe(oap, tmp, list, oap_pending_item) {
list_del_init(&oap->oap_pending_item);
osc_ap_completion(env, cli, oap, 0, -ENOMEM);
}
Expand Down

0 comments on commit f13ab92

Please sign in to comment.