Skip to content

Commit fb91fb0

Browse files
amschuma-ntapTrond Myklebust
authored andcommitted
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 <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent e04bbf6 commit fb91fb0

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

fs/nfs/nfs3proc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,8 @@ static int nfs3_write_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
823823
}
824824

825825
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)
827828
{
828829
msg->rpc_proc = &nfs3_procedures[NFS3PROC_WRITE];
829830
}

fs/nfs/nfs4proc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4979,7 +4979,8 @@ bool nfs4_write_need_cache_consistency_data(struct nfs_pgio_header *hdr)
49794979
}
49804980

49814981
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)
49834984
{
49844985
struct nfs_server *server = NFS_SERVER(hdr->inode);
49854986

@@ -4996,6 +4997,7 @@ static void nfs4_proc_write_setup(struct nfs_pgio_header *hdr,
49964997

49974998
msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE];
49984999
nfs4_init_sequence(&hdr->args.seq_args, &hdr->res.seq_res, 1);
5000+
nfs4_state_protect_write(server->nfs_client, clnt, msg, hdr);
49995001
}
50005002

50015003
static void nfs4_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit_data *data)

fs/nfs/proc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,8 @@ static int nfs_write_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
618618
}
619619

620620
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)
622623
{
623624
/* Note: NFSv2 ignores @stable and always uses NFS_FILE_SYNC */
624625
hdr->args.stable = NFS_FILE_SYNC;

fs/nfs/write.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,12 +1375,9 @@ static void nfs_initiate_write(struct nfs_pgio_header *hdr,
13751375
int priority = flush_task_priority(how);
13761376

13771377
task_setup_data->priority = priority;
1378-
rpc_ops->write_setup(hdr, msg);
1378+
rpc_ops->write_setup(hdr, msg, &task_setup_data->rpc_client);
13791379
trace_nfs_initiate_write(hdr->inode, hdr->io_start, hdr->good_bytes,
13801380
hdr->args.stable);
1381-
1382-
nfs4_state_protect_write(NFS_SERVER(hdr->inode)->nfs_client,
1383-
&task_setup_data->rpc_client, msg, hdr);
13841381
}
13851382

13861383
/* If a nfs_flush_* function fails, it should remove reqs from @head and

include/linux/nfs_xdr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,8 @@ struct nfs_rpc_ops {
16201620
struct nfs_pgio_header *);
16211621
void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
16221622
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 **);
16241625
int (*write_done)(struct rpc_task *, struct nfs_pgio_header *);
16251626
void (*commit_setup) (struct nfs_commit_data *, struct rpc_message *);
16261627
void (*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);

0 commit comments

Comments
 (0)