X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fosc%2Fosc_cache.c;h=ebdb17b3ab4904e97c06cb9c443a98b7591f2bcc;hp=35da55c273d3a3b7471b72b5ceef12cf7f709649;hb=2b9bf34b87597bc5235c5dff01ae2ec0b2a02d91;hpb=08aa217ce49aba1ded52e0f7adb8a607035123fd diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 35da55c..ebdb17b 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -1393,8 +1393,6 @@ static void __osc_unreserve_grant(struct client_obd *cli, } else { cli->cl_avail_grant += unused; } - if (unused > 0) - osc_wake_cache_waiters(cli); } void osc_unreserve_grant(struct client_obd *cli, @@ -1402,6 +1400,8 @@ void osc_unreserve_grant(struct client_obd *cli, { client_obd_list_lock(&cli->cl_loi_list_lock); __osc_unreserve_grant(cli, reserved, unused); + if (unused > 0) + osc_wake_cache_waiters(cli); client_obd_list_unlock(&cli->cl_loi_list_lock); } @@ -2444,10 +2444,11 @@ int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, ext->oe_memalloc = 1; ext->oe_urgent = 1; - if (ext->oe_state == OES_CACHE && cfs_list_empty(&ext->oe_link)) { + if (ext->oe_state == OES_CACHE) { OSC_EXTENT_DUMP(D_CACHE, ext, "flush page %p make it urgent.\n", oap); - cfs_list_add_tail(&ext->oe_link, &obj->oo_urgent_exts); + if (cfs_list_empty(&ext->oe_link)) + cfs_list_add_tail(&ext->oe_link, &obj->oo_urgent_exts); unplug = true; } rc = 0; @@ -2624,6 +2625,8 @@ again: break; } + OSC_EXTENT_DUMP(D_CACHE, ext, "try to trunc:"LPU64".\n", size); + osc_extent_get(ext); if (ext->oe_state == OES_ACTIVE) { /* though we grab inode mutex for write path, but we @@ -2688,13 +2691,17 @@ again: osc_extent_put(env, ext); } if (waiting != NULL) { - if (result == 0) - result = osc_extent_wait(env, waiting, OES_INV); + int rc; + + /* ignore the result of osc_extent_wait the write initiator + * should take care of it. */ + rc = osc_extent_wait(env, waiting, OES_INV); + if (rc < 0) + OSC_EXTENT_DUMP(D_CACHE, ext, "wait error: %d.\n", rc); osc_extent_put(env, waiting); waiting = NULL; - if (result == 0) - goto again; + goto again; } RETURN(result); } @@ -2830,10 +2837,9 @@ int osc_cache_writeback_range(const struct lu_env *env, struct osc_object *obj, ext->oe_urgent = 1; list = &obj->oo_urgent_exts; } - if (list != NULL) { + if (list != NULL) cfs_list_move_tail(&ext->oe_link, list); - unplug = true; - } + unplug = true; } else { /* the only discarder is lock cancelling, so * [start, end] must contain this extent */