]> www.infradead.org Git - users/hch/configfs.git/commitdiff
NFSv4.1: fix SP4_MACH_CRED protection for pnfs IO
authorOlga Kornievskaia <kolga@netapp.com>
Fri, 13 Oct 2023 15:04:10 +0000 (11:04 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 1 Nov 2023 19:40:44 +0000 (15:40 -0400)
If the client is doing pnfs IO and Kerberos is configured and EXCHANGEID
successfully negotiated SP4_MACH_CRED and WRITE/COMMIT are on the
list of state protected operations, then we need to make sure to
choose the DS's rpc_client structure instead of the MDS's one.

Fixes: fb91fb0ee7b2 ("NFS: Move call to nfs4_state_protect_write() to nfs4_write_setup()")
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs4proc.c

index b4b583be6f5e395cbb853414ce63cbeef7511dff..b36193edc3ba8f9b5b1ef589b4f757d099129be1 100644 (file)
@@ -5647,7 +5647,7 @@ static void nfs4_proc_write_setup(struct nfs_pgio_header *hdr,
 
        msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE];
        nfs4_init_sequence(&hdr->args.seq_args, &hdr->res.seq_res, 0, 0);
-       nfs4_state_protect_write(server->nfs_client, clnt, msg, hdr);
+       nfs4_state_protect_write(hdr->ds_clp ? hdr->ds_clp : server->nfs_client, clnt, msg, hdr);
 }
 
 static void nfs4_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit_data *data)
@@ -5688,7 +5688,8 @@ static void nfs4_proc_commit_setup(struct nfs_commit_data *data, struct rpc_mess
        data->res.server = server;
        msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT];
        nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1, 0);
-       nfs4_state_protect(server->nfs_client, NFS_SP4_MACH_CRED_COMMIT, clnt, msg);
+       nfs4_state_protect(data->ds_clp ? data->ds_clp : server->nfs_client,
+                       NFS_SP4_MACH_CRED_COMMIT, clnt, msg);
 }
 
 static int _nfs4_proc_commit(struct file *dst, struct nfs_commitargs *args,