From owner-freebsd-fs@freebsd.org Fri Apr 14 22:44:56 2017 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 41F25D3D926 for ; Fri, 14 Apr 2017 22:44:56 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670070.outbound.protection.outlook.com [40.107.67.70]) (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 E5D7DA16 for ; Fri, 14 Apr 2017 22:44:55 +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_128_CBC_SHA256_P256) id 15.1.1019.17; Fri, 14 Apr 2017 22:44:53 +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.1019.028; Fri, 14 Apr 2017 22:44:53 +0000 From: Rick Macklem To: "freebsd-fs@freebsd.org" CC: "jim@ks.uiuc.edu" Subject: NFSv4 Linux client atime for exclusive create Thread-Topic: NFSv4 Linux client atime for exclusive create Thread-Index: AQHStW9Xwd3iU1MkQkKHy7u7vlbe/w== Date: Fri, 14 Apr 2017 22:44:53 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: ks.uiuc.edu; dkim=none (message not signed) header.d=none;ks.uiuc.edu; dmarc=none action=none header.from=uoguelph.ca; x-microsoft-exchange-diagnostics: 1; YTXPR01MB0189; 7:RkFzHZdqXP3KMZ3qRQidhNjDkaVwlsbaVZQcfHd0v+bBMp8FqSxipKi5xG6R51HF+tTW3likvqIjYhy/83/jmkKkaWAkbGDkTRIGlxZWrieKroEoviHArMMddeNcAHJfO9XLfmuL+/vDVGKqROTfK2htISljlYtDgj9a0fgRmmMh8f8O2YA/5x8vvbV08K63URFAhofnjVfrrLS0rSVYtmIQhvaSs3ahDNGvemTgJ8s09BXn/Z8js1Faiba2sDWq1Wivd+WxZIEEmA7fwYELtOyzBPhJe96m1nnVMhkEJ0ZxIIQkJZB4WX1rzuYYJFaAMn4OIjTmWFc3pRTr7HzOsg== x-ms-office365-filtering-correlation-id: e72e16dc-e8c2-4e5d-c1d9-08d48387de1d x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:YTXPR01MB0189; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(158342451672863)(20558992708506); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(6041248)(20161123560025)(20161123564025)(201703131423075)(201702281529075)(201702281528075)(201703061421075)(20161123555025)(20161123562025)(6072148); SRVR:YTXPR01MB0189; BCL:0; PCL:0; RULEID:; SRVR:YTXPR01MB0189; x-forefront-prvs: 02778BF158 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39450400003)(39410400002)(39400400002)(39840400002)(33656002)(25786009)(4326008)(110136004)(74316002)(305945005)(2900100001)(54356999)(50986999)(2351001)(2501003)(38730400002)(3280700002)(6916009)(8676002)(86362001)(5640700003)(81166006)(7696004)(77096006)(2906002)(55016002)(8936002)(6436002)(53936002)(3660700001)(9686003)(6506006)(74482002)(189998001)(102836003)(122556002)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:YTXPR01MB0189; H:YTXPR01MB0189.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; MLV:sfv; LANG:en; 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: 14 Apr 2017 22:44:53.4827 (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, 14 Apr 2017 22:44:56 -0000 PR#218218 reports a problem where a file created by an NFSv4 mount (using a= recent Linux kernel) results in a bogus atime for the newly created file. With the help of a packet trace from the problem reported I now know what i= s happening, but it turns out to be interesting and I am not sure I have a go= od way to fix it. Here's the story... - The Linux client does an Exclusive create. - As was the norm for NFSv3, the FreeBSD server stores the create_verifier = for this exclusive create in the atime field of the newly created file, so it can = be checked for a retry of the exclusive create. --> For NFSv3, it was required that a client follow an exclusive create w= ith a Setattr of atime to fix the atime. It turns out that, for NFSv4, the client is not required to do the Setattr = of atime. (The FreeBSD client does do this and I think older Linux NFSv4 clients did.= ) --> This Linux client follows the exclusive create with a Setattr, but only= for the "mode" attribute, leaving the create_verifier in the atime field. I can think of two ways to fix this: 1 - Make the Setattr set atime whenever it sets any other attribute. --> This would result in atime being set for changes to the file's met= adata, which is not what atime is supposed to do. (Yuck!) 2 - For NFSv4, store the create_verifier in an extended attribute instead o= f atime. --> I think this would work, but it would imply that only file systems= that support extended attributes (UFS, ZFS, ??) could be exported to NFSv4 cl= ients. Anyone have other ideas w.r.t. how to fix this? Does restricting NFSv4 exports to file systems that support extended attrib= utes sound reasonable? Thanks for any comments w.r.t. this, rick=