From patchwork Wed Aug 10 20:30:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9273985 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 4F2C6600CA for ; Wed, 10 Aug 2016 20:30:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CEF827F80 for ; Wed, 10 Aug 2016 20:30:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30EB32840C; Wed, 10 Aug 2016 20:30:15 +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 9719227F80 for ; Wed, 10 Aug 2016 20:30:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933748AbcHJUaM (ORCPT ); Wed, 10 Aug 2016 16:30:12 -0400 Received: from mail-qk0-f182.google.com ([209.85.220.182]:34324 "EHLO mail-qk0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932985AbcHJUaK (ORCPT ); Wed, 10 Aug 2016 16:30:10 -0400 Received: by mail-qk0-f182.google.com with SMTP id p186so55522144qkd.1 for ; Wed, 10 Aug 2016 13:30:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=1egH09CmyZy46ESvjwc8Hy1jAM7N3rLH80idT4PuwEM=; b=ZKDmfMu6naE015Ijjx19Ld4Zw1I6RIPzY9Q0157t0KBmDMiZBdvx7tYRokGt1kBQZK WJxGg2AxKwdKpO8x1Hcm2RysqOe0byaMZ5pPn937XV8dhskc1Bj+ggzkdEckEuTIrViw 7+Ek7PMEUwVdx9m09rNY1E22mVnQbQVv5X2F3sFkWi7rSt13E0Y3digzkt4UumR3JznL qYAzOsr7Pu6OX3auKwjIBGJXiAuBJ232SS3mKgwtb00Cn5cm2q8ALeSUNALP7dlybWcx utWJVJgGoUvZcWEgX4h+aJMdkhsuslTgWQfO8CpsWuRlK4Ow5aMPvnsMoY5g0wooHi9b uyAA== X-Gm-Message-State: AEkoousbBiudvOkRgsYrWWK9fF2pnCy7uoTQY4dZV3OgvldkmfpPRdc4bfmzkwuPWLLaX4pA X-Received: by 10.55.72.79 with SMTP id v76mr6471123qka.194.1470861009180; Wed, 10 Aug 2016 13:30:09 -0700 (PDT) Received: from cpe-2606-A000-1125-405B-671F-D62-672D-C5B3.dyn6.twc.com (cpe-2606-A000-1125-405B-671F-D62-672D-C5B3.dyn6.twc.com. [2606:a000:1125:405b:671f:d62:672d:c5b3]) by smtp.gmail.com with ESMTPSA id m10sm24260399qta.31.2016.08.10.13.30.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Aug 2016 13:30:08 -0700 (PDT) Message-ID: <1470861005.2694.12.camel@redhat.com> Subject: Re: [RFC PATCH] client: don't use special inode for /.. From: Jeff Layton To: Patrick Donnelly Cc: Ceph Development Date: Wed, 10 Aug 2016 16:30:05 -0400 In-Reply-To: References: <1470846630-830-1-git-send-email-jlayton@redhat.com> X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 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 On Wed, 2016-08-10 at 16:08 -0400, Patrick Donnelly wrote: > On Wed, Aug 10, 2016 at 12:30 PM, Jeff Layton > wrote: > > > > The CEPH_INO_DOTDOT thing is quite strange. Under most OS (Linux > > included), the parent of the root is itself. IOW, at the root, '.' > > and > > '..' refer to the same inode. > > > > Change the ceph client to do the same, as this allows users to get > > valid stat info for '..', as well as elimnating some special- > > casing. > > > > Signed-off-by: Jeff Layton > > Don't forget Client::_lookup: > >   if (dname == "..") { >     if (dir->dn_set.empty()) >       r = -ENOENT; >     else >       *target = dir->get_first_parent()->dir->parent_inode; //dirs > can't be hard-linked >     goto done; >   } > > Otherwise LGTM. > Ahh, thanks. So will dir->dn_set.empty() be true at the root? If so, then something like the patch below? Note that this patch is not strictly necessary, but it does simplify some other changes that I have queued up: diff --git a/src/client/Client.cc b/src/client/Client.cc index 5ab0ace4d3df..287baaf20536 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -5924,7 +5924,7 @@ int Client::_lookup(Inode *dir, const string& dname, int mask,      if (dname == "..") {      if (dir->dn_set.empty()) -      r = -ENOENT; +      *target = dir;      else        *target = dir->get_first_parent()->dir->parent_inode; //dirs can't be hard-linked      goto done;