From e0266694b581d23df8040ccfa9b7b25e4545e25e Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Mon, 1 Sep 2025 20:29:50 +0800 Subject: [PATCH] NFSv4: Fail mounts if the lease setup times out mainline inclusion from mainline-v6.12-rc1 commit af94dca79b1296a6db7b8b47cd43be8e94fce8bb category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICMK5J Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=af94dca79b1296a6db7b8b47cd43be8e94fce8bb -------------------------------- If the server is down when the client is trying to mount, so that the calls to exchange_id or create_session fail, then we should allow the mount system call to fail rather than hang and block other mount/umount calls. Reported-by: Oleksandr Tymoshenko Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Conflicts: fs/nfs/nfs4state.c [Commit 67e7b52d44e3 ("NFSv4: Ensure state recovery handles ETIMEDOUT correctly") removed -ETIMEDOUT from nfs4_handle_reclaim_lease_error.] Signed-off-by: Li Lingfeng --- fs/nfs/nfs4state.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 4a06e5ae0cba..5411847cb820 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -1955,9 +1955,13 @@ static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status) nfs_mark_client_ready(clp, -EPERM); clear_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state); return -EPERM; + case -ETIMEDOUT: + if (clp->cl_cons_state == NFS_CS_SESSION_INITING) { + nfs_mark_client_ready(clp, -EIO); + return -EIO; + } case -EACCES: case -NFS4ERR_DELAY: - case -ETIMEDOUT: case -EAGAIN: ssleep(1); break; -- Gitee