[pnfs] more to update exchange id to draft 9
Marc Eshel
eshel at almaden.ibm.com
Sun Mar 4 17:16:43 EST 2007
more to update exchange id to draft 9
Had to reduce NFS4_OPAQUE_LIMIT from 1024 to 256 since few structs the
include it are defined on the stack. I am note sure why it needs to be
1024 but if it must we will have to malloc those structs to avoid stack
overflow.
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 5c4363f..68a0089 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -144,11 +144,10 @@ #define decode_delegreturn_maxsz (op_dec
#define encode_sequence_maxsz (op_encode_hdr_maxsz + 4 + 1 + 1 + 1)
#define decode_sequence_maxsz (op_decode_hdr_maxsz + 4 + 1 + 1 + 1 + 1 + 1)
#define encode_exchange_id_maxsz (op_encode_hdr_maxsz + 4 + 1 + 6 + 6 + \
- (NFS4_VERIFIER_SIZE >> 2)) + 10 + \
- ((3 * NFS4_OPAQUE_LIMIT) >> 2)
+ (NFS4_VERIFIER_SIZE >> 2) + 10 + \
+ ((3 * NFS4_OPAQUE_LIMIT) >> 2))
#define decode_exchange_id_maxsz (op_decode_hdr_maxsz + 2 + 1 + 2 + 1 + \
- (NFS4_OPAQUE_LIMIT >> 2) + 1 + \
- (NFS4_OPAQUE_LIMIT >> 2))
+ ((4 * NFS4_OPAQUE_LIMIT) >> 2) + 7)
#define encode_create_session_maxsz (op_encode_hdr_maxsz + 2 + 1 + 1 + 1 + \
1 + 1 + 1 + 1 + \
(NFS4_VERIFIER_SIZE >> 2) + \
@@ -5028,6 +5027,9 @@ static int decode_exchange_id(struct xdr
READ_BUF(4);
READ32(clp->cl_session->seqid);
+ READ_BUF(4);
+ READ32(res->flags);
+
/* server_owner */
/* minor_id */
READ_BUF(8);
@@ -5044,6 +5046,18 @@ static int decode_exchange_id(struct xdr
READ32(res->server_scope.server_scope_sz);
READ_BUF(res->server_scope.server_scope_sz);
COPYMEM(res->server_scope.server_scope, res->server_scope.server_scope_sz);
+ /* implementation id */
+ READ_BUF(4);
+ READ32(res->impl_id.domain_len);
+ READ_BUF(res->impl_id.domain_len);
+ COPYMEM(res->impl_id.domain, res->impl_id.domain_len);
+ READ_BUF(4);
+ READ32(res->impl_id.name_len);
+ READ_BUF(res->impl_id.name_len);
+ COPYMEM(res->impl_id.name, res->impl_id.name_len);
+ READ_BUF(12);
+ READ64(res->impl_id.date.seconds);
+ READ32(res->impl_id.date.nseconds);
return 0;
}
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index b2b3ad6..6c3025e 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2711,8 +2711,12 @@ nfsd4_encode_exchange_id(struct nfsd4_co
ENCODE_HEAD;
char major_id[] = "fixme_please!";
char server_scope[] = "fixme_please!";
+ char domain[] = "fixme_please!";
+ char name[] = "fixme_please!";
int major_id_sz;
int server_scope_sz;
+ int domain_sz;
+ int name_sz;
uint64_t minor_id = 0;
/* XXX FIXME We currently use ia dummy as the major id. Need to change
@@ -2721,11 +2725,15 @@ nfsd4_encode_exchange_id(struct nfsd4_co
if (!nfserr) {
major_id_sz = strlen(major_id);
server_scope_sz = strlen(server_scope);
+ domain_sz = strlen(domain);
+ name_sz = strlen(name);
- RESERVE_SPACE(8 + 4 + 8 + 4 + major_id_sz + 4 + server_scope_sz);
+ RESERVE_SPACE(8+4+4+8+4+major_id_sz+4+server_scope_sz);
WRITEMEM(&clid->clientid, 8);
WRITE32(clid->seqid);
+ WRITE32(clid->flags);
+
/* The server_owner struct */
WRITE64(minor_id); /* Minor id */
/* major id */
@@ -2736,6 +2744,17 @@ nfsd4_encode_exchange_id(struct nfsd4_co
WRITE32(server_scope_sz);
WRITEMEM(server_scope, server_scope_sz);
ADJUST_ARGS();
+
+ /* Implementation id */
+ RESERVE_SPACE(4+domain_sz+4+name_sz+8+4);
+ WRITE32(domain_sz);
+ WRITEMEM(domain, domain_sz);
+ WRITE32(name_sz);
+ WRITEMEM(name, name_sz);
+ WRITE64(clid->impl_id.date.seconds);
+ WRITE32(clid->impl_id.date.nseconds);
+
+ ADJUST_ARGS();
}
}
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 6be5ab7..ce045c6 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -19,7 +19,8 @@ #define NFS4_VERIFIER_SIZE 8
#define NFS4_FHSIZE 128
#define NFS4_MAXPATHLEN PATH_MAX
#define NFS4_MAXNAMLEN NAME_MAX
-#define NFS4_OPAQUE_LIMIT 1024
+/* <<fix me>> should be 1024 but first remove some struct from the stack */
+#define NFS4_OPAQUE_LIMIT 256
#define NFS4_MAX_SESSIONID_LEN 16
#define NFS4_ACCESS_READ 0x0001
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 9310e9f..de6d9bd 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -793,8 +793,10 @@ struct server_scope {
struct nfs41_exchange_id_res {
struct nfs4_client * client;
+ u32 flags;
struct server_owner server_owner;
struct server_scope server_scope;
+ struct nfs_impl_id4 impl_id;
};
struct nfs41_create_session_args {
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h
index 95cd3fd..9b5c094 100644
--- a/include/linux/nfsd/state.h
+++ b/include/linux/nfsd/state.h
@@ -44,7 +44,6 @@ #include <linux/sunrpc/clnt.h>
#define CONFIG_PNFS 1
-#define NFS4_OPAQUE_LIMIT 1024
typedef struct {
u32 cl_boot;
u32 cl_id;
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h
index ee72699..d937b9f 100644
--- a/include/linux/nfsd/xdr4.h
+++ b/include/linux/nfsd/xdr4.h
@@ -343,12 +343,6 @@ struct impl_id4 {
struct nfstime4 date;
};
-#define EXCHGID4_FLAG_SUPP_MOVED_REFER 0x00000001
-#define EXCHGID4_FLAG_SUPP_MOVED_MIGR 0x00000002
-#define EXCHGID4_FLAG_USE_NON_PNFS 0x00010000
-#define EXCHGID4_FLAG_USE_PNFS_MDS 0x00020000
-#define EXCHGID4_FLAG_USE_PNFS_DS 0x00040000
-
struct nfsd4_exchange_id {
nfs4_verifier verifier;
u32 id_len;
More information about the pNFS
mailing list