From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752287AbbJWCmT (ORCPT ); Thu, 22 Oct 2015 22:42:19 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:42254 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751554AbbJWCmS (ORCPT ); Thu, 22 Oct 2015 22:42:18 -0400 From: Neil Brown To: Nicolas Parpandet , linux-kernel@vger.kernel.org Date: Fri, 23 Oct 2015 13:42:10 +1100 Cc: pcoustillas Subject: Re: nfs race condition In-Reply-To: <25375254.368343.1445542145314.JavaMail.zimbra@1g6.biz> References: <703659807.104689.1443944693452.JavaMail.zimbra@1g6.biz> <1194508496.104744.1443945446284.JavaMail.zimbra@1g6.biz> <25375254.368343.1445542145314.JavaMail.zimbra@1g6.biz> User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-suse-linux-gnu) Message-ID: <871tcmz4ot.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; charset=utf-8 Content-Transfer-Encoding: quoted-printable Nicolas Parpandet writes: > Hello, > > I did some more investigations, (wireshark) > > The unlink of /tmp/crontab.vYPoHR/crontab is tranlated into a rename > nfs call ? (.nfs file) That happens if the file is still open. > > NFS 670 V3 READDIRPLUS Reply (Call In 731) crontab .. . > NFS 210 V3 LOOKUP Call (Reply In 734), DH: 0x038abb3d/.nfs000000000098008= a00000019 > NFS 194 V3 LOOKUP Reply (Call In 733) Error: NFS3ERR_NOENT > NFS 254 V3 RENAME Call (Reply In 736), From DH: 0x038abb3d/crontab To DH:= 0x038abb3d/.nfs000000000098008a00000019 > NFS 338 V3 RENAME Reply (Call In 735) > > and after, it tries to remove the directory /tmp/crontab.0wuoNx : > NFS 198 V3 RMDIR Call (Reply In 738), DH: 0x954c28ec/crontab.0wuoNx > NFS 222 V3 RMDIR Reply (Call In 737) Error: NFS3ERR_NOTEMPTY > > but the file /tmp/crontab.0wuoNx/crontab was renamed instead of being rem= oved (nfs network, I cannot see .nfs000 file in fact), > this prevent the removing of the directory /tmp/crontab.0wuoNx (notempty) > > It seems a race condition, see "nfs silly rename" keyword, but I have > the problem with mysql temp files, and crontab temp file (crontab -e), I don't think it is a race condition exactly. More of an ordering problem. Unlinking a file before closing it is rarely useful (sometimes it is, but not here). > am I the only one doing mysql and crontabs over NFS !!!?!?, Probably. > does anybody have a solution ? Fix 'crontab' to close before unlinking... Is this the Debian/Ubuntu crontab program.... it looks a bit like it, but this bug was fixed 6 years ago. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D413962 Or use a tmpfs for /tmp/ rather than using NFS??? NeilBrown > > > Regards > > Nicolas > > > ----- Mail original ----- > De: "npa" > =C3=80: linux-kernel@vger.kernel.org > Cc: "pcoustillas" > Envoy=C3=A9: Dimanche 4 Octobre 2015 09:57:26 > Objet: nfs race condition > > Hello,=20 > > I'm doing some " crontab -e, exit with :x" on NFS mount point,=20 > and there is a race condition whent removing temporary files :=20 > > > 7701 write(2, "No modification made\n", 21) =3D 21=20 > 7701 open("/tmp/crontab.vYPoHR", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXE= C) =3D 4=20 > 7701 getdents(4, {{d_ino=3D73336409, d_off=3D1, d_reclen=3D24, d_name=3D"= ."} {d_ino=3D73335455, d_off=3D2, d_reclen=3D24, d_name=3D".."} {d_ino=3D73= 340547, d_off=3D3, d_reclen=3D32, d_name=3D"crontab"}}, 32768) =3D 80=20 > 7701 unlink("/tmp/crontab.vYPoHR/crontab") =3D 0=20 > 7701 getdents(4, {}, 32768) =3D 0=20 > 7701 close(4) =3D 0=20 > 7701 rmdir("/tmp/crontab.vYPoHR") =3D -1 ENOTEMPTY (Directory not empty)= =20 > 7701 write(2, "/tmp/crontab.vYPoHR: Directory n"..., 41) =3D 41=20 > 7701 socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) =3D 4 > > The unlink is really done after the rmdir, > nfsv4 & nfsv3 over ipv6, so the rmdir fails and the directory isn't remov= ed. > I have same problem with mysql temporary files. > > If I mount with "nocto,noac,lookupcache=3Dnone" : same problem > kernel version on server : 3.16.0-4-amd64 (debian8) > kernel version on client : 2.6.32-39-pve (proxmox), same thing with 3.13.= 0-63-generic (ubuntu) > > Please answer me in CC, I'm not subscribed to the list. > > Regards > > Nicolas > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWKZ6DAAoJEDnsnt1WYoG5xIkP/RurNlaFaPasH9FuHgTnHQiM w74HliGOx4mAi4oQMoCL92nj6dzh8e78oHmmRjFrId3sheh6vS456ZN7P6KKNi2B mfF10yKtzxVnEr6rGrDS7sakeHSbVP3nMhkASJuipCvGkk5LmxpAot07XjX7VhFT AO6MQkQfdLnG0pksVEjsdjg5QZ1aq+RACrAzrynjIzskxbAaloNx8oyqoCBjU6MB nLyQHKzC0yVxyYekRDfCrk2Jhb1gdOzY7dlYnYEiMVM7I8fN06Zcy5//nvvWCrsO sgn4IhA85dUc8PbKpIy1JwRqUgcE5f3Bq0nPQK/+FoO1MXonFctSX/V5hMavG2QN xbUp/JvphUqV7E4A9g+qoXL8lyzqUR8lQPRauGj2UIOdGmlPJAK+zZRAIHTuvo9I 05STfUU9DAVPsPT2nUw5amcEw999Y2eyExDUuoeP8ujlsy3duxT0JX1f7Epyd6mR G++bzwhA0bGMYHX7G4urP++FloloPRaZDO5PqGJwCiQ7YLRl7rqBTnAVE0VZ5t2t 8oZ4BbBosJp5gxctwmfljAln9dQUi6CjH1soX/FnV5lBQChnzuIpgAn11NSIaFfu tgKpb6GTXwimmT4JqxjUR3BvQnT3HNg/U70YAM/TJl72JRlKjp2h7wQMb4yJjXHp Wt1bkFdXPZtupdQveB0x =W8MF -----END PGP SIGNATURE----- --=-=-=--