public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] nfs41: SQUASHME: Update to removal of ugly #ifdefs
@ 2009-06-16 18:26 Ricardo Labiaga
  2009-06-16 18:26 ` [PATCH 2/3] SQUASHME: nfs41: Backchannel: Remove FIXME comment Ricardo Labiaga
  0 siblings, 1 reply; 3+ messages in thread
From: Ricardo Labiaga @ 2009-06-16 18:26 UTC (permalink / raw)
  To: trond.myklebust; +Cc: bhalevy, pnfs, linux-nfs, Ricardo Labiaga

Moves the non-v4.1 version handling into common code.

[squash with: nfs41: Implement NFSv4.1 callback service process]

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
---
 fs/nfs/callback.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 116424e..f874640 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -210,17 +210,15 @@ out:
 	return rqstp;
 }
 
-static inline void nfs_callback_svc_setup(u32 minorversion,
+static inline int nfs_minorversion_callback_svc_setup(u32 minorversion,
 		struct svc_serv *serv, struct rpc_xprt *xprt,
 		struct svc_rqst **rqstpp, int (**callback_svc)(void *vrqstp))
 {
 	if (minorversion) {
 		*rqstpp = nfs41_callback_up(serv, xprt);
 		*callback_svc = nfs41_callback_svc;
-	} else {
-		*rqstpp = nfs4_callback_up(serv);
-		*callback_svc = nfs4_callback_svc;
 	}
+	return minorversion;
 }
 
 static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
@@ -230,12 +228,11 @@ static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
 		xprt->bc_serv = cb_info->serv;
 }
 #else
-static inline void nfs_callback_svc_setup(u32 minorversion,
+static inline int nfs_minorversion_callback_svc_setup(u32 minorversion,
 		struct svc_serv *serv, struct rpc_xprt *xprt,
 		struct svc_rqst **rqstpp, int (**callback_svc)(void *vrqstp))
 {
-	*rqstpp = nfs4_callback_up(serv);
-	*callback_svc = nfs4_callback_svc;
+	return 0;
 }
 
 static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
@@ -255,6 +252,7 @@ int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt)
 	struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion];
 	char svc_name[12];
 	int ret = 0;
+	int minorversion_setup;
 
 	mutex_lock(&nfs_callback_mutex);
 	if (cb_info->users++ || cb_info->task != NULL) {
@@ -269,7 +267,13 @@ int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt)
 
 	/* FIXME: either 4.0 or 4.1 callback service can be up at a time
 	 * need to monitor and control them both */
-	nfs_callback_svc_setup(minorversion, serv, xprt, &rqstp, &callback_svc);
+	minorversion_setup =  nfs_minorversion_callback_svc_setup(minorversion,
+					serv, xprt, &rqstp, &callback_svc);
+	if (!minorversion_setup) {
+		/* v4.0 callback setup */
+		rqstp = nfs4_callback_up(serv);
+		callback_svc = nfs4_callback_svc;
+	}
 
 	if (IS_ERR(rqstp)) {
 		ret = PTR_ERR(rqstp);
-- 
1.5.4.3


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

* [PATCH 2/3] SQUASHME: nfs41: Backchannel: Remove FIXME comment
  2009-06-16 18:26 [PATCH 1/3] nfs41: SQUASHME: Update to removal of ugly #ifdefs Ricardo Labiaga
@ 2009-06-16 18:26 ` Ricardo Labiaga
  2009-06-16 18:26   ` [PATCH 3/3] SQUASHME: nfs41: Backchannel: Be more obvious about the return value Ricardo Labiaga
  0 siblings, 1 reply; 3+ messages in thread
From: Ricardo Labiaga @ 2009-06-16 18:26 UTC (permalink / raw)
  To: trond.myklebust; +Cc: bhalevy, pnfs, linux-nfs, Ricardo Labiaga

We already correctly monitor and manage the callback service for NFSv4
and NFSv4.1.  Remove the comment calling attention to this.

[squash with: nfs41: minorversion support for nfs4_{init,destroy}_callback]

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
---
 fs/nfs/callback.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index f874640..e69b8f6 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -265,8 +265,6 @@ int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt)
 		goto out_err;
 	}
 
-	/* FIXME: either 4.0 or 4.1 callback service can be up at a time
-	 * need to monitor and control them both */
 	minorversion_setup =  nfs_minorversion_callback_svc_setup(minorversion,
 					serv, xprt, &rqstp, &callback_svc);
 	if (!minorversion_setup) {
-- 
1.5.4.3


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

* [PATCH 3/3] SQUASHME: nfs41: Backchannel: Be more obvious about the return value
  2009-06-16 18:26 ` [PATCH 2/3] SQUASHME: nfs41: Backchannel: Remove FIXME comment Ricardo Labiaga
