From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751503AbdKVBcF (ORCPT ); Tue, 21 Nov 2017 20:32:05 -0500 Received: from mx2.suse.de ([195.135.220.15]:53439 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751353AbdKVBcE (ORCPT ); Tue, 21 Nov 2017 20:32:04 -0500 From: NeilBrown To: Al Viro Date: Wed, 22 Nov 2017 12:31:54 +1100 Cc: Linus Torvalds , linux-fsdevel , Linux Kernel Mailing List Subject: Re: [PATCH 3/3] VFS: close race between getcwd() and d_move() In-Reply-To: <20171121235057.GA19523@ZenIV.linux.org.uk> References: <151019756744.30101.3832608128627682973.stgit@noble> <151019772763.30101.16040338743875884111.stgit@noble> <8760ajf6al.fsf@notabene.neil.brown.name> <871sl6eo7e.fsf@notabene.neil.brown.name> <20171110205328.GH21978@ZenIV.linux.org.uk> <20171121235057.GA19523@ZenIV.linux.org.uk> Message-ID: <87fu9714l1.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Tue, Nov 21 2017, Al Viro wrote: > On Fri, Nov 10, 2017 at 08:53:28PM +0000, Al Viro wrote: >> On Fri, Nov 10, 2017 at 03:45:41PM +1100, NeilBrown wrote: >> > -void __d_drop(struct dentry *dentry) >> > +static void ___d_drop(struct dentry *dentry) >> > { >> > if (!d_unhashed(dentry)) { >> > struct hlist_bl_head *b; >> > @@ -486,12 +488,15 @@ void __d_drop(struct dentry *dentry) >> >=20=20 >> > hlist_bl_lock(b); >> > __hlist_bl_del(&dentry->d_hash); >> > - dentry->d_hash.pprev =3D NULL; >> > hlist_bl_unlock(b); >> > /* After this call, in-progress rcu-walk path lookup will fail. */ >> > write_seqcount_invalidate(&dentry->d_seq); >> > } >> > } >> > +void __d_drop(struct dentry *dentry) { >> > + ___d_drop(dentry); >> > + dentry->d_hash.pprev =3D NULL; >>=20 >> Umm... That reordering (unhashed vs. ->d_seq) might be a problem >> on the RCU side. I'm not sure it is, we might get away with that, >> actually, but I want to finish digging through the pathwalk-related >> code. Cursing it for being too subtle for its own good, as usual... > > OK, I believe that it's survivable, but I'd prefer to keep in -next > for a while and give it more testing. Great, thanks. I assume you will fix the silly '{' at the end of the line when defining __d_drop(). Let me know if you would rather I resend. Thanks, NeilBrown --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAloU04oACgkQOeye3VZi gbmPQw//bZjdjXPdM1Rfd51NDm0Aak4PVk1h1jq1Zo8xYa/O3VF3MLL709B6mSNI Oxv2ifxI6/FG/mqxces+VRfKtYuh9HRHTkw0/sefEs1buA8S10D0gtIRtnd58RSQ O3PiVqBgZGjLXO5eZPlIQty7gvt9x8A5S6x74n7/Slx2/5M+l3NE4yiIg4+1SCbn 91gMNoomYxcsxcdQRuXx/Yq82INd7MYx/2v0gsqwura2JY3a0n1ADqFMS0RtJ2FE rl7UHSStLU6o4yqhETdsJD0kXVdUQAMC3/elOqgWWK/99KiLhAjnZD2D7s+JnGEq yNJoPviKasjnYHMxn9KpO1mUmt1nwo1JQ8T9uQAeT/p6uo2kirOZ8pi302g3Eaxc 9SZmzHGjFCGpYpPfp4KpUoAOaOYuiZ4p6WgmscXF/AKD0RelV4KuojPsTZtbA6P2 sj4znutZMgMsDfdbB6IqZ8jL2i349z5bOIc3lRVTfb9eb/TAhB6EzMtjTosyuotI J/yeQlqcg1W7RQGOdRViO1LhaPp/ZDE8K/Co08Ngk/CLu9wllJUg8PwxH5s0EJkg IDxWiQDdeINU0wcfcUPxq3mE2U9WFYqHa2xkbPM+s6ksy65rBFgnUxwtheCONdvf AEWWyLuMm83oa8CBp3cqoBoQ4ZzUxd2ReWwTR6BO3lHe9xp4Jpw= =ghzk -----END PGP SIGNATURE----- --=-=-=--