From owner-freebsd-fs@freebsd.org Thu Apr 29 14:39:19 2021 Return-Path: Delivered-To: freebsd-fs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C19162B2B2 for ; Thu, 29 Apr 2021 14:39:19 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-QB1-obe.outbound.protection.outlook.com (mail-qb1can01on0625.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5c::625]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FWJ6Z043Lz4kRX for ; Thu, 29 Apr 2021 14:39:17 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B54O3novzPMeWGLwbQtsEw9qqJavuvbSRt4MnQ+wKkw/UtXbfWt3DPluuN48sx1yMZtw6wUY08KWuD7SbJcMsh+8bfx/lKb9AAXPqqlhhGrNdd6UkN78VtvMY0ATjH0CuMJFySZFMPm7F+fxMX3tq01rliTWjB7ZI5pB0ZCEIf8YtfCYNu803Wrr7kf1ODCH4OlD8gUTbmIYAuKAGYKAgT59KvSWcnYZlvMkDzTqaRiGXBIDE3BOMvQdZQmJtIdU4rL5198chu183gGbuiE2kEnOw318LOSOvrXRIaIRTLoeEW6JW7eFyGp6NJhKPk+lKe/Qmh3aUOF3OpF7zSSE7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sQEre/RAytbQeIdNfm1XpWwP3nNcZ7vO4UbskwG8AJ0=; b=cYRiJt9Bm3cdj0qFscpSjkmaPCr61HxH8prJNp1C/ma2UUbVbzxZZuDZ5O6oRscupT7ZUi9nFQDTodOD51yaT0EyhGYSxsOi2cNXbod0gdDL/b1L5D+RePowbIWy0mFtpUx+4R0O4kOJTIjOXQZUpvsX+VF1057rcXZ9oT4b4mDaV3EcO/Qp/E8LdtvL6ICPF8HFyNy9QXIuFfIT18jZ9qhuNOtXjqRUCyiVY5NTFBwI0KejgKnKVe7m9qVWB30+9enygiO9xK+8/9yJyqyKjStxCMz3XmAO4QY5TPEa7FO5W8VxMieCGHU9maSzulQ4uDjz1tF3Kra9gNSP4tjplA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uoguelph.ca; dmarc=pass action=none header.from=uoguelph.ca; dkim=pass header.d=uoguelph.ca; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uoguelph.ca; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sQEre/RAytbQeIdNfm1XpWwP3nNcZ7vO4UbskwG8AJ0=; b=CNuR6GOJzD2AYdAPRi5ESZajSTIZHa05feuer0jcLG1SAyyB3CX2ZGHqywqZHOnh7g+MVi4SgRlBGp3od+wFxfbyor0D+dKHvw1aSXnB8KzstR9NHVeVAwg/GHWvWNWuZSWM47KjGsgbSHpPg0Cv+MPVWB+VRxFbOZhvhXWyFqW48A2r1JKheIzIFwenoJOs8fcZT1jUYTk2tqShnWyX5iOhkx4QIr7Jv5nzyfUr9jztIzjh0XAUEu098brjArUqT6uMopWnT7d1dXwfLD8pc5rHbBgXS889lerldE6D7FhVeD2hHaSgqQJwXBAUiH6WStpwrifRsCcFZyxi48T7qA== Received: from YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:19::29) by YQXPR01MB3590.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:46::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.25; Thu, 29 Apr 2021 14:39:15 +0000 Received: from YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM ([fe80::1c05:585a:132a:f08e]) by YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM ([fe80::1c05:585a:132a:f08e%4]) with mapi id 15.20.4065.027; Thu, 29 Apr 2021 14:39:10 +0000 From: Rick Macklem To: "N.J. Mann" , "freebsd-fs@freebsd.org" Subject: Re: readdir() -> d_type always zero on NFS v3 mounted filesystems Thread-Topic: readdir() -> d_type always zero on NFS v3 mounted filesystems Thread-Index: AQHXPNEVpMPpA4XUr0WbMbVrubCkgqrLh/S4 Date: Thu, 29 Apr 2021 14:39:10 +0000 Message-ID: References: <2E84A420CCC10A73504624DE@triton.njm.me.uk> In-Reply-To: <2E84A420CCC10A73504624DE@triton.njm.me.uk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 50c4a044-05c5-447f-d4ca-08d90b1c8d21 x-ms-traffictypediagnostic: YQXPR01MB3590: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4941; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 4//DHJYSCeNaSZT3dkUjvlCI0Ifxn1YYedTK9ZDtzZl+uECsVhJYpjf53t9WQdrScQntU2E8BWB7exzxkCsH8xWkxYOlXDmmFR8LksT+g4K+eegLKuP0Rd7/Yvn0QPJsv2R2pNAGx+qVJcuD4XlMdu5C14cN3QJUpstCncPDfVDmZKMZh2ieVz7joBj9nyut6zU7ae4c1vXYpssxSpNSaz3Empi53leruakxU28P68XxMuiwfbsQFy7v6M/etYQYCiaRdrx6p6rw0jSoEffKhUhd/JKqC32vaXKx9vLDTjva4mJ0L5GIaYJWzazG6oi12H0xaLM+HIB7M1GeR06aosw9GYS/MFr06kwdPVv+sd8nO3A7Y8EJKBl+I7XVFy4ONmLQW4F7P5ND5Itg++zfwI2uU7yYPLbUJRIhovToZUEEE73hf6+altna0dH0/ve+tk9oosGkyJkhzm1nyVZ+WQ3Q+E6sbXbQB0eldLpUARUzSRRLh4g8AfALaxQJgKzB0Qf7TiUU/jwUvl/6ikJuOXl6XBo034QR8OMSWR74DZBwC4GV5oCk9f8ekS8BGHypGA/7lHhI8xGIrSNzgEW5PfnP6622t0FIEuNJF8hqLrxgDsouf890DaE/nlFlzXZwaCXOQZfmrOFm79bYbMa9qPyAvAMe8ofMOTFwNEvu/hvZ5eeeTkYtmFmyEhJSvxx2 x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(376002)(366004)(136003)(396003)(39850400004)(346002)(186003)(76116006)(7696005)(66476007)(66446008)(66556008)(6506007)(122000001)(38100700002)(64756008)(91956017)(66946007)(8936002)(83380400001)(8676002)(786003)(110136005)(316002)(478600001)(71200400001)(9686003)(55016002)(86362001)(33656002)(52536014)(2906002)(5660300002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-8859-1?Q?6SIIzpRGVX1gGSqaCiKdpml8f8Z/KMZCPU+kZeR4JYmu/VgMYx520j8heR?= =?iso-8859-1?Q?FVNznXSj/FlULHZ6kZ66r5/tofAogU4ERqUs4xtH2Rg75C0t/d4XSCKQAL?= =?iso-8859-1?Q?cBCJg/dFzT8O6kNvp2daLxHS3XK/lT+oJdrmqQ6w2d1eXfu60iKXCFXOb1?= =?iso-8859-1?Q?4ukrEaXeVWao99Pa5gWt7ifdq3xm6XhNtFfuCqDiKL0+fIkjnqqqsR5+Zb?= =?iso-8859-1?Q?xemELzh063pgrN3ETPvaX1TqBj4xgQR5PPwRvYgTjj7ntWBd3mOlAmXqA0?= =?iso-8859-1?Q?3462yaKA6SY1PGBzvyEYGw11BAIb6fcmOfiMiDmUH7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x66MVQSA9DptkfniyP+cwwoS6p7e8Ejuem9?= =?iso-8859-1?Q?/ObSfmtSwXU+XsawolDoBMKAg/Jznf7X0tMKmrB8QyVLjqv+a1wbTFEYfy?= =?iso-8859-1?Q?mOBq++i+qFbDzn1DpQGgxaORD/8R5epcWoUUiJljTj8+7v/moLAmpX6Sbz?= =?iso-8859-1?Q?wShDxF9ekKS1i4IIKYhMC8R1yZgWua31e7wyTRmiu7OIerSCHWn8kkv9Dp?= =?iso-8859-1?Q?4Vl98IUNIWE/1NQs?= x-ms-exchange-transport-forked: True 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-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 50c4a044-05c5-447f-d4ca-08d90b1c8d21 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Apr 2021 14:39:10.3510 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: wbTw8qCOh3JT9Z23JAsqal/986IzFrr7w3uQd5pduTKI+SLWE0trfDQOy+goi1IDZaoIKIo3ahCSwJ7qodKiRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YQXPR01MB3590 X-Rspamd-Queue-Id: 4FWJ6Z043Lz4kRX X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=uoguelph.ca header.s=selector1 header.b=CNuR6GOJ; arc=pass (microsoft.com:s=arcselector9901:i=1); dmarc=pass (policy=none) header.from=uoguelph.ca; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 2a01:111:f400:fe5c::625 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-6.00 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a01:111:f400:fe5c::625:from]; R_DKIM_ALLOW(-0.20)[uoguelph.ca:s=selector1]; FREEFALL_USER(0.00)[rmacklem]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a01:111:f400::/48]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DWL_DNSWL_LOW(-1.00)[uoguelph.ca:dkim]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; SPAMHAUS_ZRD(0.00)[2a01:111:f400:fe5c::625:from:127.0.2.255]; DKIM_TRACE(0.00)[uoguelph.ca:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[uoguelph.ca,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:8075, ipnet:2a01:111:f000::/36, country:US]; ARC_ALLOW(-1.00)[microsoft.com:s=arcselector9901:i=1]; MAILMAN_DEST(0.00)[freebsd-fs] X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Apr 2021 14:39:19 -0000 N.J. Mann wrote:=0A= >I recently changed over from using svn to gitup to update /usr/ports=0A= >on my local system and have been experiencing problems since. At first=0A= >either a kernel issue or a configuration issue. I originally posted=0A= >about the problem to the freebsd-ports mailing list:=0A= >https://lists.freebsd.org/pipermail/freebsd-ports/2021-April/120929.html= =0A= >=0A= >Since then I have dug deeper and come to the conclusion that it is not a= =0A= >problem with gitup.=0A= >=0A= >The issue I am seeing is that gitup is unable to delete files and=0A= >directories, even complete ports, which have been removed from the=0A= >repository. gitup basically does the following:=0A= >=0A= >prune_tree(base_path)=0A= >{=0A= >if ((directory =3D opendir(base_path)) !=3D NULL) {=0A= > while ((entry =3D readdir(directory)) !=3D NULL) {=0A= > snprintf(full_path, sizeof(full_path), "%s/%s", base_path, entry->= d_name);=0A= > if (entry->d_type =3D=3D DT_DIR) {=0A= > prune_tree(full_path);=0A= > } else {=0A= > if ((remove(full_path) !=3D 0) && (errno !=3D ENOENT))=0A= > err(EXIT_FAILURE, "prune_tree: cannot remove %s", full_pa= th);=0A= > }=0A= > }=0A= > closedir(directory);=0A= > if (rmdir(base_path) !=3D 0)=0A= > err(EXIT_FAILURE, "prune_tree: cannot remove %s", base_path);= =0A= > }=0A= >}=0A= =0A= The code should check for d_type =3D=3D DT_UNKNOWN and then do=0A= stat() to find out the type, as Ronald noted.=0A= --> The d_type is normally filled in if you use the "rdirplus"=0A= NFS mount option, which might work around the issue.=0A= =0A= rick=0A= =0A= closedir()=0A= =0A= =0A= When gitup is run on either a UFS or ZFS file system this works. However,= =0A= when I run it on a NFS v3 mounted filesystem it fails. Liberal addition=0A= of printf's shows that for non-NFS mounted filesystems d_type contains the= =0A= correct value for each file/directory, but for NFS mounted file systems it= =0A= is zero - other fields such as d_name and d_namlen are correct. While=0A= debugging this I added a call to stat() and that always returns the correct= =0A= values.=0A= =0A= At this point I started digging in libc and quickly found that readdir()=0A= is basically a wrapper around a system call. Digging in the kernel I=0A= quickly got out of my depth and hence my posting here. I then wrote a=0A= simple test programme which also shows the issue. I have attached the=0A= source for the test programme and the output from two runs, the first on=0A= an NFS mounted file system and the second on a local UFS file system.=0A= =0A= Before gitup started failing I had not seen any failures like this and that= =0A= was why I initially assumed this must be a gitup issue. I now believe this= =0A= is either a kernel issue or a confuration issue.=0A= =0A= My configuration is as follows:=0A= =0A= file server:=0A= /exports/ports - ZFS file system for FreeBSD ports repo exported via NFS= =0A= /remote/ports - FreeBSD ports repo NFS (v3 rw,tcp) mounted from /export/= ports=0A= on file server=0A= /usr/ports - symbolic link to /remote/ports=0A= client machines:=0A= /remote/ports - FreeBSD ports repo NFS (v3 ro,tcp) mounted from /export/= ports=0A= on file server=0A= /usr/ports - symbolic link to /remote/ports=0A= =0A= I run gitup in /remote/ports on the file server and then pkg, portmaster, &= .c,=0A= in /usr/ports on the file server and then the client machines. All systems= are=0A= running 11-STABLE from about 12 days ago - I usually update every couple of= weeks.=0A= =0A= Any assistance, suggestions, patches, clue bats, will be gratefully accepte= d.=0A= =0A= =0A= Regards,=0A= Nick.=0A= --=0A=