All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] NFS: A few small NFSv4 cleanups
@ 2018-05-04 20:22 schumaker.anna
  2018-05-04 20:22 ` [PATCH 1/5] NFS: Move call to nfs4_state_protect_write() to nfs4_write_setup() schumaker.anna
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: schumaker.anna @ 2018-05-04 20:22 UTC (permalink / raw)
  To: Trond.Myklebust, linux-nfs

From: Anna Schumaker <Anna.Schumaker@Netapp.com>

These patches are a few cleanups I noticed while poking through the
code.  The first two move calls to nfs4_state_protect() into the v4
module and the last three are cleanups to the nfs4_call_sync() process.

Thoughts?
Anna

Anna Schumaker (5):
  NFS: Move call to nfs4_state_protect_write() to nfs4_write_setup()
  NFS: Move call to nfs4_state_protect() to nfs4_commit_setup()
  NFS: Pass "privileged" value to nfs4_init_sequence()
  NFS: Pass "privileged" value to nfs4_call_sync()
  NFS: Combine nfs4_call_sync() with nfs4_call_sync_sequence()

 fs/nfs/nfs3proc.c       |   6 +-
 fs/nfs/nfs42proc.c      |  10 +--
 fs/nfs/nfs4_fs.h        |   4 +-
 fs/nfs/nfs4proc.c       | 174 +++++++++++++++++-----------------------
 fs/nfs/proc.c           |   6 +-
 fs/nfs/write.c          |  10 +--
 include/linux/nfs_xdr.h |   6 +-
 7 files changed, 94 insertions(+), 122 deletions(-)

-- 
2.17.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/5] NFS: Move call to nfs4_state_protect_write() to nfs4_write_setup()
  2018-05-04 20:22 [PATCH 0/5] NFS: A few small NFSv4 cleanups schumaker.anna
@ 2018-05-04 20:22 ` schumaker.anna
  2018-05-04 20:22 ` [PATCH 2/5] NFS: Move call to nfs4_state_protect() to nfs4_commit_setup() schumaker.anna
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: schumaker.anna @ 2018-05-04 20:22 UTC (permalink / raw)
  To: Trond.Myklebust, linux-nfs

From: Anna Schumaker <Anna.Schumaker@Netapp.com>

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>
---
 fs/nfs/nfs3proc.c       | 3 ++-
 fs/nfs/nfs4proc.c       | 4 +++-
 fs/nfs/proc.c           | 3 ++-
 fs/nfs/write.c          | 5 +----
 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)
 }
 
 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];
 }
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)
 }
 
 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)
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)
 }
 
 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;
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,
 	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
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 {
 				    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 *);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/5] NFS: Move call to nfs4_state_protect() to nfs4_commit_setup()
  2018-05-04 20:22 [PATCH 0/5] NFS: A few small NFSv4 cleanups schumaker.anna
  2018-05-04 20:22 ` [PATCH 1/5] NFS: Move call to nfs4_state_protect_write() to nfs4_write_setup() schumaker.anna
@ 2018-05-04 20:22 ` schumaker.anna
  2018-05-04 20:22 ` [PATCH 3/5] NFS: Pass "privileged" value to nfs4_init_sequence() schumaker.anna
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: schumaker.anna @ 2018-05-04 20:22 UTC (permalink / raw)
  To: Trond.Myklebust, linux-nfs

From: Anna Schumaker <Anna.Schumaker@Netapp.com>

Rather than doing this in the generic NFS client code.  Let's put this
with the other v4 stuff so it's all in one place.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/nfs3proc.c       | 3 ++-
 fs/nfs/nfs4proc.c       | 4 +++-
 fs/nfs/proc.c           | 3 ++-
 fs/nfs/write.c          | 5 +----
 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 3ffaff471592..6ed6a4195906 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -845,7 +845,8 @@ static int nfs3_commit_done(struct rpc_task *task, struct nfs_commit_data *data)
 	return 0;
 }
 
-static void nfs3_proc_commit_setup(struct nfs_commit_data *data, struct rpc_message *msg)
+static void nfs3_proc_commit_setup(struct nfs_commit_data *data, struct rpc_message *msg,
+				   struct rpc_clnt **clnt)
 {
 	msg->rpc_proc = &nfs3_procedures[NFS3PROC_COMMIT];
 }
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 09be575e9194..50a067018a60 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5028,7 +5028,8 @@ static int nfs4_commit_done(struct rpc_task *task, struct nfs_commit_data *data)
 	return data->commit_done_cb(task, data);
 }
 
-static void nfs4_proc_commit_setup(struct nfs_commit_data *data, struct rpc_message *msg)
+static void nfs4_proc_commit_setup(struct nfs_commit_data *data, struct rpc_message *msg,
+				   struct rpc_clnt **clnt)
 {
 	struct nfs_server *server = NFS_SERVER(data->inode);
 
@@ -5037,6 +5038,7 @@ 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);
+	nfs4_state_protect(server->nfs_client, NFS_SP4_MACH_CRED_COMMIT, clnt, msg);
 }
 
 struct nfs4_renewdata {
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index aaad337962d0..80c350b6232a 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -632,7 +632,8 @@ static void nfs_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit
 }
 
 static void
-nfs_proc_commit_setup(struct nfs_commit_data *data, struct rpc_message *msg)
+nfs_proc_commit_setup(struct nfs_commit_data *data, struct rpc_message *msg,
+			struct rpc_clnt **clnt)
 {
 	BUG();
 }
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index b633583ca268..a057b4f45a46 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1666,14 +1666,11 @@ int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data,
 		.priority = priority,
 	};
 	/* Set up the initial task struct.  */
-	nfs_ops->commit_setup(data, &msg);
+	nfs_ops->commit_setup(data, &msg, &task_setup_data.rpc_client);
 	trace_nfs_initiate_commit(data);
 
 	dprintk("NFS: initiated commit call\n");
 
-	nfs4_state_protect(NFS_SERVER(data->inode)->nfs_client,
-		NFS_SP4_MACH_CRED_COMMIT, &task_setup_data.rpc_client, &msg);
-
 	task = rpc_run_task(&task_setup_data);
 	if (IS_ERR(task))
 		return PTR_ERR(task);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 1009269e1a49..52b481dfd61e 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1623,7 +1623,8 @@ struct nfs_rpc_ops {
 	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_setup) (struct nfs_commit_data *, struct rpc_message *,
+				struct rpc_clnt **);
 	void	(*commit_rpc_prepare)(struct rpc_task *, struct nfs_commit_data *);
 	int	(*commit_done) (struct rpc_task *, struct nfs_commit_data *);
 	int	(*lock)(struct file *, int, struct file_lock *);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/5] NFS: Pass "privileged" value to nfs4_init_sequence()
  2018-05-04 20:22 [PATCH 0/5] NFS: A few small NFSv4 cleanups schumaker.anna
  2018-05-04 20:22 ` [PATCH 1/5] NFS: Move call to nfs4_state_protect_write() to nfs4_write_setup() schumaker.anna
  2018-05-04 20:22 ` [PATCH 2/5] NFS: Move call to nfs4_state_protect() to nfs4_commit_setup() schumaker.anna