@ 2009-06-16 18:26   ` Ricardo Labiaga
  0 siblings, 0 replies; 3+ messages in thread
From: Ricardo Labiaga @ 2009-06-16 18:26 UTC (permalink / raw)
  To: trond.myklebust; +Cc: bhalevy, pnfs, linux-nfs, Ricardo Labiaga

validate_seqid() returns the error value that will be encoded into the XDR
result. Change validate_seqid() to return be32 so that it's obvious that this
error is meant to be XDR encoded.

[squash with: nfs41: Backchannel: CB_SEQUENCE validation]

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com>
---
 fs/nfs/callback_proc.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index c85d66f..95e9022 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -127,7 +127,7 @@ validate_seqid(struct nfs4_slot_table *tbl, u32 slotid, u32 seqid)
 		__func__, slotid, seqid);
 
 	if (slotid > NFS41_BC_MAX_CALLBACKS)
-		return NFS4ERR_BADSLOT;
+		return htonl(NFS4ERR_BADSLOT);
 
 	slot = tbl->slots + slotid;
 	dprintk("%s slot table seqid: %d\n", __func__, slot->seq_nr);
@@ -135,24 +135,24 @@ validate_seqid(struct nfs4_slot_table *tbl, u32 slotid, u32 seqid)
 	/* Normal */
 	if (likely(seqid == slot->seq_nr + 1)) {
 		slot->seq_nr++;
-		return NFS4_OK;
+		return htonl(NFS4_OK);
 	}
 
 	/* Replay */
 	if (seqid == slot->seq_nr) {
 		dprintk("%s seqid %d is a replay - no DRC available\n",
 			__func__, seqid);
-		return NFS4_OK;
+		return htonl(NFS4_OK);
 	}
 
 	/* Wraparound */
 	if (seqid == 1 && (slot->seq_nr + 1) == 0) {
 		slot->seq_nr = 1;
-		return NFS4_OK;
+		return htonl(NFS4_OK);
 	}
 
 	/* Misordered request */
-	return NFS4ERR_SEQ_MISORDERED;
+	return htonl(NFS4ERR_SEQ_MISORDERED);
 }
 
 /*
@@ -202,7 +202,7 @@ unsigned nfs4_callback_sequence(struct cb_sequenceargs *args,
 		kfree(args->csa_rclists[i].rcl_refcalls);
 	kfree(args->csa_rclists);
 
-	status = NFS4ERR_BADSESSION;
+	status = htonl(NFS4ERR_BADSESSION);
 	clp = find_client_with_session(args->csa_addr, 4, &args->csa_sessionid);
 	if (clp == NULL)
 		goto out;
@@ -223,7 +223,7 @@ out_putclient:
 	nfs_put_client(clp);
 out:
 	dprintk("%s: exit with status = %d\n", __func__, status);
-	res->csr_status = htonl(status);
+	res->csr_status = status;
 	return res->csr_status;
 }
 
-- 
1.5.4.3


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

end of thread, other threads:[~2009-06-16 18:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-16 18:26 [PATCH 1/3] nfs41: SQUASHME: Update to removal of ugly #ifdefs Ricardo Labiaga
2009-06-16 18:26 ` [PATCH 2/3] SQUASHME: nfs41: Backchannel: Remove FIXME comment Ricardo Labiaga
2009-06-16 18:26   ` [PATCH 3/3] SQUASHME: nfs41: Backchannel: Be more obvious about the return value Ricardo Labiaga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox