From patchwork Mon Sep 30 18:56:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11167317 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A942A1599 for ; Mon, 30 Sep 2019 19:07:46 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 91EE0224EF for ; Mon, 30 Sep 2019 19:07:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91EE0224EF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 00DC65E4F4F; Mon, 30 Sep 2019 12:01:28 -0700 (PDT) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp4.ccs.ornl.gov (smtp4.ccs.ornl.gov [160.91.203.40]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 7C1E15C38DF for ; Mon, 30 Sep 2019 11:57:40 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id C91671005F9B; Mon, 30 Sep 2019 14:56:57 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id C684CB5; Mon, 30 Sep 2019 14:56:57 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Mon, 30 Sep 2019 14:56:29 -0400 Message-Id: <1569869810-23848-131-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> References: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 130/151] lustre: osc: add a bit to indicate osc_page in cache tree X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bobi Jam , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Bobi Jam Add osc_page::ops_intree to indicate whether the osc_page is in the osc_object's cache tree, so that when page cannot insert in the cache as race happens, the cleanup code won't try to remove it from the cache. WC-bug-id: https://jira.whamcloud.com/browse/LU-10244 Lustre-commit: ed91ee6bd642 ("LU-10244 osc: add a bit to indicate osc_page in cache tree") Signed-off-by: Bobi Jam Reviewed-on: https://review.whamcloud.com/30096 Reviewed-by: Jinshan Xiong Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/include/lustre_osc.h | 6 +++++- fs/lustre/osc/osc_page.c | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/fs/lustre/include/lustre_osc.h b/fs/lustre/include/lustre_osc.h index 38ae83a8..5ba4f97 100644 --- a/fs/lustre/include/lustre_osc.h +++ b/fs/lustre/include/lustre_osc.h @@ -524,7 +524,11 @@ struct osc_page { /* * Set if the page must be transferred with OBD_BRW_SRVLOCK. */ - ops_srvlock:1; + ops_srvlock:1, + /** + * If the page is in osc_object::oo_tree. + */ + ops_intree:1; /* * lru page list. See osc_lru_{del|use}() in osc_page.c for usage. */ diff --git a/fs/lustre/osc/osc_page.c b/fs/lustre/osc/osc_page.c index 731fd27..9236e02 100644 --- a/fs/lustre/osc/osc_page.c +++ b/fs/lustre/osc/osc_page.c @@ -192,12 +192,17 @@ static void osc_page_delete(const struct lu_env *env, osc_lru_del(osc_cli(obj), opg); if (slice->cpl_page->cp_type == CPT_CACHEABLE) { - void *value; + void *value = NULL; spin_lock(&obj->oo_tree_lock); - value = radix_tree_delete(&obj->oo_tree, osc_index(opg)); - if (value) - --obj->oo_npages; + if (opg->ops_intree) { + value = radix_tree_delete(&obj->oo_tree, + osc_index(opg)); + if (value) { + --obj->oo_npages; + opg->ops_intree = 0; + } + } spin_unlock(&obj->oo_tree_lock); LASSERT(ergo(value, value == opg)); @@ -275,8 +280,10 @@ int osc_page_init(const struct lu_env *env, struct cl_object *obj, spin_lock(&osc->oo_tree_lock); result = radix_tree_insert(&osc->oo_tree, index, opg); - if (result == 0) + if (result == 0) { ++osc->oo_npages; + opg->ops_intree = 1; + } spin_unlock(&osc->oo_tree_lock); radix_tree_preload_end();