From: Bobi Jam Date: Mon, 14 Mar 2016 02:53:39 +0000 (+0800) Subject: LU-9229 osc: osc page lru list race X-Git-Tag: 2.9.59~53 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F86%2F26086%2F4;p=fs%2Flustre-release.git LU-9229 osc: osc page lru list race In osc_lru_use() the osc page's ops_lru access is not protected, which could race with osc_lru_del() and ensuing that client_obd::cl_lru_in_list counter decreased twice for a single page. Signed-off-by: Bobi Jam Change-Id: I41179112693f77113fdf43d3f859bf778d7bbc44 Reviewed-on: https://review.whamcloud.com/26086 Tested-by: Jenkins Reviewed-by: Jinshan Xiong Tested-by: Maloo Reviewed-by: Li Xi Reviewed-by: Oleg Drokin --- diff --git a/lustre/osc/osc_page.c b/lustre/osc/osc_page.c index c1650b8..50d8ecd 100644 --- a/lustre/osc/osc_page.c +++ b/lustre/osc/osc_page.c @@ -482,17 +482,19 @@ static void osc_lru_del(struct client_obd *cli, struct osc_page *opg) } /** - * Delete page from LRUlist for redirty. + * Delete page from LRU list for redirty. */ static void osc_lru_use(struct client_obd *cli, struct osc_page *opg) { /* If page is being transferred for the first time, * ops_lru should be empty */ - if (opg->ops_in_lru && !list_empty(&opg->ops_lru)) { + if (opg->ops_in_lru) { spin_lock(&cli->cl_lru_list_lock); - __osc_lru_del(cli, opg); + if (!list_empty(&opg->ops_lru)) { + __osc_lru_del(cli, opg); + atomic_long_inc(&cli->cl_lru_busy); + } spin_unlock(&cli->cl_lru_list_lock); - atomic_long_inc(&cli->cl_lru_busy); } }