X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fosc%2Fosc_cache.c;h=11a5e0e4ed416d47c7282e5a5eaac293933432b1;hp=8d9888f69df1040fbd5827a7a73bd761e69325ff;hb=0b2f943a317083a117d6f5f4a22e1d8233a7da77;hpb=49d895fca7758498366328f2f6428b0edca75f77 diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 8d9888f..11a5e0e 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -1079,7 +1079,9 @@ static int osc_extent_make_ready(const struct lu_env *env, last->oap_count = osc_refresh_count(env, last, OBD_BRW_WRITE); LASSERT(last->oap_count > 0); LASSERT(last->oap_page_off + last->oap_count <= PAGE_CACHE_SIZE); + spin_lock(&last->oap_lock); last->oap_async_flags |= ASYNC_COUNT_STABLE; + spin_unlock(&last->oap_lock); } /* for the rest of pages, we don't need to call osf_refresh_count() @@ -1087,7 +1089,9 @@ static int osc_extent_make_ready(const struct lu_env *env, cfs_list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) { if (!(oap->oap_async_flags & ASYNC_COUNT_STABLE)) { oap->oap_count = PAGE_CACHE_SIZE - oap->oap_page_off; + spin_lock(&oap->oap_lock); oap->oap_async_flags |= ASYNC_COUNT_STABLE; + spin_unlock(&oap->oap_lock); } } @@ -2273,6 +2277,8 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, oap->oap_cmd = cmd; oap->oap_page_off = ops->ops_from; oap->oap_count = ops->ops_to - ops->ops_from; + /* No need to hold a lock here, + * since this page is not in any list yet. */ oap->oap_async_flags = 0; oap->oap_brw_flags = brw_flags;