Linux NFS development
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@kernel.org>
To: Jon Hunter <jonathanh@nvidia.com>,
	Anna Schumaker <anna@kernel.org>,
	 linux-nfs@vger.kernel.org
Cc: "linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH 2/5] NFS: Request a directory delegation on ACCESS, CREATE, and UNLINK
Date: Wed, 03 Dec 2025 11:23:54 -0500	[thread overview]
Message-ID: <ba1a5563fd66738156a372eed016986952f11fd5.camel@kernel.org> (raw)
In-Reply-To: <bfe61da1-3b52-49a4-844d-6f39d7ca4e9d@nvidia.com>

Hi Jon,

On Wed, 2025-12-03 at 15:56 +0000, Jon Hunter wrote:
> 
> On 02/12/2025 16:01, Jon Hunter wrote:
> > Hi Anna,
> > 
> > On 04/11/2025 15:06, Anna Schumaker wrote:
> > > From: Anna Schumaker <anna.schumaker@oracle.com>
> > > 
> > > This patch adds a new flag: NFS_INO_REQ_DIR_DELEG to signal that
> > > a
> > > directory wants to request a directory delegation the next time
> > > it does
> > > a GETATTR. I have the client request a directory delegation when
> > > doing
> > > an access, create, or unlink call since these calls indicate that
> > > a user
> > > is working with a directory.
> > > 
> > > Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
> > 
> > 
> > We use NFS for boot testing our boards and once this commit landed
> > in - 
> > next a lot of them, but no all, started failing to boot. Bisect is 
> > pointing to this change.
> > 
> > We have a custom init script that runs to mount the rootfs and I
> > see 
> > that it displays ...
> > 
> > [   10.238091] Run /init as init process
> > [   10.266026] ERROR: mounting debugfs fail...
> > [   10.286535] Root device found: nfs
> > [   10.300342] Ethernet interface: eth0
> > [   10.313920] IP Address: 192.168.99.2
> > [   10.382738] Rootfs mounted over nfs
> > [   10.416010] Switching from initrd to actual rootfs
> 
> It appears that there are multiple boot issues on -next at the moment
> and the above it not the relevant part for this particular issue.
> Looking further at the logs I am seeing the following errors which
> are related to this change ...
> 
> [   11.100334] systemd[1]: Failed to open directory
> /etc/systemd/system, ignoring: Unknown error 524
> [   11.119234] systemd[1]: Failed to open directory
> /lib/systemd/system, ignoring: Unknown error 524
> [   11.143487] systemd[1]: Failed to load default target: No such
> file or directory
> [   11.158620] systemd[1]: Trying to load rescue target...
> [   11.169388] systemd[1]: Failed to load rescue target: No such file
> or directory
> [   11.188856] systemd[1]: Freezing execution.
> 
> Thanks
> Jon

Does the following patch fix it for you?

8<---------------------------------------------
From 849bdbd3a2136a86c809ce6a7fa6ae30e9f0728a Mon Sep 17 00:00:00 2001
Message-ID: <849bdbd3a2136a86c809ce6a7fa6ae30e9f0728a.1764778907.git.trond.myklebust@hammerspace.com>
From: Trond Myklebust <trond.myklebust@hammerspace.com>
Date: Wed, 3 Dec 2025 11:17:25 -0500
Subject: [PATCH] NFSv4: Handle NFS4ERR_NOTSUPP errors for directory
 delegations

The error NFS4ERR_NOTSUPP will be returned for operations that are
legal, but not supported by the server.

Fixes: 156b09482933 ("NFS: Request a directory delegation on ACCESS, CREATE, and UNLINK")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/nfs4proc.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index c53ddb185aa3..ec1ce593dea2 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4533,12 +4533,17 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
 	status = nfs4_do_call_sync(server->client, server, &msg,
 				   &args.seq_args, &res.seq_res, task_flags);
 	if (args.get_dir_deleg) {
-		if (status == -EOPNOTSUPP) {
+		switch (status) {
+		case 0:
+			if (gdd_res.status != GDD4_OK)
+				break;
+			status = nfs_inode_set_delegation(
+				inode, current_cred(), FMODE_READ,
+				&gdd_res.deleg, 0, NFS4_OPEN_DELEGATE_READ);
+			break;
+		case -ENOTSUPP:
+		case -EOPNOTSUPP:
 			server->caps &= ~NFS_CAP_DIR_DELEG;
-		} else if (status == 0 && gdd_res.status == GDD4_OK) {
-			status = nfs_inode_set_delegation(inode, current_cred(),
-							  FMODE_READ, &gdd_res.deleg,
-							  0, NFS4_OPEN_DELEGATE_READ);
 		}
 	}
 	return status;
@@ -4554,10 +4559,14 @@ int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
 	do {
 		err = _nfs4_proc_getattr(server, fhandle, fattr, inode);
 		trace_nfs4_getattr(server, fhandle, fattr, err);
-		if (err == -EOPNOTSUPP)
-			exception.retry = true;
-		else
+		switch (err) {
+		default:
 			err = nfs4_handle_exception(server, err, &exception);
+			break;
+		case -ENOTSUPP:
+		case -EOPNOTSUPP:
+			exception.retry = true;
+		}
 	} while (exception.retry);
 	return err;
 }
-- 
2.52.0


-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trondmy@kernel.org, trond.myklebust@hammerspace.com

  reply	other threads:[~2025-12-03 16:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04 15:06 [PATCH 0/5] NFS: Client Side Directory Delegations Anna Schumaker
2025-11-04 15:06 ` [PATCH 1/5] NFS: Add support for sending GDD_GETATTR Anna Schumaker
2025-11-04 15:06 ` [PATCH 2/5] NFS: Request a directory delegation on ACCESS, CREATE, and UNLINK Anna Schumaker
2025-12-02 16:01   ` Jon Hunter
2025-12-03 15:56     ` Jon Hunter
2025-12-03 16:23       ` Trond Myklebust [this message]
2025-12-03 21:06         ` Jon Hunter
2025-12-03 23:19           ` Trond Myklebust
2025-11-04 15:06 ` [PATCH 3/5] NFS: Request a directory delegation during RENAME Anna Schumaker
2025-11-04 15:06 ` [PATCH 4/5] NFS: Shortcut lookup revalidations if we have a directory delegation Anna Schumaker
2025-11-04 15:06 ` [PATCH 5/5] NFS: Add a module option to disable directory delegations Anna Schumaker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba1a5563fd66738156a372eed016986952f11fd5.camel@kernel.org \
    --to=trondmy@kernel.org \
    --cc=anna@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox