From c419939a60daa4e41279ccb6e486ae785895cda0 Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Sun, 16 Dec 2012 09:42:13 -0800 Subject: [PATCH] LU-2501 osc: hold cli list lock for osc_exit_cache Somehow it's not held before which hit the assert. Signed-off-by: Jinshan Xiong Change-Id: I48e50c3e8df197ed5d17ceecf41e995cc7d87f69 Reviewed-on: http://review.whamcloud.com/4834 Reviewed-by: Oleg Drokin Tested-by: Oleg Drokin --- lustre/osc/osc_cache.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index df7fb1e..d4765f2 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -1440,12 +1440,15 @@ static void osc_free_grant(struct client_obd *cli, unsigned int nr_pages, cli->cl_avail_grant, cli->cl_dirty); } -/* The companion to osc_enter_cache(), called when @oap is no longer part of - * the dirty accounting. Writeback completes or truncate happens before - * writing starts. Must be called with the loi lock held. */ +/** + * The companion to osc_enter_cache(), called when @oap is no longer part of + * the dirty accounting due to error. + */ static void osc_exit_cache(struct client_obd *cli, struct osc_async_page *oap) { + client_obd_list_lock(&cli->cl_loi_list_lock); osc_release_write_grant(cli, &oap->oap_brw_page); + client_obd_list_unlock(&cli->cl_loi_list_lock); } /** @@ -1480,8 +1483,13 @@ static int osc_enter_cache_try(struct client_obd *cli, return rc; } -/* Caller must hold loi_list_lock - we drop/regain it if we need to wait for - * grant or cache space. */ +/** + * The main entry to reserve dirty page accounting. Usually the grant reserved + * in this function will be freed in bulk in osc_free_grant() unless it fails + * to add osc cache, in that case, it will be freed in osc_exit_cache(). + * + * The process will be put into sleep if it's already run out of grant. + */ static int osc_enter_cache(const struct lu_env *env, struct client_obd *cli, struct osc_async_page *oap, int bytes) { -- 1.8.3.1