@ 2018-05-04 20:22 ` schumaker.anna
  2018-05-04 20:22 ` [PATCH 4/5] NFS: Pass "privileged" value to nfs4_call_sync() schumaker.anna
  2018-05-04 20:22 ` [PATCH 5/5] NFS: Combine nfs4_call_sync() with nfs4_call_sync_sequence() schumaker.anna
  4 siblings, 0 replies; 8+ messages in thread
From: schumaker.anna @ 2018-05-04 20:22 UTC (permalink / raw)
  To: Trond.Myklebust, linux-nfs

From: Anna Schumaker <Anna.Schumaker@Netapp.com>

We currently have a separate function just to set this, but I think it
makes more sense to set it at the same time as the other values in
nfs4_init_sequence()

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/nfs42proc.c |  2 +-
 fs/nfs/nfs4_fs.h   |  2 +-
 fs/nfs/nfs4proc.c  | 81 ++++++++++++++++++----------------------------
 3 files changed, 33 insertions(+), 52 deletions(-)

diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 9c374441f660..4d4a3df28779 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -462,7 +462,7 @@ int nfs42_proc_layoutstats_generic(struct nfs_server *server,
 		nfs42_layoutstat_release(data);
 		return -EAGAIN;
 	}
-	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 0);
+	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 0, 0);
 	task = rpc_run_task(&task_setup);
 	if (IS_ERR(task))
 		return PTR_ERR(task);
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index b374f680830c..06a41aa2fdb2 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -251,7 +251,7 @@ extern int nfs4_handle_exception(struct nfs_server *, int, struct nfs4_exception
 extern int nfs4_call_sync(struct rpc_clnt *, struct nfs_server *,
 			  struct rpc_message *, struct nfs4_sequence_args *,
 			  struct nfs4_sequence_res *, int);
-extern void nfs4_init_sequence(struct nfs4_sequence_args *, struct nfs4_sequence_res *, int);
+extern void nfs4_init_sequence(struct nfs4_sequence_args *, struct nfs4_sequence_res *, int, int);
 extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *);
 extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *);
 extern int nfs4_proc_get_rootfh(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *, bool);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 50a067018a60..6c749ce7587e 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -608,20 +608,16 @@ struct nfs4_call_sync_data {
 };
 
 void nfs4_init_sequence(struct nfs4_sequence_args *args,
-			struct nfs4_sequence_res *res, int cache_reply)
+			struct nfs4_sequence_res *res, int cache_reply,
+			int privileged)
 {
 	args->sa_slot = NULL;
 	args->sa_cache_this = cache_reply;
-	args->sa_privileged = 0;
+	args->sa_privileged = privileged;
 
 	res->sr_slot = NULL;
 }
 
-static void nfs4_set_sequence_privileged(struct nfs4_sequence_args *args)
-{
-	args->sa_privileged = 1;
-}
-
 static void nfs40_sequence_free_slot(struct nfs4_sequence_res *res)
 {
 	struct nfs4_slot *slot = res->sr_slot;
@@ -1035,7 +1031,7 @@ int nfs4_call_sync(struct rpc_clnt *clnt,
 		   struct nfs4_sequence_res *res,
 		   int cache_reply)
 {
-	nfs4_init_sequence(args, res, cache_reply);
+	nfs4_init_sequence(args, res, cache_reply, 0);
 	return nfs4_call_sync_sequence(clnt, server, msg, args, res);
 }
 
@@ -2187,13 +2183,12 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
 	};
 	int status;
 
-	nfs4_init_sequence(&data->c_arg.seq_args, &data->c_res.seq_res, 1);
+	nfs4_init_sequence(&data->c_arg.seq_args, &data->c_res.seq_res, 1,
+				data->is_recover);
 	kref_get(&data->kref);
 	data->rpc_done = false;
 	data->rpc_status = 0;
 	data->timestamp = jiffies;
-	if (data->is_recover)
-		nfs4_set_sequence_privileged(&data->c_arg.seq_args);
 	task = rpc_run_task(&task_setup_data);
 	if (IS_ERR(task))
 		return PTR_ERR(task);
@@ -2350,16 +2345,14 @@ static int nfs4_run_open_task(struct nfs4_opendata *data, int isrecover)
 	};
 	int status;
 
-	nfs4_init_sequence(&o_arg->seq_args, &o_res->seq_res, 1);
+	nfs4_init_sequence(&o_arg->seq_args, &o_res->seq_res, 1, isrecover);
 	kref_get(&data->kref);
 	data->rpc_done = false;
 	data->rpc_status = 0;
 	data->cancelled = false;
 	data->is_recover = false;
-	if (isrecover) {
-		nfs4_set_sequence_privileged(&o_arg->seq_args);
+	if (isrecover)
 		data->is_recover = true;
-	}
 	task = rpc_run_task(&task_setup_data);
 	if (IS_ERR(task))
 		return PTR_ERR(task);
@@ -3393,7 +3386,7 @@ int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait)
 	calldata = kzalloc(sizeof(*calldata), gfp_mask);
 	if (calldata == NULL)
 		goto out;
-	nfs4_init_sequence(&calldata->arg.seq_args, &calldata->res.seq_res, 1);
+	nfs4_init_sequence(&calldata->arg.seq_args, &calldata->res.seq_res, 1, 0);
 	calldata->inode = state->inode;
 	calldata->state = state;
 	calldata->arg.fh = NFS_FH(state->inode);
@@ -4273,7 +4266,7 @@ static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dentr
 
 	res->server = NFS_SB(dentry->d_sb);
 	msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE];
-	nfs4_init_sequence(&args->seq_args, &res->seq_res, 1);
+	nfs4_init_sequence(&args->seq_args, &res->seq_res, 1, 0);
 
 	nfs_fattr_init(res->dir_attr);
 
@@ -4319,7 +4312,7 @@ static void nfs4_proc_rename_setup(struct rpc_message *msg,
 		nfs4_inode_return_delegation(new_inode);
 	msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME];
 	res->server = NFS_SB(old_dentry->d_sb);
-	nfs4_init_sequence(&arg->seq_args, &res->seq_res, 1);
+	nfs4_init_sequence(&arg->seq_args, &res->seq_res, 1, 0);
 }
 
 static void nfs4_proc_rename_rpc_prepare(struct rpc_task *task, struct nfs_renamedata *data)
@@ -4895,7 +4888,7 @@ static void nfs4_proc_read_setup(struct nfs_pgio_header *hdr,
 	if (!hdr->pgio_done_cb)
 		hdr->pgio_done_cb = nfs4_read_done_cb;
 	msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ];
-	nfs4_init_sequence(&hdr->args.seq_args, &hdr->res.seq_res, 0);
+	nfs4_init_sequence(&hdr->args.seq_args, &hdr->res.seq_res, 0, 0);
 }
 
 static int nfs4_proc_pgio_rpc_prepare(struct rpc_task *task,
@@ -4996,7 +4989,7 @@ static void nfs4_proc_write_setup(struct nfs_pgio_header *hdr,
 	hdr->timestamp   = jiffies;
 
 	msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE];
-	nfs4_init_sequence(&hdr->args.seq_args, &hdr->res.seq_res, 1);
+	nfs4_init_sequence(&hdr->args.seq_args, &hdr->res.seq_res, 1, 0);
 	nfs4_state_protect_write(server->nfs_client, clnt, msg, hdr);
 }
 
@@ -5037,7 +5030,7 @@ static void nfs4_proc_commit_setup(struct nfs_commit_data *data, struct rpc_mess
 		data->commit_done_cb = nfs4_commit_done_cb;
 	data->res.server = server;
 	msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT];
-	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1);
+	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);
 }
 
@@ -5976,7 +5969,7 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co
 	data = kzalloc(sizeof(*data), GFP_NOFS);
 	if (data == NULL)
 		return -ENOMEM;
-	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1);
+	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1, 0);
 
 	nfs4_state_protect(server->nfs_client,
 			NFS_SP4_MACH_CRED_CLEANUP,
@@ -6251,7 +6244,7 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl,
 		return ERR_PTR(-ENOMEM);
 	}
 
-	nfs4_init_sequence(&data->arg.seq_args, &data->res.seq_res, 1);
+	nfs4_init_sequence(&data->arg.seq_args, &data->res.seq_res, 1, 0);
 	msg.rpc_argp = &data->arg;
 	msg.rpc_resp = &data->res;
 	task_setup_data.callback_data = data;
@@ -6513,14 +6506,14 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
 		return -ENOMEM;
 	if (IS_SETLKW(cmd))
 		data->arg.block = 1;
-	nfs4_init_sequence(&data->arg.seq_args, &data->res.seq_res, 1);
+	nfs4_init_sequence(&data->arg.seq_args, &data->res.seq_res, 1,
+				recovery_type > NFS_LOCK_NEW);
 	msg.rpc_argp = &data->arg;
 	msg.rpc_resp = &data->res;
 	task_setup_data.callback_data = data;
 	if (recovery_type > NFS_LOCK_NEW) {
 		if (recovery_type == NFS_LOCK_RECLAIM)
 			data->arg.reclaim = NFS_LOCK_RECLAIM;
-		nfs4_set_sequence_privileged(&data->arg.seq_args);
 	} else
 		data->arg.new_lock = 1;
 	task = rpc_run_task(&task_setup_data);
@@ -6915,7 +6908,7 @@ nfs4_release_lockowner(struct nfs_server *server, struct nfs4_lock_state *lsp)
 
 	msg.rpc_argp = &data->args;
 	msg.rpc_resp = &data->res;
-	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 0);
+	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 0, 0);
 	rpc_call_async(server->client, &msg, 0, &nfs4_release_lockowner_ops, data);
 }
 
@@ -7111,8 +7104,7 @@ static int _nfs40_proc_get_locations(struct inode *inode,
 	locations->server = server;
 	locations->nlocations = 0;
 
-	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0);
-	nfs4_set_sequence_privileged(&args.seq_args);
+	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
 	status = nfs4_call_sync_sequence(clnt, server, &msg,
 					&args.seq_args, &res.seq_res);
 	if (status)
@@ -7165,8 +7157,7 @@ static int _nfs41_proc_get_locations(struct inode *inode,
 	locations->server = server;
 	locations->nlocations = 0;
 
-	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0);
-	nfs4_set_sequence_privileged(&args.seq_args);
+	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
 	status = nfs4_call_sync_sequence(clnt, server, &msg,
 					&args.seq_args, &res.seq_res);
 	if (status == NFS4_OK &&
@@ -7253,8 +7244,7 @@ static int _nfs40_proc_fsid_present(struct inode *inode, struct rpc_cred *cred)
 	if (res.fh == NULL)
 		return -ENOMEM;
 
-	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0);
-	nfs4_set_sequence_privileged(&args.seq_args);
+	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
 	status = nfs4_call_sync_sequence(clnt, server, &msg,
 						&args.seq_args, &res.seq_res);
 	nfs_free_fhandle(res.fh);
@@ -7295,8 +7285,7 @@ static int _nfs41_proc_fsid_present(struct inode *inode, struct rpc_cred *cred)
 	if (res.fh == NULL)
 		return -ENOMEM;
 
-	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0);
-	nfs4_set_sequence_privileged(&args.seq_args);
+	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
 	status = nfs4_call_sync_sequence(clnt, server, &msg,
 						&args.seq_args, &res.seq_res);
 	nfs_free_fhandle(res.fh);
@@ -8074,8 +8063,7 @@ int nfs4_proc_get_lease_time(struct nfs_client *clp, struct nfs_fsinfo *fsinfo)
 	};
 	int status;
 
-	nfs4_init_sequence(&args.la_seq_args, &res.lr_seq_res, 0);
-	nfs4_set_sequence_privileged(&args.la_seq_args);
+	nfs4_init_sequence(&args.la_seq_args, &res.lr_seq_res, 0, 1);
 	task = rpc_run_task(&task_setup);
 
 	if (IS_ERR(task))
@@ -8412,10 +8400,8 @@ static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp,
 	calldata = kzalloc(sizeof(*calldata), GFP_NOFS);
 	if (calldata == NULL)
 		goto out_put_clp;
-	nfs4_init_sequence(&calldata->args, &calldata->res, 0);
+	nfs4_init_sequence(&calldata->args, &calldata->res, 0, is_privileged);
 	nfs4_sequence_attach_slot(&calldata->args, &calldata->res, slot);
-	if (is_privileged)
-		nfs4_set_sequence_privileged(&calldata->args);
 	msg.rpc_argp = &calldata->args;
 	msg.rpc_resp = &calldata->res;
 	calldata->clp = clp;
@@ -8567,8 +8553,7 @@ static int nfs41_proc_reclaim_complete(struct nfs_client *clp,
 	calldata->clp = clp;
 	calldata->arg.one_fs = 0;
 
-	nfs4_init_sequence(&calldata->arg.seq_args, &calldata->res.seq_res, 0);
-	nfs4_set_sequence_privileged(&calldata->arg.seq_args);
+	nfs4_init_sequence(&calldata->arg.seq_args, &calldata->res.seq_res, 0, 1);
 	msg.rpc_argp = &calldata->arg;
 	msg.rpc_resp = &calldata->res;
 	task_setup_data.callback_data = calldata;
@@ -8804,7 +8789,7 @@ nfs4_proc_layoutget(struct nfs4_layoutget *lgp, long *timeout, gfp_t gfp_flags)
 
 	lgp->res.layoutp = &lgp->args.layout;
 	lgp->res.seq_res.sr_slot = NULL;
-	nfs4_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0);
+	nfs4_init_sequence(&lgp->args.seq_args, &lgp->res.seq_res, 0, 0);
 
 	task = rpc_run_task(&task_setup_data);
 	if (IS_ERR(task))
@@ -8931,7 +8916,7 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync)
 		}
 		task_setup_data.flags |= RPC_TASK_ASYNC;
 	}
-	nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1);
+	nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1, 0);
 	task = rpc_run_task(&task_setup_data);
 	if (IS_ERR(task))
 		return PTR_ERR(task);
@@ -9078,7 +9063,7 @@ nfs4_proc_layoutcommit(struct nfs4_layoutcommit_data *data, bool sync)
 		}
 		task_setup_data.flags = RPC_TASK_ASYNC;
 	}
-	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1);
+	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1, 0);
 	task = rpc_run_task(&task_setup_data);
 	if (IS_ERR(task))
 		return PTR_ERR(task);
@@ -9258,8 +9243,7 @@ static int _nfs41_test_stateid(struct nfs_server *server,
 		&rpc_client, &msg);
 
 	dprintk("NFS call  test_stateid %p\n", stateid);
-	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0);
-	nfs4_set_sequence_privileged(&args.seq_args);
+	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
 	status = nfs4_call_sync_sequence(rpc_client, server, &msg,
 			&args.seq_args, &res.seq_res);
 	if (status != NFS_OK) {
@@ -9382,10 +9366,7 @@ static struct rpc_task *_nfs41_free_stateid(struct nfs_server *server,
 
 	msg.rpc_argp = &data->args;
 	msg.rpc_resp = &data->res;
-	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1);
-	if (privileged)
-		nfs4_set_sequence_privileged(&data->args.seq_args);
-
+	nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1, privileged);
 	return rpc_run_task(&task_setup);
 }
 
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/5] NFS: Pass "privileged" value to nfs4_call_sync()
  2018-05-04 20:22 [PATCH 0/5] NFS: A few small NFSv4 cleanups schumaker.anna
                   ` (2 preceding siblings ...)
  2018-05-04 20:22 ` [PATCH 3/5] NFS: Pass "privileged" value to nfs4_init_sequence() schumaker.anna
@ 2018-05-04 20:22 ` schumaker.anna
  2018-05-29 13:52   ` Trond Myklebust
  2018-05-04 20:22 ` [PATCH 5/5] NFS: Combine nfs4_call_sync() with nfs4_call_sync_sequence() schumaker.anna
  4 siblings, 1 reply; 8+ messages in thread
