kNFSd - 5 of 7 - nfsd byte range locking - LOCK
Subsystems (2)
PATCH 1/1 kNFSd - 5 of 7 - nfsd byte range locking - LOCK
### Comments for ChangeSet
From: "William A.(Andy) Adamson" <[email protected]>
this patch implements the nfsv4 LOCK operation.
----------- Diffstat output ------------
./fs/nfsd/nfs4proc.c | 9 ./fs/nfsd/nfs4state.c | 460 ++++++++++++++++++++++++++++++++++++++----- ./fs/nfsd/nfs4xdr.c | 80 +++++++ ./include/linux/nfs4.h | 9 ./include/linux/nfsd/nfsd.h | 2 ./include/linux/nfsd/state.h | 27 ++ ./include/linux/nfsd/xdr4.h | 54 +++++ 7 files changed, 581 insertions(+), 60 deletions(-)
fs/nfsd/nfs4proc.c renamed from fs/nfsd/nfs4proc.c~current~ +6 -3
@@ -377,7 +377,7 @@ nfsd4_read(struct svc_rqst *rqstp, struc }/* check stateid */ if ((status =nfs4_preprocess_stateid_op (current_fh, &read->rd_stateid, -CHECK_FH , &stp))) { +CHECK_FH |RDWR_STATE , &stp))) {dprintk ("NFSD: nfsd4_read: couldn't process stateid!\n" ); goto out; }
@@ -467,7 +467,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, stnfs4_lock_state ();if ((status =nfs4_preprocess_stateid_op (current_fh, &setattr->sa_stateid, -CHECK_FH , &stp))) { +CHECK_FH |RDWR_STATE , &stp))) {dprintk ("NFSD: nfsd4_setattr: couldn't process stateid!\n" ); goto out; }
@@ -507,7 +507,7 @@ nfsd4_write(struct svc_rqst *rqstp, stru goto zero_stateid; }if ((status =nfs4_preprocess_stateid_op (current_fh, stateid, -CHECK_FH , &stp))) { +CHECK_FH |RDWR_STATE , &stp))) {dprintk ("NFSD: nfsd4_write: couldn't process stateid!\n" ); goto out; }
@@ -681,6 +681,9 @@ nfsd4_proc_compound(struct svc_rqst *rqscase OP_LINK : op->status =nfsd4_link (rqstp, ¤t_fh, &save_fh, &op->u.link);break ; +case OP_LOCK : + op->status =nfsd4_lock (rqstp, ¤t_fh, &op->u.lock); +break ;case OP_LOOKUP : op->status =nfsd4_lookup (rqstp, ¤t_fh, &op->u.lookup);break ;
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +408 -52
633 lines not on this page · raw message
fs/nfsd/nfs4xdr.c renamed from fs/nfsd/nfs4xdr.c~current~ +80 -0
104 lines not on this page · raw message
include/linux/nfs4.h renamed from include/linux/nfs4.h~current~ +9 -0
@@ -134,6 +134,15 @@ enum open_delegation_type4 { NFS4_OPEN_DELEGATE_WRITE = 2 }; +enum lock_type4 { +NFS4_UNLOCK_LT =0 , +NFS4_READ_LT =1 , +NFS4_WRITE_LT =2 , +NFS4_READW_LT =3 , +NFS4_WRITEW_LT =4 +}; + +/* Mandatory Attributes */ #define FATTR4_WORD0_SUPPORTED_ATTRS (1)#define FATTR4_WORD0_TYPE (1 << 1)
include/linux/nfsd/nfsd.h renamed from include/linux/nfsd/nfsd.h~current~ +2 -0
@@ -172,6 +172,8 @@ void nfsd_lockd_shutdown(void);#define nfserr_serverfault __constant_htonl(NFSERR_SERVERFAULT)#define nfserr_badtype __constant_htonl(NFSERR_BADTYPE)#define nfserr_jukebox __constant_htonl(NFSERR_JUKEBOX) +#define nfserr_denied __constant_htonl(NFSERR_DENIED) +#define nfserr_deadlock __constant_htonl(NFSERR_DEADLOCK)#define nfserr_expired __constant_htonl(NFSERR_EXPIRED)#define nfserr_bad_cookie __constant_htonl(NFSERR_BAD_COOKIE)#define nfserr_same __constant_htonl(NFSERR_SAME)
include/linux/nfsd/state.h renamed from include/linux/nfsd/state.h~current~ +22 -5
@@ -117,16 +117,24 @@ struct nfs4_replay { };/* -* nfs4_stateowner can either be an open_owner, or (eventually) a lock_owner +* nfs4_stateowner can either be an open_owner, or a lock_owner * -* o so_perfilestate list is used to ensure no dangling nfs4_stateid -* reverences when we release a stateowner. +* so_idhash: stateid_hashtbl[] for open owner, lockstateid_hashtbl[] +* for lock_owner +* so_strhash: ownerstr_hashtbl[] for open_owner, lock_ownerstr_hashtbl[] +* for lock_owner +* so_perclient: nfs4_client->cl_perclient entry - used when nfs4_client +* struct is reaped. +* so_perfilestate: heads the list of nfs4_stateid (either open or lock) +* and is used to ensure no dangling nfs4_stateid references when we +* release a stateowner. */ struct nfs4_stateowner {struct list_head so_idhash;/* hash by so_id */ struct list_head so_strhash;/* hash by op_name */ struct list_head so_perclient;/* nfs4_client->cl_perclient */ struct list_head so_perfilestate;/* list: nfs4_stateid */ +int so_is_open_owner;/* 1=openowner,0=lockowner */ u32 so_id;struct nfs4_client * so_client;u32 so_seqid;
@@ -152,12 +160,18 @@ struct nfs4_file {* nfs4_stateid can either be an open stateid or (eventually) a lock stateid * * (open)nfs4_stateid: one per (open)nfs4_stateowner, nfs4_file +* +* st_hash: stateid_hashtbl[] entry or lockstateid_hashtbl entry +* st_perfile: file_hashtbl[] entry. +* st_perfile_state: nfs4_stateowner->so_perfilestate +* st_share_access: used only for open stateid +* st_share_deny: used only for open stateid */ struct nfs4_stateid { -struct list_head st_hash; +struct list_head st_hash;struct list_head st_perfile; -struct list_head st_perfilestate; +struct list_head st_perfilestate;struct nfs4_stateowner * st_stateowner;struct nfs4_file * st_file;stateid_t st_stateid;
@@ -170,6 +184,9 @@ struct nfs4_stateid {/* flags for preprocess_seqid_op() */ #define CHECK_FH 0x00000001#define CONFIRM 0x00000002 +#define OPEN_STATE 0x00000004 +#define LOCK_STATE 0x00000008 +#define RDWR_STATE 0x00000010#define seqid_mutating_err (err) \ (((err) != nfserr_stale_clientid) && \
include/linux/nfsd/xdr4.h renamed from include/linux/nfsd/xdr4.h~current~ +54 -0
78 lines not on this page · raw message
-------------------------------------------------------
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