[pnfs] [PATCH] update exchange id reply to draft 9
Marc Eshel
eshel at almaden.ibm.com
Fri Mar 9 17:21:26 EST 2007
From: Marc Eshel <eshel at almaden.ibm.com>
Did not completely remove all of the implementation information incase we
decide to use it, but for now we ignore the potentially long names
---
fs/nfs/nfs4proc.c | 4 ----
fs/nfs/nfs4xdr.c | 30 ++++++++++++++++++++----------
fs/nfsd/nfs4state.c | 1 +
fs/nfsd/nfs4xdr.c | 21 ++++++++++++++++++++-
include/linux/nfs_xdr.h | 12 +++++++-----
include/linux/nfsd/state.h | 1 -
include/linux/nfsd/xdr4.h | 6 ------
7 files changed, 48 insertions(+), 27 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index bbd9ccb..389bec8 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4345,10 +4345,6 @@ static int nfs4_proc_exchange_id(struct
args.verifier = &verifier;
args.flags = clp->cl_exchange_flags;
- args.impl_id.domain_len = scnprintf(args.impl_id.domain,
- sizeof(args.impl_id.domain), "%s", "domain");
- args.impl_id.name_len = scnprintf(args.impl_id.name,
- sizeof(args.impl_id.name), "%s", "name");
args.impl_id.date.seconds = htonl((u32)clp->cl_boot_time.tv_sec);
args.impl_id.date.nseconds = htonl((u32)clp->cl_boot_time.tv_nsec);
args.clientid = clp->cl_clientid;
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 5c4363f..d44ca0b 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 + \
+ ((1 * 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))
+ ((1 * 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) + \
@@ -1565,11 +1564,10 @@ static int encode_exchange_id(struct xdr
encode_string(xdr, args->id_len, args->id);
- RESERVE_SPACE(4);
+ RESERVE_SPACE(12);
WRITE32(args->flags);
-
- encode_string(xdr, args->impl_id.domain_len, args->impl_id.domain);
- encode_string(xdr, args->impl_id.name_len, args->impl_id.name);
+ WRITE32(0);
+ WRITE32(0);
RESERVE_SPACE(12);
WRITE64(args->impl_id.date.seconds);
@@ -5028,6 +5026,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);
@@ -5037,13 +5038,22 @@ static int decode_exchange_id(struct xdr
READ_BUF(4);
READ32(res->server_owner.major_id_sz);
READ_BUF(res->server_owner.major_id_sz);
- COPYMEM(res->server_owner.major_id, res->server_owner.major_id_sz);
/* server_scope */
READ_BUF(4);
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);
+ READ_BUF(4);
+ READ32(res->impl_id.name_len);
+ READ_BUF(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/nfs4state.c b/fs/nfsd/nfs4state.c
index 6e3c73a..2ada23e 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1122,6 +1122,7 @@ out_copy:
new->cl_seqid = clid->seqid = 1;
new->cl_exchange_flags = clid->flags;
+ clid->flags = EXCHGID4_FLAG_USE_PNFS_MDS;
dprintk("nfsd4_exchange_id seqid %d flags %x\n",
new->cl_seqid, new->cl_exchange_flags);
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/nfs_xdr.h b/include/linux/nfs_xdr.h
index 9310e9f..d6beddb 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -758,9 +758,9 @@ struct nfstime4 {
struct nfs_impl_id4 {
u32 domain_len;
- char domain[NFS4_OPAQUE_LIMIT];
+ char * domain;
u32 name_len;
- char name[NFS4_OPAQUE_LIMIT];
+ char * name;
struct nfstime4 date;
};
@@ -773,7 +773,7 @@ #define EXCHGID4_FLAG_USE_PNFS_DS 0x0004
struct nfs41_exchange_id_args {
nfs4_verifier * verifier;
unsigned int id_len;
- char id[NFS4_OPAQUE_LIMIT];
+ char id[256];
u32 flags;
struct nfs_impl_id4 impl_id;
clientid4 clientid;
@@ -783,18 +783,20 @@ struct nfs41_exchange_id_args {
struct server_owner {
uint64_t minor_id;
uint32_t major_id_sz;
- char major_id[NFS4_OPAQUE_LIMIT];
+ char * major_id;
};
struct server_scope {
uint32_t server_scope_sz;
- char server_scope[NFS4_OPAQUE_LIMIT];
+ char * 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