Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2672659yba; Sun, 28 Apr 2019 06:29:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXXZP0tuzkSrQmAQ7zJxyYQcqgoUfPy9i2KPcoDzaSxGu4leBruUg4XutOISAbdy74NOfX X-Received: by 2002:a17:902:76c5:: with SMTP id j5mr56112724plt.337.1556458183701; Sun, 28 Apr 2019 06:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556458183; cv=none; d=google.com; s=arc-20160816; b=b8exHySSdkhnUnI8e1AR88WYue77A66zdS/f2MX86kxcMDBqNIKJTU6ig31cInATrc 0DxIGcptzz0whwjgX58zNmBytRABrywGjwyCe+7c4txqFGbWbFXdNjisBsl3dz3mtyY9 DHDOp82dH+4xwC6RxwjZx37hroEKgM6M6xGtrDHZFtm6jsSNiABp1c2s/zW9GXDhH28E 5dP/b9cisn/THLz2F2CbpfY2weDQ8f7C8LQRT18qHE5PziTUDi5ezTtapGt2MW3etUH0 7/YlPJGXqHX2cWlSeVySOxtj2S3LJLFXUV/zBSspUuayh+INrI4b7j14jiiLVWKYFQuP s1NQ== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=veydWY/ZJ8dRDIBC8JnLMAi7puckx1S8FbNaue2w2Ak=; b=Bpr4DL2WlG2q5FhXPd4qDH1mIg9ZFFReIIE1eiFufYcVmlymnQsP7GFzrZ+yR6AE8C YhSGZ5cdmNYlaRNjeRllT5cz5qYV4VP9YxTMbJSP5k1gUZEYiZiDrPMT7+vHnyU3yWT9 eDzm2ihRwqmlMaMEtDRKVWgkCTwNCn9KiiS3vwjCaewTyN38dQs995q1CD/Cb1RkfABz +xaZztn30IrrXk9yKHO9vtoHffT4c0jLxicrqQazMjEc5nO1h2/YmpRub6BiuYLnniOB JqwS9ewpiCbMhMXgtfDv35aO/GJxnbHAF9o00VAV6dHatYZqTzvVirPwkZANabBtwTjY O4Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=By7LJSUy; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d21si29506036pgh.255.2019.04.28.06.29.28; Sun, 28 Apr 2019 06:29:43 -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; dkim=pass header.i=@kernel.org header.s=default header.b=By7LJSUy; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726722AbfD1N1Y (ORCPT + 99 others); Sun, 28 Apr 2019 09:27:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:40108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726546AbfD1N1X (ORCPT ); Sun, 28 Apr 2019 09:27:23 -0400 Received: from tleilax.poochiereds.net (cpe-71-70-156-158.nc.res.rr.com [71.70.156.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4DA0F206A3; Sun, 28 Apr 2019 13:27:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556458043; bh=kXxRuMxpn6XuhqKDuNS/WvUjBrLbhsr6cIWv2K+eIJ4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=By7LJSUymg+low6MjLpavERyqgTUYbhUd89tb1TQ37s9g/R5j+M6iVhKP1ejoI7kF 1SH4UxprAXjNkbqThU6vXV6XC5i7TXRyi0u9QkZEVALr2MmAw6oTRofVFcmgSNUFLY 5wOVg5L/UZylFbBRtyEbLgfQtb5IdoIOcdpNar0k= Message-ID: <7bac7ba5655a8e783a70f915853a0846e7ff143b.camel@kernel.org> Subject: Re: [GIT PULL] Ceph fixes for 5.1-rc7 From: Jeff Layton To: Al Viro Cc: Linus Torvalds , Ilya Dryomov , ceph-devel@vger.kernel.org, Linux List Kernel Mailing , linux-cifs Date: Sun, 28 Apr 2019 09:27:20 -0400 In-Reply-To: <20190428043801.GE2217@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> <20190426165055.GY2217@ZenIV.linux.org.uk> <20190428043801.GE2217@ZenIV.linux.org.uk> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2019-04-28 at 05:38 +0100, Al Viro wrote: > On Fri, Apr 26, 2019 at 01:30:53PM -0400, Jeff Layton wrote: > > > > I _probably_ would take allocation out of the loop (e.g. make it > > > __getname(), called unconditionally) and turned it into the > > > d_path.c-style read_seqbegin_or_lock()/need_seqretry()/done_seqretry() > > > loop, so that the first pass would go under rcu_read_lock(), while > > > the second (if needed) would just hold rename_lock exclusive (without > > > bumping the refcount). But that's a matter of (theoretical) livelock > > > avoidance, not the locking correctness for ->d_name accesses. > > > > > > > Yeah, that does sound better. I want to think about this code a bit > > FWIW, is there any reason to insist that the pathname is put into the > beginning of the buffer? I mean, instead of path + pathlen we might > return path + offset, with the pathname going from path + offset to > path + PATH_MAX - 1 inclusive, with path being the thing eventually > freed. > > It's easier to build the string backwards, seeing that we are walking > from leaf to root... (cc'ing linux-cifs) I don't see a problem doing what you suggest. An offset + fixed length buffer would be fine there. Is there a real benefit to using __getname though? It sucks when we have to reallocate but I doubt that it happens with any frequency. Most of these paths will end up being much shorter than PATH_MAX and that slims down the memory footprint a bit. Also, FWIW -- this code was originally copied from cifs' build_path_from_dentry(). Should we aim to put something in common infrastructure that both can call? There are some significant logic differences in the two functions though so we might need some sort of callback function or something to know when to stop walking. -- Jeff Layton