From owner-freebsd-fs@freebsd.org Mon Dec 19 05:55:14 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 AF01BC87421 for ; Mon, 19 Dec 2016 05:55:14 +0000 (UTC) (envelope-from 0100015915a5eb1d-65f1e4a1-549d-47a4-9aaf-3ba9f191ec44-000000@amazonses.com) Received: from a8-176.smtp-out.amazonses.com (a8-176.smtp-out.amazonses.com [54.240.8.176]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 701431D7A for ; Mon, 19 Dec 2016 05:55:14 +0000 (UTC) (envelope-from 0100015915a5eb1d-65f1e4a1-549d-47a4-9aaf-3ba9f191ec44-000000@amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=vnqrkfnvu6csdl6mwgk5t6ix3nnepx57; d=tarsnap.com; t=1482126912; h=Subject:To:References:Cc:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=ZaSX9VqgCy9AZiG3Kew08gl06x7XT1zc5kge0QTeuy0=; b=hqE+lxsR3pkBMh8PkPQ54LzNFkEY8YKMmLAcPKFe9YuIte5Nw+b1AYb5Oef9sQtw D2jEOpWShh0y4bZA0iOVEwvFn/5PrMDX1nyt7uGezaTji/1UztAq1eK2/QEgOWzHY2D GQHxzMvuxk5WSXohweXgwDCeC1rEuSHwJqXuoEyY= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1482126912; h=Subject:To:References:Cc:From:Message-ID:Date:MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=ZaSX9VqgCy9AZiG3Kew08gl06x7XT1zc5kge0QTeuy0=; b=GkPx8KlWRwsRK5mmkQw3pIdEtBRGhlAnj45zn5pr5mD5fySNcPL4X39PFdB1tJZR hXcjqEJ3gshkY0LHAoABJejHv2QvSKKY3kCJFklhgjCqtfqJneCzXHevDaK+qyBIFBd BfIXsFw+l5XZJYrJrG4qO2Y4FhM8lrmdqOjWhFWo= Subject: Re: ESTALE after cwd deleted by same NFS client To: Rick Macklem 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> <010001590945e9b3-015a4d05-2646-44ba-9db9-415e8b9119dd-000000@email.amazonses.com> Cc: "freebsd-fs@freebsd.org" From: Colin Percival Message-ID: <0100015915a5eb1d-65f1e4a1-549d-47a4-9aaf-3ba9f191ec44-000000@email.amazonses.com> Date: Mon, 19 Dec 2016 05:55:12 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: <010001590945e9b3-015a4d05-2646-44ba-9db9-415e8b9119dd-000000@email.amazonses.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SES-Outgoing: 2016.12.19-54.240.8.176 Feedback-ID: 1.us-east-1.Lv9FVjaNvvR5llaqfLoOVbo2VxOELl7cjN0AOyXnPlk=:AmazonSES 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: Mon, 19 Dec 2016 05:55:14 -0000 On 12/16/16 12:14, Colin Percival wrote: > making this change in nfs_lookup >> --- sys/fs/nfsclient/nfs_clvnops.c (revision 310132) >> +++ sys/fs/nfsclient/nfs_clvnops.c (working copy) >> @@ -1144,7 +1144,7 @@ >> *vpp = NULLVP; >> } >> >> - if (error != ENOENT) { >> + if (error != ENOENT && error != ESTALE) { >> if (NFS_ISV4(dvp)) >> error = nfscl_maperr(td, error, (uid_t)0, >> (gid_t)0); > > fixes the case I described above (for some definition of "fixes" -- I'm not > sure if this is the correct way of handling ESTALE here?) but I'm still seeing > ESTALEs from buildworld's cleandir so I think there must be some other place > where something odd is happening. Further information: In addition to the "lookup relative to a directory which has been deleted out from underneath us" case which causes ESTALE to land in nfs_lookup, the cleandir step of buildworld results in ESTALE being returned by nfsrpc_getattr into nfs_getattr (landing ultimately in getcwd), and ESTALE being returned by nfsrpc_accessrpc into nfs34_access_otw (landing ultimately in stat and lstat). In UFS there are checks for effnlink == 0 which result in e.g. ufs_lookup returning ENOENT; would it make sense to add NREMOVED to struct nfsnode.n_flag and check this in the appropriate nfs_* calls? -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid