From owner-freebsd-fs@freebsd.org Fri Dec 16 02:51:05 2016 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55AA6C77CB4 for ; Fri, 16 Dec 2016 02:51:05 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0065.outbound.protection.outlook.com [104.47.42.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F368E1C5C for ; Fri, 16 Dec 2016 02:51:04 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM (10.165.218.133) by YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM (10.165.218.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.789.14; Thu, 15 Dec 2016 23:17:46 +0000 Received: from YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM ([10.165.218.133]) by YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM ([10.165.218.133]) with mapi id 15.01.0789.014; Thu, 15 Dec 2016 23:17:46 +0000 From: Rick Macklem To: Colin Percival , Benjamin Kaduk CC: "freebsd-fs@freebsd.org" Subject: Re: ESTALE after cwd deleted by same NFS client Thread-Topic: ESTALE after cwd deleted by same NFS client Thread-Index: AQHSVANFVKFixagVOUGZ8mLDXQwbl6EDzQuAgAC4aM2AAVLGrIABN7mAgABdEGCAAjtv0g== Date: Thu, 15 Dec 2016 23:17:46 +0000 Message-ID: References: <01000158f023675b-41b35a73-4428-4937-853b-62db4fb9b984-000000@email.amazonses.com> <20161212054233.GU8460@kduck.kaduk.org> <01000158f1abc081-d4eddc58-3b4b-41dd-aa1e-0157d2fad812-000000@email.amazonses.com> <20161212163603.GV8460@kduck.kaduk.org> , <01000158fc3da2c5-c13da088-e7b9-4ac0-ac01-ec49a275dd24-000000@email.amazonses.com>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=rmacklem@uoguelph.ca; x-ms-office365-filtering-correlation-id: 088d3dc4-6b95-4984-7716-08d42540944f x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:YTXPR01MB0189; x-microsoft-exchange-diagnostics: 1; YTXPR01MB0189; 7:MVlXM1QZKPs3H33quIC7/LSATLXruLx1Ueel2crflOtgMZYbLadDTZfVBb+YLLYhC5oqL6b/W8NrKivqEtszcZIPntzVu98Oh4G43Nkdk1443PZa9M3kznNfJF2DvblZbR210kJWyDsmgMjBaHa8nYuyMBTyMGPZR+HMpaHQqhSGTTFasVzG/umFqRz35ufzd+Oj9hWXx9i+2MULgKVFxcbKsOVECpF0U/E26x3Z/nmo1dqaCs0lqFgdtX1h8sletQ5SMjG0COqZP7oWx8yg1K5VHIYPsb4pgjgugg0P2C3wXEY7qMNIH16ToWOkRLWisB3srI9HQ1HPkAPkkAGYNcZG064Sx7ChB+3IeHoi9zVCmkHNFhgKSDSh0mxVdI1e7YuBC4nb0deGg3HzacWjWUr7CYV+T7pAOYiAYv6UTjRMN2EvyASbbfJkVQuc7PFJbPPaI4Hd1wYo6gjzogXA7Q== x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123560025)(20161123555025)(20161123562025)(20161123564025)(6072148); SRVR:YTXPR01MB0189; BCL:0; PCL:0; RULEID:; SRVR:YTXPR01MB0189; x-forefront-prvs: 0157DEB61B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(39450400003)(189002)(199003)(24454002)(106356001)(68736007)(5660300001)(4326007)(8676002)(74482002)(9686002)(2906002)(8936002)(92566002)(2900100001)(81166006)(3280700002)(189998001)(122556002)(101416001)(33656002)(3660700001)(305945005)(97736004)(54356999)(5001770100001)(76176999)(50986999)(93886004)(102836003)(81156014)(2171001)(2950100002)(77096006)(74316002)(105586002)(7696004)(86362001)(106116001)(229853002)(38730400001)(6436002)(6506006); DIR:OUT; SFP:1101; SCL:1; SRVR:YTXPR01MB0189; H:YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2016 23:17:46.1202 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTXPR01MB0189 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Dec 2016 02:51:05 -0000 Colin Percival wrote: >On 12/13/16 05:04, Rick Macklem wrote: >>>>> On Sun, Dec 11, 2016 at 11:06:42PM +0000, Colin Percival wrote: >>>>>> If I run the following with /nfs/ being an NFS mount: >>>>>> # mkdir /nfs/foo >>>>>> # touch /nfs/foo/bar >>>>>> # cd /nfs/foo >>>>>> # rm -r /nfs/foo >>>>>> # rm bar >> If this is happening on a single client > >Yes. At the time I ran this, there was only one client. > I will try and play with this when I get home, but you could test the follo= wing simple change: (I'll just explain the patch, since I don't have sources han= dy) In sys/fs/nfsclient/nfs_clvnops.c: Line #s 1678, 1679 (for remove) and 2180, 2181 (for rmdir) look like: if (error =3D=3D ENOENT) error =3D 0; This is done since, if it doesn't exist, it has been "removed". It seems to me that ESTALE means it has been removed too. (Actually the directory the name was in has been removed, but that implies = that the name is gone too.) You could try changing the code at 1678 and 2180 to: if (error =3D=3D ENOENT || error =3D=3D ESTALE) error =3D 0; and see if that "fixes" the problem. (This hack has existed in the code for= a long time and changing it to also do ESTALE seems reasonable to me.) If this doesn't fix it, then it might be "do sillyrename for directories", = but that is a more significant (I might call it scarier) change. Have fun with it, rick