From: schumaker.anna @ 2018-05-04 20:22 UTC (permalink / raw)
  To: Trond.Myklebust, linux-nfs

From: Anna Schumaker <Anna.Schumaker@Netapp.com>

This lets us convert a few other users of synchronous RPC calls to the
nfs4_call_sync() function.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/nfs42proc.c |  8 ++---
 fs/nfs/nfs4_fs.h   |  2 +-
 fs/nfs/nfs4proc.c  | 78 ++++++++++++++++++++++------------------------
 3 files changed, 42 insertions(+), 46 deletions(-)

diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 4d4a3df28779..7e9a208940e2 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -47,7 +47,7 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
 		return -ENOMEM;
 
 	status = nfs4_call_sync(server->client, server, msg,
-				&args.seq_args, &res.seq_res, 0);
+				&args.seq_args, &res.seq_res, 0, 0);
 	if (status == 0)
 		status = nfs_post_op_update_inode(inode, res.falloc_fattr);
 
@@ -172,7 +172,7 @@ static ssize_t _nfs42_proc_copy(struct file *src,
 	if (!res->commit_res.verf)
 		return -ENOMEM;
 	status = nfs4_call_sync(server->client, server, &msg,
-				&args->seq_args, &res->seq_res, 0);
+				&args->seq_args, &res->seq_res, 0, 0);
 	if (status == -ENOTSUPP)
 		server->caps &= ~NFS_CAP_COPY;
 	if (status)
