Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1459360ybm; Thu, 23 May 2019 01:08:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyHbcnMeZIRB0hraNljekQ1xw8boDHOviTiMj0Sxf2spKU13OflhmsBpR/udwLwrJS5UUm X-Received: by 2002:a17:902:e18d:: with SMTP id cd13mr28712890plb.301.1558598932372; Thu, 23 May 2019 01:08:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558598932; cv=none; d=google.com; s=arc-20160816; b=QiJEC2wMK05HXgOqJbJ99/Bax/U9AuOmJxVsfdag5xQRgAIvD1ddomdZQb2UY3KxrE d6ckTOU3tp+vNPtZeaAV5a+yhOziV6hVV2r4Y/7Z1uDm5mMJSz0tGzVcgLUtceRbBKbA fpe77IbcucgIis2gz58mKLUKV8LbUFjj+nzDvIOXNsvd2DrUn1sdJQ39It14P+sqOs6D Js7uwY9bWvp55D/eIRAeiQ62DzEMm7rBkWJa4OE25JYeaEKWV6YvixAtJ55Y58rZC5l0 NaYoCCsBO5sTuu6TJ6A+s2YTQA2G0bL8ioh1MoA7aVjna6AdU8jHO+AgqPdeZFx0RtC1 YqiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=oVXPeh6lxlkhyK6DX2SSa+kzCexILtVvceYmXX0cQ9k=; b=S2rvzkTMS75jhel8K9EcmkT5eE7w4MUQBYAjgjBmyU+ATbkSCVKMxPH5YBMAQIOE3j Etk/XGW3sXi3l5Pgk9LIeBO8NK98D0ngjrtO2LJ2O91DGjQe3B+v1UOAk2jOn3AzTNCR zW+VQ2+5Uu+Wzp1qMVRyIWQBw+6PWtMwV5tc6kNdOezFx4K1LUMMBqeZaeDEm6Nr/IO+ sXp8H2sYtJ4Bgr2MSeFXBs/wLce22C93uwRN7svco5LAulFzK8cCrgNfnDdLbIJ/+Ey4 uagAE60SeWLKqso1ry/8dWnqywc6W39w4+hVbOyvHDNA6lnrPRq2Ze+YnnVxqF22w0jz ZDiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j15si28740175pll.40.2019.05.23.01.08.34; Thu, 23 May 2019 01:08:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730108AbfEWIHG (ORCPT + 99 others); Thu, 23 May 2019 04:07:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49456 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730051AbfEWIHF (ORCPT ); Thu, 23 May 2019 04:07:05 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF98E99DDE for ; Thu, 23 May 2019 08:07:04 +0000 (UTC) Received: from zhyan-laptop.redhat.com (ovpn-12-163.pek2.redhat.com [10.72.12.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id 432315D9C6; Thu, 23 May 2019 08:07:01 +0000 (UTC) From: "Yan, Zheng" To: linux-kernel@vger.kernel.org Cc: idryomov@redhat.com, jlayton@redhat.com Subject: [PATCH 6/8] ceph: use READ_ONCE to access d_parent in RCU critical section Date: Thu, 23 May 2019 16:06:44 +0800 Message-Id: <20190523080646.19632-6-zyan@redhat.com> In-Reply-To: <20190523080646.19632-1-zyan@redhat.com> References: <20190523080646.19632-1-zyan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 23 May 2019 08:07:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: "Yan, Zheng" --- fs/ceph/mds_client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 60e8ddbdfdc5..870754e9d572 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -913,7 +913,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc, struct inode *dir; rcu_read_lock(); - parent = req->r_dentry->d_parent; + parent = READ_ONCE(req->r_dentry->d_parent); dir = req->r_parent ? : d_inode_rcu(parent); if (!dir || dir->i_sb != mdsc->fsc->sb) { @@ -2131,8 +2131,8 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, if (inode && ceph_snap(inode) == CEPH_SNAPDIR) { dout("build_path path+%d: %p SNAPDIR\n", pos, temp); - } else if (stop_on_nosnap && inode && dentry != temp && - ceph_snap(inode) == CEPH_NOSNAP) { + } else if (stop_on_nosnap && dentry != temp && + inode && ceph_snap(inode) == CEPH_NOSNAP) { spin_unlock(&temp->d_lock); pos++; /* get rid of any prepended '/' */ break; @@ -2145,7 +2145,7 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, memcpy(path + pos, temp->d_name.name, temp->d_name.len); } spin_unlock(&temp->d_lock); - temp = temp->d_parent; + temp = READ_ONCE(temp->d_parent); /* Are we at the root? */ if (IS_ROOT(temp)) -- 2.17.2