Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753602AbdDKVCZ (ORCPT ); Tue, 11 Apr 2017 17:02:25 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:33434 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753379AbdDKVCV (ORCPT ); Tue, 11 Apr 2017 17:02:21 -0400 From: Andreas Dilger Message-Id: <73D0730D-C63C-47EE-AE56-5A0B6A2432D8@dilger.ca> Content-Type: multipart/signed; boundary="Apple-Mail=_BB79960F-8C79-4238-82DA-8C2566DAB8FB"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [git pull] vfs fixes Date: Tue, 11 Apr 2017 15:02:16 -0600 In-Reply-To: <20170411064840.GG29622@ZenIV.linux.org.uk> Cc: Linus Torvalds , Linux Kernel Mailing List , linux-fsdevel To: Al Viro References: <20170409053956.GB29622@ZenIV.linux.org.uk> <20170411064840.GG29622@ZenIV.linux.org.uk> X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1961 Lines: 69 --Apple-Mail=_BB79960F-8C79-4238-82DA-8C2566DAB8FB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Apr 11, 2017, at 12:48 AM, Al Viro wrote: > On Mon, Apr 10, 2017 at 11:10:19PM -0700, Linus Torvalds wrote: >=20 >> It looks odd because the lock part is >>=20 >> if (flags & LOOKUP_RCU) >> rcu_read_lock(); >>=20 >> ie it's locked conditionally, and the code in between does not seem = to >> return every time LOOKUP_RCU is clear. >>=20 >> So mind giving this a look? Is it as obviously buggy as I think it = is, >> or is there something I'm missing? >=20 > It's more obscure than I would like, and can grow into a bug one day, = but... > nd_jump_root() can only return non-zero if you have LOOKUP_RCU. So = without > LOOKUP_RCU in flags, this > if (flags & LOOKUP_RCU) > rcu_read_lock(); > set_root(nd); > if (likely(!nd_jump_root(nd))) > return s; > nd->root.mnt =3D NULL; > rcu_read_unlock(); > won't get to that rcu_read_unlock() at all - it'll get zero from = nd_jump_root() > and proceed to return s; So possibly a comment like the following would be helpful: rcu_read_unlock(); /* nd_jump_root() returns if = !LOOKUP_RCU */ so that us mere mortals have a chance to understand this in the future? Cheers, Andreas --Apple-Mail=_BB79960F-8C79-4238-82DA-8C2566DAB8FB Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iD8DBQFY7URZpIg59Q01vtYRAnKYAKDF7TUHm9VMdaasvAXHPVfG/XzTEQCgnt4g C5Ci95zTATbV5pDjTcFpcks= =pPcA -----END PGP SIGNATURE----- --Apple-Mail=_BB79960F-8C79-4238-82DA-8C2566DAB8FB--