@@ -297,7 +297,7 @@ static loff_t _nfs42_proc_llseek(struct file *filep,
 		return status;
 
 	status = nfs4_call_sync(server->client, server, &msg,
-				&args.seq_args, &res.seq_res, 0);
+				&args.seq_args, &res.seq_res, 0, 0);
 	if (status == -ENOTSUPP)
 		server->caps &= ~NFS_CAP_SEEK;
 	if (status)
@@ -509,7 +509,7 @@ static int _nfs42_proc_clone(struct rpc_message *msg, struct file *src_f,
 		return -ENOMEM;
 
 	status = nfs4_call_sync(server->client, server, msg,
-				&args.seq_args, &res.seq_res, 0);
+				&args.seq_args, &res.seq_res, 0, 0);
 	if (status == 0)
 		status = nfs_post_op_update_inode(dst_inode, res.dst_fattr);
 
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 06a41aa2fdb2..9a2e04a422ec 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -250,7 +250,7 @@ int nfs4_replace_transport(struct nfs_server *server,
 extern int nfs4_handle_exception(struct nfs_server *, int, struct nfs4_exception *);
 extern int nfs4_call_sync(struct rpc_clnt *, struct nfs_server *,
 			  struct rpc_message *, struct nfs4_sequence_args *,
-			  struct nfs4_sequence_res *, int);
+			  struct nfs4_sequence_res *, int, int);
 extern void nfs4_init_sequence(struct nfs4_sequence_args *, struct nfs4_sequence_res *, int, int);
 extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struct rpc_cred *, struct nfs4_setclientid_res *);
 extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct nfs4_setclientid_res *arg, struct rpc_cred *);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 6c749ce7587e..505f605dcac2 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1029,9 +1029,10 @@ int nfs4_call_sync(struct rpc_clnt *clnt,
 		   struct rpc_message *msg,
 		   struct nfs4_sequence_args *args,
 		   struct nfs4_sequence_res *res,
-		   int cache_reply)
+		   int cache_reply,
+		   int privileged)
 {
-	nfs4_init_sequence(args, res, cache_reply, 0);
+	nfs4_init_sequence(args, res, cache_reply, privileged);
 	return nfs4_call_sync_sequence(clnt, server, msg, args, res);
 }
 
@@ -3061,7 +3062,7 @@ static int _nfs4_do_setattr(struct inode *inode,
 	if (delegation_cred)
 		msg.rpc_cred = delegation_cred;
 
-	status = nfs4_call_sync(server->client, server, &msg, &arg->seq_args, &res->seq_res, 1);
+	status = nfs4_call_sync(server->client, server, &msg, &arg->seq_args, &res->seq_res, 1, 0);
 
 	put_rpccred(delegation_cred);
 	if (status == 0 && ctx != NULL)
@@ -3488,7 +3489,7 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
 	if (minorversion)
 		bitmask[2] = FATTR4_WORD2_SUPPATTR_EXCLCREAT;
 
-	status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
+	status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0, 0);
 	if (status == 0) {
 		/* Sanity check the server answers */
 		switch (minorversion) {
@@ -3596,7 +3597,7 @@ static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
 	bitmask[2] = nfs4_fattr_bitmap[2] & ~FATTR4_WORD2_SECURITY_LABEL;
 
 	nfs_fattr_init(info->fattr);
-	return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
+	return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0, 0);
 }
 
 static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle,
@@ -3820,7 +3821,7 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
 	args.bitmask = nfs4_bitmask(server, label);
 
 	nfs_fattr_init(fattr);
-	return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
+	return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0, 0);
 }
 
 static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
@@ -3932,7 +3933,7 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir,
 	nfs_fattr_init(fattr);
 
 	dprintk("NFS call  lookup %s\n", name->name);
-	status = nfs4_call_sync(clnt, server, &msg, &args.seq_args, &res.seq_res, 0);
+	status = nfs4_call_sync(clnt, server, &msg, &args.seq_args, &res.seq_res, 0, 0);
 	dprintk("NFS reply lookup: %d\n", status);
 	return status;
 }
@@ -4045,7 +4046,7 @@ static int _nfs4_proc_lookupp(struct inode *inode,
 
 	dprintk("NFS call  lookupp ino=0x%lx\n", inode->i_ino);
 	status = nfs4_call_sync(clnt, server, &msg, &args.seq_args,
-				&res.seq_res, 0);
+				&res.seq_res, 0, 0);
 	dprintk("NFS reply lookupp: %d\n", status);
 	return status;
 }
@@ -4089,7 +4090,7 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry
 		args.bitmask = server->cache_consistency_bitmask;
 	}
 
-	status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
+	status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0, 0);
 	if (!status) {
 		nfs_access_set_mask(entry, res.access);
 		if (res.fattr)
@@ -4150,7 +4151,7 @@ static int _nfs4_proc_readlink(struct inode *inode, struct page *page,
 		.rpc_resp = &res,
 	};
 
-	return nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode), &msg, &args.seq_args, &res.seq_res, 0);
+	return nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode), &msg, &args.seq_args, &res.seq_res, 0, 0);
 }
 
 static int nfs4_proc_readlink(struct inode *inode, struct page *page,
@@ -4217,7 +4218,7 @@ static int _nfs4_proc_remove(struct inode *dir, const struct qstr *name)
 	unsigned long timestamp = jiffies;
 	int status;
 
-	status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 1);
+	status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 1, 0);
 	if (status == 0)
 		update_changeattr(dir, &res.cinfo, timestamp);
 	return status;
@@ -4375,7 +4376,7 @@ static int _nfs4_proc_link(struct inode *inode, struct inode *dir, const struct
 
 	nfs4_inode_make_writeable(inode);
 
-	status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
+	status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1, 0);
 	if (!status) {
 		update_changeattr(dir, &res.cinfo, res.fattr->time_start);
 		status = nfs_post_op_update_inode(inode, res.fattr);
@@ -4450,7 +4451,7 @@ static struct nfs4_createdata *nfs4_alloc_createdata(struct inode *dir,
 static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data)
 {
 	int status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &data->msg,
-				    &data->arg.seq_args, &data->res.seq_res, 1);
+				    &data->arg.seq_args, &data->res.seq_res, 1, 0);
 	if (status == 0) {
 		update_changeattr(dir, &data->res.dir_cinfo,
 				data->res.fattr->time_start);
@@ -4579,7 +4580,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
 			(unsigned long long)cookie);
 	nfs4_setup_readdir(cookie, NFS_I(dir)->cookieverf, dentry, &args);
 	res.pgbase = args.pgbase;
-	status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0);
+	status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &msg, &args.seq_args, &res.seq_res, 0, 0);
 	if (status >= 0) {
 		memcpy(NFS_I(dir)->cookieverf, res.verifier.data, NFS4_VERIFIER_SIZE);
 		status += args.pgbase;
@@ -4682,7 +4683,7 @@ static int _nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle,
 	};
 
 	nfs_fattr_init(fsstat->fattr);
-	return  nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
+	return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0, 0);
 }
 
 static int nfs4_proc_statfs(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsstat *fsstat)
@@ -4713,7 +4714,7 @@ static int _nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle,
 		.rpc_resp = &res,
 	};
 
-	return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
+	return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0, 0);
 }
 
 static int nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo)
@@ -4774,7 +4775,7 @@ static int _nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle
 	}
 
 	nfs_fattr_init(pathconf->fattr);
-	return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
+	return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0, 0);
 }
 
 static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
@@ -5282,7 +5283,7 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu
 	dprintk("%s  buf %p buflen %zu npages %d args.acl_len %zu\n",
 		__func__, buf, buflen, npages, args.acl_len);
 	ret = nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode),
-			     &msg, &args.seq_args, &res.seq_res, 0);
+			     &msg, &args.seq_args, &res.seq_res, 0, 0);
 	if (ret)
 		goto out_free;
 
@@ -5373,7 +5374,7 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
 	if (i < 0)
 		return i;
 	nfs4_inode_make_writeable(inode);
-	ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
+	ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1, 0);
 
 	/*
 	 * Free each page after tx, so the only ref left is
@@ -5435,7 +5436,7 @@ static int _nfs4_get_security_label(struct inode *inode, void *buf,
 
 	nfs_fattr_init(&fattr);
 
-	ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 0);
+	ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 0, 0);
 	if (ret)
 		return ret;
 	if (!(fattr.valid & NFS_ATTR_FATTR_V4_SECURITY_LABEL))
@@ -5493,7 +5494,7 @@ static int _nfs4_do_set_security_label(struct inode *inode,
 
 	nfs4_stateid_copy(&arg.stateid, &zero_stateid);
 
-	status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
+	status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1, 0);
 	if (status)
 		dprintk("%s failed: %d\n", __func__, status);
 
@@ -6063,7 +6064,7 @@ static int _nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock
 	lsp = request->fl_u.nfs4_fl.owner;
 	arg.lock_owner.id = lsp->ls_seqid.owner_id;
 	arg.lock_owner.s_dev = server->s_dev;
-	status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1);
+	status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1, 0);
 	switch (status) {
 		case 0:
 			request->fl_type = F_UNLCK;
@@ -7040,7 +7041,7 @@ static int _nfs4_proc_fs_locations(struct rpc_clnt *client, struct inode *dir,
 	nfs_fattr_init(&fs_locations->fattr);
 	fs_locations->server = server;
 	fs_locations->nlocations = 0;
-	status = nfs4_call_sync(client, server, &msg, &args.seq_args, &res.seq_res, 0);
+	status = nfs4_call_sync(client, server, &msg, &args.seq_args, &res.seq_res, 0, 0);
 	dprintk("%s: returned status = %d\n", __func__, status);
 	return status;
 }
@@ -7104,9 +7105,8 @@ static int _nfs40_proc_get_locations(struct inode *inode,
 	locations->server = server;
 	locations->nlocations = 0;
 
-	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
-	status = nfs4_call_sync_sequence(clnt, server, &msg,
-					&args.seq_args, &res.seq_res);
+	status = nfs4_call_sync(clnt, server, &msg,
+				&args.seq_args, &res.seq_res, 0, 1);
 	if (status)
 		return status;
 
@@ -7157,9 +7157,8 @@ static int _nfs41_proc_get_locations(struct inode *inode,
 	locations->server = server;
 	locations->nlocations = 0;
 
-	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
-	status = nfs4_call_sync_sequence(clnt, server, &msg,
-					&args.seq_args, &res.seq_res);
+	status = nfs4_call_sync(clnt, server, &msg, &args.seq_args,
+				&res.seq_res, 0, 1);
 	if (status == NFS4_OK &&
 	    res.seq_res.sr_status_flags & SEQ4_STATUS_LEASE_MOVED)
 		status = -NFS4ERR_LEASE_MOVED;
@@ -7244,9 +7243,8 @@ static int _nfs40_proc_fsid_present(struct inode *inode, struct rpc_cred *cred)
 	if (res.fh == NULL)
 		return -ENOMEM;
 
-	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
-	status = nfs4_call_sync_sequence(clnt, server, &msg,
-						&args.seq_args, &res.seq_res);
+	status = nfs4_call_sync(clnt, server, &msg, &args.seq_args,
+				&res.seq_res, 0, 1);
 	nfs_free_fhandle(res.fh);
 	if (status)
 		return status;
@@ -7285,9 +7283,8 @@ static int _nfs41_proc_fsid_present(struct inode *inode, struct rpc_cred *cred)
 	if (res.fh == NULL)
 		return -ENOMEM;
 
-	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
-	status = nfs4_call_sync_sequence(clnt, server, &msg,
-						&args.seq_args, &res.seq_res);
+	status = nfs4_call_sync(clnt, server, &msg, &args.seq_args,
+				&res.seq_res, 0, 1);
 	nfs_free_fhandle(res.fh);
 	if (status == NFS4_OK &&
 	    res.seq_res.sr_status_flags & SEQ4_STATUS_LEASE_MOVED)
@@ -7372,7 +7369,7 @@ static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct
 		NFS_SP4_MACH_CRED_SECINFO, &clnt, &msg);
 
 	status = nfs4_call_sync(clnt, NFS_SERVER(dir), &msg, &args.seq_args,
-				&res.seq_res, 0);
+				&res.seq_res, 0, 0);
 	dprintk("NFS reply  secinfo: %d\n", status);
 
 	if (cred)
@@ -8950,7 +8947,7 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server,
 	int status;
 
 	dprintk("--> %s\n", __func__);
-	status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
+	status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0, 0);
 	if (res.notification & ~args.notify_types)
 		dprintk("%s: unsupported notification\n", __func__);
 	if (res.notification != args.notify_types)
@@ -9107,7 +9104,7 @@ _nfs41_proc_secinfo_no_name(struct nfs_server *server, struct nfs_fh *fhandle,
 
 	dprintk("--> %s\n", __func__);
 	status = nfs4_call_sync(clnt, server, &msg, &args.seq_args,
-				&res.seq_res, 0);
+				&res.seq_res, 0, 0);
 	dprintk("<-- %s status=%d\n", __func__, status);
 
 	if (cred)
@@ -9243,9 +9240,8 @@ static int _nfs41_test_stateid(struct nfs_server *server,
 		&rpc_client, &msg);
 
 	dprintk("NFS call  test_stateid %p\n", stateid);
-	nfs4_init_sequence(&args.seq_args, &res.seq_res, 0, 1);
-	status = nfs4_call_sync_sequence(rpc_client, server, &msg,
-			&args.seq_args, &res.seq_res);
+	status = nfs4_call_sync(rpc_client, server, &msg, &args.seq_args,
+				&res.seq_res, 0, 1);
 	if (status != NFS_OK) {
 		dprintk("NFS reply test_stateid: failed, %d\n", status);
 		return status;
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/5] NFS: Combine nfs4_call_sync() with nfs4_call_sync_sequence()
  2018-05-04 20:22 [PATCH 0/5] NFS: A few small NFSv4 cleanups schumaker.anna
                   ` (3 preceding siblings ...)
  2018-05-04 20:22 ` [PATCH 4/5] NFS: Pass "privileged" value to nfs4_call_sync() schumaker.anna
@ 2018-05-04 20:22 ` schumaker.anna
  2018-05-29 13:45   ` Trond Myklebust
  4 siblings, 1 reply; 8+ messages in thread
From: schumaker.anna @ 2018-05-04 20:22 UTC (permalink / raw)
  To: Trond.Myklebust, linux-nfs

From: Anna Schumaker <Anna.Schumaker@Netapp.com>

The nfs4_call_sync_sequence() version only hase a single user,
nfs4_call_sync(), so let's just add in a call to nfs4_init_sequence()
instead of needing to have another function just to do this.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/nfs4proc.c | 25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 505f605dcac2..99d77f6e7e40 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -993,11 +993,13 @@ static const struct rpc_call_ops nfs40_call_sync_ops = {
 	.rpc_call_done = nfs40_call_sync_done,
 };
 
-static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
-				   struct nfs_server *server,
-				   struct rpc_message *msg,
-				   struct nfs4_sequence_args *args,
-				   struct nfs4_sequence_res *res)
+int nfs4_call_sync(struct rpc_clnt *clnt,
+		   struct nfs_server *server,
+		   struct rpc_message *msg,
+		   struct nfs4_sequence_args *args,
+		   struct nfs4_sequence_res *res,
+		   int cache_reply,
+		   int privileged)
 {
 	int ret;
 	struct rpc_task *task;
@@ -1014,6 +1016,7 @@ static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
 		.callback_data = &data
 	};
 
+	nfs4_init_sequence(args, res, cache_reply, privileged);
 	task = rpc_run_task(&task_setup);
 	if (IS_ERR(task))
 		ret = PTR_ERR(task);
@@ -1024,18 +1027,6 @@ static int nfs4_call_sync_sequence(struct rpc_clnt *clnt,
 	return ret;
 }
 
-int nfs4_call_sync(struct rpc_clnt *clnt,
-		   struct nfs_server *server,
-		   struct rpc_message *msg,
-		   struct nfs4_sequence_args *args,
-		   struct nfs4_sequence_res *res,
-		   int cache_reply,
-		   int privileged)
-{
-	nfs4_init_sequence(args, res, cache_reply, privileged);
-	return nfs4_call_sync_sequence(clnt, server, msg, args, res);
-}
-
 static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo,
 		unsigned long timestamp)
 {
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 5/5] NFS: Combine nfs4_call_sync() with nfs4_call_sync_sequence()
  2018-05-04 20:22 ` [PATCH 5/5] NFS: Combine nfs4_call_sync() with nfs4_call_sync_sequence() schumaker.anna
@ 2018-05-29 13:45   ` Trond Myklebust
  0 siblings, 0 replies; 8+ messages in thread
From: Trond Myklebust @ 2018-05-29 13:45 UTC (permalink / raw)
  To: linux-nfs, schumaker.anna

T24gRnJpLCAyMDE4LTA1LTA0IGF0IDE2OjIyIC0wNDAwLCBzY2h1bWFrZXIuYW5uYUBnbWFpbC5j
b20gd3JvdGU6DQo+IEZyb206IEFubmEgU2NodW1ha2VyIDxBbm5hLlNjaHVtYWtlckBOZXRhcHAu
Y29tPg0KPiANCj4gVGhlIG5mczRfY2FsbF9zeW5jX3NlcXVlbmNlKCkgdmVyc2lvbiBvbmx5IGhh
c2UgYSBzaW5nbGUgdXNlciwNCj4gbmZzNF9jYWxsX3N5bmMoKSwgc28gbGV0J3MganVzdCBhZGQg
aW4gYSBjYWxsIHRvIG5mczRfaW5pdF9zZXF1ZW5jZSgpDQo+IGluc3RlYWQgb2YgbmVlZGluZyB0
byBoYXZlIGFub3RoZXIgZnVuY3Rpb24ganVzdCB0byBkbyB0aGlzLg0KPiANCj4gU2lnbmVkLW9m
Zi1ieTogQW5uYSBTY2h1bWFrZXIgPEFubmEuU2NodW1ha2VyQE5ldGFwcC5jb20+DQo+IC0tLQ0K
PiAgZnMvbmZzL25mczRwcm9jLmMgfCAyNSArKysrKysrKy0tLS0tLS0tLS0tLS0tLS0tDQo+ICAx
IGZpbGUgY2hhbmdlZCwgOCBpbnNlcnRpb25zKCspLCAxNyBkZWxldGlvbnMoLSkNCj4gDQo+IGRp
ZmYgLS1naXQgYS9mcy9uZnMvbmZzNHByb2MuYyBiL2ZzL25mcy9uZnM0cHJvYy5jDQo+IGluZGV4
IDUwNWY2MDVkY2FjMi4uOTlkNzdmNmU3ZTQwIDEwMDY0NA0KPiAtLS0gYS9mcy9uZnMvbmZzNHBy
b2MuYw0KPiArKysgYi9mcy9uZnMvbmZzNHByb2MuYw0KPiBAQCAtOTkzLDExICs5OTMsMTMgQEAg
c3RhdGljIGNvbnN0IHN0cnVjdCBycGNfY2FsbF9vcHMNCj4gbmZzNDBfY2FsbF9zeW5jX29wcyA9
IHsNCj4gIAkucnBjX2NhbGxfZG9uZSA9IG5mczQwX2NhbGxfc3luY19kb25lLA0KPiAgfTsNCj4g
IA0KPiAtc3RhdGljIGludCBuZnM0X2NhbGxfc3luY19zZXF1ZW5jZShzdHJ1Y3QgcnBjX2NsbnQg
KmNsbnQsDQo+IC0JCQkJICAgc3RydWN0IG5mc19zZXJ2ZXIgKnNlcnZlciwNCj4gLQkJCQkgICBz
dHJ1Y3QgcnBjX21lc3NhZ2UgKm1zZywNCj4gLQkJCQkgICBzdHJ1Y3QgbmZzNF9zZXF1ZW5jZV9h
cmdzICphcmdzLA0KPiAtCQkJCSAgIHN0cnVjdCBuZnM0X3NlcXVlbmNlX3JlcyAqcmVzKQ0KPiAr
aW50IG5mczRfY2FsbF9zeW5jKHN0cnVjdCBycGNfY2xudCAqY2xudCwNCj4gKwkJICAgc3RydWN0
IG5mc19zZXJ2ZXIgKnNlcnZlciwNCj4gKwkJICAgc3RydWN0IHJwY19tZXNzYWdlICptc2csDQo+
ICsJCSAgIHN0cnVjdCBuZnM0X3NlcXVlbmNlX2FyZ3MgKmFyZ3MsDQo+ICsJCSAgIHN0cnVjdCBu
ZnM0X3NlcXVlbmNlX3JlcyAqcmVzLA0KPiArCQkgICBpbnQgY2FjaGVfcmVwbHksDQo+ICsJCSAg
IGludCBwcml2aWxlZ2VkKQ0KDQoNCkhtbS4uLi4gNyBmdW5jdGlvbiBhcmd1bWVudHM/IFRoYXQn
cyBhbG1vc3QgZGVzZXJ2aW5nIG9mIGl0cyBvd24NCnN0cnVjdHVyZS4uLg0KDQpMZXQncyBub3Qg
Z28gZG93biB0aGlzIHBhdGguIEl0J3MgZWFzaWVyIHRvIGluaXRpYWxpc2UgdGhlIHNlcXVlbmNl
DQphcmdzL3JlcyBmaXJzdCwgYW5kIHRoYXQgaXMgcHJlY2lzZWx5IHdoeSBJIGNob3NlIHRvIGRv
IHRoaW5ncyB0aGUgd2F5DQp0aGV5IGFyZSB0b2RheS4NCg0KLS0gDQpUcm9uZCBNeWtsZWJ1c3QN
CkNUTywgSGFtbWVyc3BhY2UgSW5jDQo0MzAwIEVsIENhbWlubyBSZWFsLCBTdWl0ZSAxMDUNCkxv
cyBBbHRvcywgQ0EgOTQwMjINCnd3dy5oYW1tZXIuc3BhY2UgaWQ9Ii14LWV2by1zZWxlY3Rpb24t
ZW5kLW1hcmtlciI+

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/5] NFS: Pass "privileged" value to nfs4_call_sync()
  2018-05-04 20:22 ` [PATCH 4/5] NFS: Pass "privileged" value to nfs4_call_sync() schumaker.anna
@ 2018-05-29 13:52   ` Trond Myklebust
  0 siblings, 0 replies; 8+ messages in thread
From: Trond Myklebust @ 2018-05-29 13:52 UTC (permalink / raw)
  To: linux-nfs, schumaker.anna

T24gRnJpLCAyMDE4LTA1LTA0IGF0IDE2OjIyIC0wNDAwLCBzY2h1bWFrZXIuYW5uYUBnbWFpbC5j
b20gd3JvdGU6DQo+IEZyb206IEFubmEgU2NodW1ha2VyIDxBbm5hLlNjaHVtYWtlckBOZXRhcHAu
Y29tPg0KPiANCj4gVGhpcyBsZXRzIHVzIGNvbnZlcnQgYSBmZXcgb3RoZXIgdXNlcnMgb2Ygc3lu
Y2hyb25vdXMgUlBDIGNhbGxzIHRvDQo+IHRoZQ0KPiBuZnM0X2NhbGxfc3luYygpIGZ1bmN0aW9u
Lg0KPiANCj4gU2lnbmVkLW9mZi1ieTogQW5uYSBTY2h1bWFrZXIgPEFubmEuU2NodW1ha2VyQE5l
dGFwcC5jb20+DQo+IC0tLQ0KPiAgZnMvbmZzL25mczQycHJvYy5jIHwgIDggKystLS0NCj4gIGZz
L25mcy9uZnM0X2ZzLmggICB8ICAyICstDQo+ICBmcy9uZnMvbmZzNHByb2MuYyAgfCA3OCArKysr
KysrKysrKysrKysrKysrKysrLS0tLS0tLS0tLS0tLS0tLS0tLS0NCj4gLS0tLQ0KPiAgMyBmaWxl
cyBjaGFuZ2VkLCA0MiBpbnNlcnRpb25zKCspLCA0NiBkZWxldGlvbnMoLSkNCj4gDQo+IGRpZmYg
LS1naXQgYS9mcy9uZnMvbmZzNDJwcm9jLmMgYi9mcy9uZnMvbmZzNDJwcm9jLmMNCj4gaW5kZXgg
NGQ0YTNkZjI4Nzc5Li43ZTlhMjA4OTQwZTIgMTAwNjQ0DQo+IC0tLSBhL2ZzL25mcy9uZnM0MnBy
b2MuYw0KPiArKysgYi9mcy9uZnMvbmZzNDJwcm9jLmMNCj4gQEAgLTQ3LDcgKzQ3LDcgQEAgc3Rh
dGljIGludCBfbmZzNDJfcHJvY19mYWxsb2NhdGUoc3RydWN0IHJwY19tZXNzYWdlDQo+ICptc2cs
IHN0cnVjdCBmaWxlICpmaWxlcCwNCj4gIAkJcmV0dXJuIC1FTk9NRU07DQo+ICANCj4gIAlzdGF0
dXMgPSBuZnM0X2NhbGxfc3luYyhzZXJ2ZXItPmNsaWVudCwgc2VydmVyLCBtc2csDQo+IC0JCQkJ
JmFyZ3Muc2VxX2FyZ3MsICZyZXMuc2VxX3JlcywgMCk7DQo+ICsJCQkJJmFyZ3Muc2VxX2FyZ3Ms
ICZyZXMuc2VxX3JlcywgMCwgMCk7DQoNClRoaXMgaXMgZ2V0dGluZyBvdmVybHkgY29tcGxpY2F0
ZWQuIE5vdGUgdGhhdCB0aGUgY29tbW9uIGNhc2UgdXNlcnMgYXJlDQphbGwgc2V0dGluZyB0aGUg
bmV3IGFyZ3VtZW50IHRvICcwJy4NCg0KSSdtIGhhcHBpZXIgaWYgd2UgbGV0IHRoZSBwcml2aWxl
Z2VkIGNhbGxzIHN0YW5kIG91dCwgc28gdGhhdCB3ZSBjYW4NCmRpc3Rpbmd1aXNoIHRoZW0gZnJv
bSB0aGUgY3Jvd2QuDQoNCi0tIA0KVHJvbmQgTXlrbGVidXN0DQpDVE8sIEhhbW1lcnNwYWNlIElu
Yw0KNDMwMCBFbCBDYW1pbm8gUmVhbCwgU3VpdGUgMTA1DQpMb3MgQWx0b3MsIENBIDk0MDIyDQp3
d3cuaGFtbWVyLnNwYWNlIGlkPSIteC1ldm8tc2VsZWN0aW9uLWVuZC1tYXJrZXIiPg==

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-05-29 13:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-04 20:22 [PATCH 0/5] NFS: A few small NFSv4 cleanups schumaker.anna
2018-05-04 20:22 ` [PATCH 1/5] NFS: Move call to nfs4_state_protect_write() to nfs4_write_setup() schumaker.anna
2018-05-04 20:22 ` [PATCH 2/5] NFS: Move call to nfs4_state_protect() to nfs4_commit_setup() schumaker.anna
2018-05-04 20:22 ` [PATCH 3/5] NFS: Pass "privileged" value to nfs4_init_sequence() schumaker.anna
2018-05-04 20:22 ` [PATCH 4/5] NFS: Pass "privileged" value to nfs4_call_sync() schumaker.anna
2018-05-29 13:52   ` Trond Myklebust
2018-05-04 20:22 ` [PATCH 5/5] NFS: Combine nfs4_call_sync() with nfs4_call_sync_sequence() schumaker.anna
2018-05-29 13:45   ` Trond Myklebust

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.