From: Jinshan Xiong Date: Thu, 6 Sep 2012 20:09:08 +0000 (-0700) Subject: LU-1813 osc: osc_lock_unuse() race X-Git-Tag: 2.3.51~122 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;ds=sidebyside;h=bb0a1a53b5b6b29a2b8ec99a91c29e3a3d7ab6e4;p=fs%2Flustre-release.git LU-1813 osc: osc_lock_unuse() race The lock may have been released by upper layer so the cl_unuse_try() in osc_lock_upcall() will release the dlm lock instead of crashing. Signed-off-by: Jinshan Xiong Change-Id: Ie1c3f8d2ba8b227e42d08b1631651c5834cbac25 Reviewed-on: http://review.whamcloud.com/3895 Tested-by: Hudson Reviewed-by: Lai Siyao Tested-by: Maloo Reviewed-by: wangdi Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdclass/cl_page.c b/lustre/obdclass/cl_page.c index 1266c79..b2cecd8 100644 --- a/lustre/obdclass/cl_page.c +++ b/lustre/obdclass/cl_page.c @@ -1358,13 +1358,6 @@ void cl_page_completion(const struct lu_env *env, pg->cp_sync_io = NULL; cl_sync_io_note(anchor, ioret); } - - /* Don't assert the page writeback bit here because the lustre file - * may be as a backend of swap space. in this case, the page writeback - * is set by VM, and obvious we shouldn't clear it at all. Fortunately - * this type of pages are all TRANSIENT pages. */ - KLASSERT(ergo(pg->cp_type == CPT_CACHEABLE, - !PageWriteback(cl_page_vmpage(env, pg)))); EXIT; } EXPORT_SYMBOL(cl_page_completion); diff --git a/lustre/osc/osc_lock.c b/lustre/osc/osc_lock.c index a4b9be03..ffcfdf7 100644 --- a/lustre/osc/osc_lock.c +++ b/lustre/osc/osc_lock.c @@ -200,11 +200,13 @@ static int osc_lock_unuse(const struct lu_env *env, LASSERT(!ols->ols_hold); LASSERT(ols->ols_agl); return 0; + case OLS_UPCALL_RECEIVED: + osc_lock_unhold(ols); case OLS_ENQUEUED: - case OLS_UPCALL_RECEIVED: - LASSERT(!ols->ols_hold); - ols->ols_state = OLS_NEW; - return 0; + LASSERT(!ols->ols_hold); + osc_lock_detach(env, ols); + ols->ols_state = OLS_NEW; + return 0; case OLS_GRANTED: LASSERT(!ols->ols_glimpse); LASSERT(ols->ols_hold);