Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1118773yba; Fri, 26 Apr 2019 14:30:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmO64nUV1oSNEXH767mzZVygTtKLC2GHN+JYnKA3qmwL/COmii22NVQvL+/61eKhBFwBaR X-Received: by 2002:aa7:9206:: with SMTP id 6mr4608252pfo.71.1556314226149; Fri, 26 Apr 2019 14:30:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556314226; cv=none; d=google.com; s=arc-20160816; b=Zu7euSVea4Y9mun211yfGeMfpEb6uMo38ajcTu0JGjyN5umxKuZQIdSmiTX4vsg+G2 5Ic5sDbLrmTytjCWoWYPGpz7Jb31IrC23wj//3R8XFgwfH68zu7fDs5XdCz23tg4+iCV JKRAbSQlUYAk3d4P8og6xR+sWogzBLoSgNOa9WpHeQLEryHUZA8zH9P2k8GLsR+LOeCj 3zdjp0Yp5RWZhw+CTmGunGYPvYhRcaL/Dki0u5x4LpLe9N/nFs119SXfpYKciDkrLJ/8 WrLwQAQYOEXDtgcCRKPjEUDv2jsv4Pm4QzeWiFRuE1ykJm64Ru2mS28+J9iBknXSSjaA HpUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=NpJ6K1Z8txLrajIYnB+YFAQyBBN53v9KPfZMcp+kIJA=; b=L0ne65IofADQ6dCm9vB3K/BTbfjIv8x6ffpUKTHghUpcJecyI3vi3Lniu+kj49tNIU Q/+givw2FieVvHlHlCZrqN6OQ0nP1EAPXFLX1pLpEwfzQb9ZGesRVAbwdCZh/CFS/1H6 PXtrod9Yk49kHjs9NJ4RDlmerYFJdBTd56EeosQZREmTTb0r7G9GXhnZYcDu5V8beSu1 G2LtByZBCgRQiiYDVMYmuE9GF3opYIthnueyOjYuUAn/VAKdF56huBnsA/l0nqV1KqnH CckzfYrAse2A2c54+hOit6uPkcP8UNJTcv0yNE4KXvqKZXl4NW3jfgofUqKZsPdtDuv/ qLlg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k14si25105281pll.126.2019.04.26.14.30.10; Fri, 26 Apr 2019 14:30:26 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726845AbfDZV2t (ORCPT + 99 others); Fri, 26 Apr 2019 17:28:49 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:43266 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726169AbfDZV2s (ORCPT ); Fri, 26 Apr 2019 17:28:48 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hK8Oj-0000Cx-Ck; Fri, 26 Apr 2019 21:28:45 +0000 Date: Fri, 26 Apr 2019 22:28:45 +0100 From: Al Viro To: Jeff Layton Cc: Linus Torvalds , Ilya Dryomov , ceph-devel@vger.kernel.org, Linux List Kernel Mailing Subject: Re: [GIT PULL] Ceph fixes for 5.1-rc7 Message-ID: <20190426212845.GC2217@ZenIV.linux.org.uk> References: <20190425174739.27604-1-idryomov@gmail.com> <342ef35feb1110197108068d10e518742823a210.camel@kernel.org> <20190425200941.GW2217@ZenIV.linux.org.uk> <86674e79e9f24e81feda75bc3c0dd4215604ffa5.camel@kernel.org> <20190426170108.GZ2217@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 26, 2019 at 04:49:24PM -0400, Jeff Layton wrote: > Got it, thanks. Why use an atomic_t for the refcount if it's always > accessed under spinlock? _Which_ spinlock? The whole reason for refcounts is that many dentries might end up with shared external name. So ->d_lock on one of them won't do anything to accesses via another... > > What I don't understand is why would anyone want to mess with > > name snapshots for dentry_path() lookalikes... > > Mostly because the place where the ceph code needs to use and free these > strings is rather far removed from where they are created. It simplifies > that part if we can access and free them all in the same way. > > I was planning to just use name_snapshots universally for that purpose, > but they have a rather specific method of freeing things that is hard to > duplicate if you don't have a dentry to clone. > > Probably that means I'm approaching this problem in the wrong way and > need to do it differently. For short names snapshot will put the copy into your variable, normally on the stack frame. So it doesn't really help if you want to keep that stuff around. Again, dentries with short names have those stored inside the dentry and for anything long-term you will need to copy that data; otherwise rename() will happily change those under you. If you want to deal with pathnames, do __getname() + a loop similar to that in dentry_path() et.al. All there is to it. Snapshots are for situations when you want a reasonably short-term access to name of specific dentry you have a reference to and do not want to do any allocations.