diff options
author | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2018-05-04 16:22:48 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-05-31 15:02:16 -0400 |
commit | fb91fb0ee7b266ed0344515c048f57ac65cdb4b4 (patch) | |
tree | 658910cabf1cc7b865056840336aa36a3582b470 | |
parent | e04bbf6b1bbe34e1baa2fa34c8774ba152f0426d (diff) |
NFS: Move call to nfs4_state_protect_write() to nfs4_write_setup()
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>
-rw-r--r-- | fs/nfs/nfs3proc.c | 3 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 4 | ||||
-rw-r--r-- | fs/nfs/proc.c | 3 | ||||
-rw-r--r-- | fs/nfs/write.c | 5 | ||||
-rw-r--r-- | include/linux/nfs_xdr.h | 3 |
5 files changed, 10 insertions, 8 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index eadf1ab31d16..3ffaff471592 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c | |||
@@ -823,7 +823,8 @@ static int nfs3_write_done(struct rpc_task *task, struct nfs_pgio_header *hdr) | |||
823 | } | 823 | } |
824 | 824 | ||
825 | static void nfs3_proc_write_setup(struct nfs_pgio_header *hdr, | 825 | static void nfs3_proc_write_setup(struct nfs_pgio_header *hdr, |
826 | struct rpc_message *msg) | 826 | struct rpc_message *msg, |
827 | struct rpc_clnt **clnt) | ||
827 | { | 828 | { |
828 | msg->rpc_proc = &nfs3_procedures[NFS3PROC_WRITE]; | 829 | msg->rpc_proc = &nfs3_procedures[NFS3PROC_WRITE]; |
829 | } | 830 | } |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b71757e85066..09be575e9194 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -4979,7 +4979,8 @@ bool nfs4_write_need_cache_consistency_data(struct nfs_pgio_header *hdr) | |||
4979 | } | 4979 | } |
4980 | 4980 | ||
4981 | static void nfs4_proc_write_setup(struct nfs_pgio_header *hdr, | 4981 | static void nfs4_proc_write_setup(struct nfs_pgio_header *hdr, |
4982 | struct rpc_message *msg) | 4982 | struct rpc_message *msg, |
4983 | struct rpc_clnt **clnt) | ||
4983 | { | 4984 | { |
4984 | struct nfs_server *server = NFS_SERVER(hdr->inode); | 4985 | struct nfs_server *server = NFS_SERVER(hdr->inode); |
4985 | 4986 | ||
@@ -4996,6 +4997,7 @@ static void nfs4_proc_write_setup(struct nfs_pgio_header *hdr, | |||
4996 | 4997 | ||
4997 | msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE]; | 4998 | msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE]; |
4998 | nfs4_init_sequence(&hdr->args.seq_args, &hdr->res.seq_res, 1); | 4999 | nfs4_init_sequence(&hdr->args.seq_args, &hdr->res.seq_res, 1); |
5000 | nfs4_state_protect_write(server->nfs_client, clnt, msg, hdr); | ||
4999 | } | 5001 | } |
5000 | 5002 | ||
5001 | static void nfs4_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit_data *data) | 5003 | static void nfs4_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit_data *data) |
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 4e93d6308733..aaad337962d0 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -618,7 +618,8 @@ static int nfs_write_done(struct rpc_task *task, struct nfs_pgio_header *hdr) | |||
618 | } | 618 | } |
619 | 619 | ||
620 | static void nfs_proc_write_setup(struct nfs_pgio_header *hdr, | 620 | static void nfs_proc_write_setup(struct nfs_pgio_header *hdr, |
621 | struct rpc_message *msg) | 621 | struct rpc_message *msg, |
622 | struct rpc_clnt **clnt) | ||
622 | { | 623 | { |
623 | /* Note: NFSv2 ignores @stable and always uses NFS_FILE_SYNC */ | 624 | /* Note: NFSv2 ignores @stable and always uses NFS_FILE_SYNC */ |
624 | hdr->args.stable = NFS_FILE_SYNC; | 625 | hdr->args.stable = NFS_FILE_SYNC; |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 0193053bc139..b633583ca268 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -1375,12 +1375,9 @@ static void nfs_initiate_write(struct nfs_pgio_header *hdr, | |||
1375 | int priority = flush_task_priority(how); | 1375 | int priority = flush_task_priority(how); |
1376 | 1376 | ||
1377 | task_setup_data->priority = priority; | 1377 | task_setup_data->priority = priority; |
1378 | rpc_ops->write_setup(hdr, msg); | 1378 | rpc_ops->write_setup(hdr, msg, &task_setup_data->rpc_client); |
1379 | trace_nfs_initiate_write(hdr->inode, hdr->io_start, hdr->good_bytes, | 1379 | trace_nfs_initiate_write(hdr->inode, hdr->io_start, hdr->good_bytes, |
1380 | hdr->args.stable); | 1380 | hdr->args.stable); |
1381 | |||
1382 | nfs4_state_protect_write(NFS_SERVER(hdr->inode)->nfs_client, | ||
1383 | &task_setup_data->rpc_client, msg, hdr); | ||
1384 | } | 1381 | } |
1385 | 1382 | ||
1386 | /* If a nfs_flush_* function fails, it should remove reqs from @head and | 1383 | /* If a nfs_flush_* function fails, it should remove reqs from @head and |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 34d28564ecf3..1009269e1a49 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -1620,7 +1620,8 @@ struct nfs_rpc_ops { | |||
1620 | struct nfs_pgio_header *); | 1620 | struct nfs_pgio_header *); |
1621 | void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *); | 1621 | void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *); |
1622 | int (*read_done)(struct rpc_task *, struct nfs_pgio_header *); | 1622 | int (*read_done)(struct rpc_task *, struct nfs_pgio_header *); |
1623 | void (*write_setup)(struct nfs_pgio_header *, struct rpc_message *); | 1623 | void (*write_setup)(struct nfs_pgio_header *, struct rpc_message *, |
1624 | struct rpc_clnt **); | ||
1624 | int (*write_done)(struct rpc_task *, struct nfs_pgio_header *); | 1625 | int (*write_done)(struct rpc_task *, struct nfs_pgio_header *); |
1625 | void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *); | 1626 | void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *); |
1626 | void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *); | 1627 | void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *); |