Skip to contentSkip to conversation

kNFSd - 7 of 7 - nfsdv4 byte range locking - LOCKU

PATCH New NeilBrown 1 participant 1 message Sep 22, 2003

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 kNFSd - 7 of 7 - nfsdv4 byte range locking - LOCKU

### Comments for ChangeSet

From: "William A.(Andy) Adamson" <[email protected]>

this last locking patch implments the LOCKU operation. these patches pass the connectathon lock test suite against the solaris nfsv4 client.

-->Andy

----------- Diffstat output ------------

 ./fs/nfsd/nfs4proc.c        |    3 ++
 ./fs/nfsd/nfs4state.c       |   59 ++++++++++++++++++++++++++++++++++++++++++++
 ./fs/nfsd/nfs4xdr.c         |   39 +++++++++++++++++++++++++++++
 ./include/linux/nfsd/xdr4.h |   14 ++++++++++
 4 files changed, 115 insertions(+)
fs/nfsd/nfs4proc.c renamed from fs/nfsd/nfs4proc.c~current~ +3 -0
diff ./fs/nfsd/nfs4proc.c~current~ ./fs/nfsd/nfs4proc.c
@@ -687,6 +687,9 @@ nfsd4_proc_compound(struct svc_rqst *rqs
 		case OP_LOCKT:
 			op->status = nfsd4_lockt(rqstp, &current_fh, &op->u.lockt);
 			break;
+		case OP_LOCKU:
+			op->status = nfsd4_locku(rqstp, &current_fh, &op->u.locku);
+			break;
 		case OP_LOOKUP:
 			op->status = nfsd4_lookup(rqstp, &current_fh, &op->u.lookup);
 			break;
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +59 -0

65 lines not on this page · raw message

fs/nfsd/nfs4xdr.c renamed from fs/nfsd/nfs4xdr.c~current~ +39 -0
diff ./fs/nfsd/nfs4xdr.c~current~ ./fs/nfsd/nfs4xdr.c
@@ -625,6 +625,24 @@ nfsd4_decode_lockt(struct nfsd4_compound
 }
 
 static int
+nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku)
+{
+	DECODE_HEAD;
+
+	READ_BUF(24 + sizeof(stateid_t));
+	READ32(locku->lu_type);
+	if ((locku->lu_type < NFS4_READ_LT) || (locku->lu_type > NFS4_WRITEW_LT))
+		goto xdr_error;
+	READ32(locku->lu_seqid);
+	READ32(locku->lu_stateid.si_generation);
+	COPYMEM(&locku->lu_stateid.si_opaque, sizeof(stateid_opaque_t));
+	READ64(locku->lu_offset);
+	READ64(locku->lu_length);
+
+	DECODE_TAIL;
+}
+
+static int
 nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup)
 {
 	DECODE_HEAD;
@@ -1052,6 +1070,9 @@ nfsd4_decode_compound(struct nfsd4_compo
 		case OP_LOCKT:
 			op->status = nfsd4_decode_lockt(argp, &op->u.lockt);
 			break;
+		case OP_LOCKU:
+			op->status = nfsd4_decode_locku(argp, &op->u.locku);
+			break;
 		case OP_LOOKUP:
 			op->status = nfsd4_decode_lookup(argp, &op->u.lookup);
 			break;
@@ -1815,6 +1836,21 @@ nfsd4_encode_lockt(struct nfsd4_compound
 		nfsd4_encode_lock_denied(resp, &lockt->lt_denied);
 }
 
+static void
+nfsd4_encode_locku(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_locku *locku)
+{
+	ENCODE_SEQID_OP_HEAD;
+
+	if (!nfserr) {
+		RESERVE_SPACE(sizeof(stateid_t));
+		WRITE32(locku->lu_stateid.si_generation);
+		WRITEMEM(&locku->lu_stateid.si_opaque, sizeof(stateid_opaque_t));
+		ADJUST_ARGS();
+	}
+				        
+	ENCODE_SEQID_OP_TAIL(locku->lu_stateowner);
+}
+
 
 static void
 nfsd4_encode_link(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_link *link)
@@ -2232,6 +2268,9 @@ nfsd4_encode_operation(struct nfsd4_comp
 	case OP_LOCKT:
 		nfsd4_encode_lockt(resp, op->status, &op->u.lockt);
 		break;
+	case OP_LOCKU:
+		nfsd4_encode_locku(resp, op->status, &op->u.locku);
+		break;
 	case OP_LOOKUP:
 		break;
 	case OP_LOOKUPP:
include/linux/nfsd/xdr4.h renamed from include/linux/nfsd/xdr4.h~current~ +14 -0
diff ./include/linux/nfsd/xdr4.h~current~ ./include/linux/nfsd/xdr4.h
@@ -173,6 +173,17 @@ struct nfsd4_lockt {
 	struct nfsd4_lock_denied  	lt_denied;
 };
 
+ 
+struct nfsd4_locku {
+	u32             lu_type;
+	u32             lu_seqid;
+	stateid_t       lu_stateid;
+	u64             lu_offset;
+	u64             lu_length;
+	struct nfs4_stateowner  *lu_stateowner;
+};
+
+
 struct nfsd4_lookup {
 	u32		lo_len;             /* request */
 	char *		lo_name;            /* request */
@@ -330,6 +341,7 @@ struct nfsd4_op {
 		struct nfsd4_link		link;
 		struct nfsd4_lock		lock;
 		struct nfsd4_lockt		lockt;
+		struct nfsd4_locku		locku;
 		struct nfsd4_lookup		lookup;
 		struct nfsd4_verify		nverify;
 		struct nfsd4_open		open;
@@ -425,6 +437,8 @@ extern int nfsd4_lock(struct svc_rqst *r
 		struct nfsd4_lock *lock);
 extern int nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, 
 		struct nfsd4_lockt *lockt);
+extern int nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, 
+		struct nfsd4_locku *locku);
 #endif
 
 /*

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs