From patchwork Mon Jan 30 16:19:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9545673 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A1414604A8 for ; Mon, 30 Jan 2017 16:19:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96E3428138 for ; Mon, 30 Jan 2017 16:19:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A8F228159; Mon, 30 Jan 2017 16:19:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1ABA528173 for ; Mon, 30 Jan 2017 16:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932426AbdA3QTy (ORCPT ); Mon, 30 Jan 2017 11:19:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56204 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932165AbdA3QTq (ORCPT ); Mon, 30 Jan 2017 11:19:46 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 072AF61BAF; Mon, 30 Jan 2017 16:19:47 +0000 (UTC) Received: from tleilax.poochiereds.net (ovpn-116-190.rdu2.redhat.com [10.10.116.190]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v0UGJhwB003369; Mon, 30 Jan 2017 11:19:46 -0500 From: Jeff Layton To: ceph-devel@vger.kernel.org Cc: zyan@redhat.com, sage@redhat.com, idryomov@gmail.com Subject: [PATCH 5/5] ceph: do a LOOKUP in d_revalidate instead of GETATTR Date: Mon, 30 Jan 2017 11:19:42 -0500 Message-Id: <20170130161942.16537-6-jlayton@redhat.com> In-Reply-To: <20170130161942.16537-1-jlayton@redhat.com> References: <20170130161942.16537-1-jlayton@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 30 Jan 2017 16:19:47 +0000 (UTC) Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In commit c3f4688a08f (ceph: don't set req->r_locked_dir in ceph_d_revalidate), we changed the code to do a GETATTR instead of a LOOKUP as the parent info isn't strictly necessary to revalidate the dentry. What we missed there though is that in order to update the lease on the dentry after revalidating it, we _do_ need parent info. Change ceph_d_revalidate back to doing a LOOKUP instead of a GETATTR so that we can get the parent info in order to update the lease from ceph_fill_trace. Note too that because we don't set r_locked_dir in this codepath, we must also remove the WARN_ON_ONCE from ceph_fill_trace or it will pop here. Signed-off-by: Jeff Layton --- fs/ceph/dir.c | 4 ++-- fs/ceph/inode.c | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index d4385563b70a..33da70514a95 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c @@ -1237,11 +1237,11 @@ static int ceph_d_revalidate(struct dentry *dentry, unsigned int flags) return -ECHILD; op = ceph_snap(dir) == CEPH_SNAPDIR ? - CEPH_MDS_OP_LOOKUPSNAP : CEPH_MDS_OP_GETATTR; + CEPH_MDS_OP_LOOKUPSNAP : CEPH_MDS_OP_LOOKUP; req = ceph_mdsc_create_request(mdsc, op, USE_ANY_MDS); if (!IS_ERR(req)) { req->r_dentry = dget(dentry); - req->r_num_caps = op == CEPH_MDS_OP_GETATTR ? 1 : 2; + req->r_num_caps = 2; mask = CEPH_STAT_CAP_INODE | CEPH_CAP_AUTH_SHARED; if (ceph_security_xattr_wanted(dir)) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index bb2413d711ce..870a0cfb8647 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -1175,8 +1175,6 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, &req->r_caps_reservation); if (err < 0) goto done; - } else { - WARN_ON_ONCE(1); } if (dir && req->r_op == CEPH_MDS_OP_LOOKUPNAME) {