]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
NFS: Move call to nfs4_state_protect_write() to nfs4_write_setup()
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 4 May 2018 20:22:48 +0000 (16:22 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 31 May 2018 19:02:16 +0000 (15:02 -0400)
This doesn't really need to be in the generic NFS client code, and I
think it makes more sense to keep the v4 code in one place.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs3proc.c
fs/nfs/nfs4proc.c
fs/nfs/proc.c
fs/nfs/write.c
include/linux/nfs_xdr.h

index eadf1ab31d1666c7ce462b56d8f00ae80de7650a..3ffaff4715925d174e71c0fe42a45e7ee796ee0c 100644 (file)
@@ -823,7 +823,8 @@ static int nfs3_write_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
 }
 
 static void nfs3_proc_write_setup(struct nfs_pgio_header *hdr,
-                                 struct rpc_message *msg)
+                                 struct rpc_message *msg,
+                                 struct rpc_clnt **clnt)
 {
        msg->rpc_proc = &nfs3_procedures[NFS3PROC_WRITE];
 }
index b71757e85066995786df12ebe2e10b5bb19c6ef9..09be575e9194b2f7e7670deae4fe3e7953e98831 100644 (file)
@@ -4979,7 +4979,8 @@ bool nfs4_write_need_cache_consistency_data(struct nfs_pgio_header *hdr)
 }
 
 static void nfs4_proc_write_setup(struct nfs_pgio_header *hdr,
-                                 struct rpc_message *msg)
+                                 struct rpc_message *msg,
+                                 struct rpc_clnt **clnt)
 {
        struct nfs_server *server = NFS_SERVER(hdr->inode);
 
@@ -4996,6 +4997,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, 1);
+       nfs4_state_protect_write(server->nfs_client, clnt, msg, hdr);
 }
 
 static void nfs4_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit_data *data)
index 4e93d63087338be524918512085c2e2f5a071cdb..aaad337962d0a7c69db2cef07132c5420fc3ca20 100644 (file)
@@ -618,7 +618,8 @@ static int nfs_write_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
 }
 
 static void nfs_proc_write_setup(struct nfs_pgio_header *hdr,
-                                struct rpc_message *msg)
+                                struct rpc_message *msg,
+                                struct rpc_clnt **clnt)
 {
        /* Note: NFSv2 ignores @stable and always uses NFS_FILE_SYNC */
        hdr->args.stable = NFS_FILE_SYNC;
index 0193053bc139d3228602d589dbb643206e970dba..b633583ca2683271910e01208c2cf6e967790453 100644 (file)
@@ -1375,12 +1375,9 @@ static void nfs_initiate_write(struct nfs_pgio_header *hdr,
        int priority = flush_task_priority(how);
 
        task_setup_data->priority = priority;
-       rpc_ops->write_setup(hdr, msg);
+       rpc_ops->write_setup(hdr, msg, &task_setup_data->rpc_client);
        trace_nfs_initiate_write(hdr->inode, hdr->io_start, hdr->good_bytes,
                                 hdr->args.stable);
-
-       nfs4_state_protect_write(NFS_SERVER(hdr->inode)->nfs_client,
-                                &task_setup_data->rpc_client, msg, hdr);
 }
 
 /* If a nfs_flush_* function fails, it should remove reqs from @head and
index 34d28564ecf37e59f1b3d6a8a370ee8257c3e0a2..1009269e1a49f80396756a059e66c20feb105acd 100644 (file)
@@ -1620,7 +1620,8 @@ struct nfs_rpc_ops {
                                    struct nfs_pgio_header *);
        void    (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
        int     (*read_done)(struct rpc_task *, struct nfs_pgio_header *);
-       void    (*write_setup)(struct nfs_pgio_header *, struct rpc_message *);
+       void    (*write_setup)(struct nfs_pgio_header *, struct rpc_message *,
+                               struct rpc_clnt **);
        int     (*write_done)(struct rpc_task *, struct nfs_pgio_header *);
        void    (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
        void    (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);