Introduction
Subsystems (6)
PATCH 1/1 Introduction
PUT COMMENTS HERE
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 Simplify nfsd4 name encoding.
Use opaque xdr encoding routines from xdr.c instead of rolling our own.
### Diffstat output
./fs/nfsd/nfs4xdr.c | 14 ++------------ 1 files changed, 2 insertions(+), 12 deletions(-)
fs/nfsd/nfs4xdr.c renamed from fs/nfsd/nfs4xdr.c~current~ +2 -12
@@ -1288,18 +1288,11 @@ static u32 nfs4_ftypes[16] = { NF4SOCK, NF4BAD, NF4LNK, NF4BAD, }; -static inline int -xdr_padding (int l) -{ -return 3 - ((l -1 ) &3 );/* smallest i>=0 such that (l+i)%4 = 0 */ -} -static int nfsd4_encode_name (struct svc_rqst *rqstp,int group,uid_t id,u32 **p,int *buflen) {int status; -u32 len;if (*buflen < (XDR_QUADLEN (IDMAP_NAMESZ ) <<2 ) +4 )return nfserr_resource;
@@ -1309,11 +1302,8 @@ nfsd4_encode_name(struct svc_rqst *rqstp status =nfsd_map_uid_to_name (rqstp, id, (u8 *)(*p +1 ));if (status <0 )return nfserrno (status); - len = (unsigned )status; - *(*p)++ =htonl (len); -memset ((u8 *)*p + len,0 ,xdr_padding (len)); - *p +=XDR_QUADLEN (len); - *buflen -= (XDR_QUADLEN (len) <<2 ) +4 ; + *p =xdr_encode_opaque (*p,NULL , status); + *buflen -= (XDR_QUADLEN (status) <<2 ) +4 ;BUG_ON (*buflen <0 );return 0 ; }
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 Mark NFS/TCP server not EXPERIMENTAL
In reply to NeilBrownFrom: Greg Banks <[email protected]>
NFS/TCP has been used widely for a long time now, and is now enabled by many distros and typically recommended for lossy or congested networks. This patch removes the EXPERIMENTAL tag, updates the help text, and changes arch defconfigs to set it by default (note that several already did so).
### Diffstat output
./arch/alpha/defconfig | 2 +- ./arch/i386/defconfig | 2 +- ./arch/ia64/defconfig | 2 +- ./arch/ppc/defconfig | 2 +- ./arch/s390/defconfig | 2 +- ./fs/Kconfig | 10 ++++++---- 6 files changed, 11 insertions(+), 9 deletions(-)
arch/alpha/defconfig renamed from arch/alpha/defconfig~current~ +1 -1
@@ -791,7 +791,7 @@ CONFIG_NFS_V3=y CONFIG_NFSD=m CONFIG_NFSD_V3=y # CONFIG_NFSD_V4 is not set -# CONFIG_NFSD_TCP is not set +CONFIG_NFSD_TCP=y CONFIG_LOCKD=m CONFIG_LOCKD_V4=y CONFIG_EXPORTFS=m
arch/i386/defconfig renamed from arch/i386/defconfig~current~ +1 -1
@@ -1148,7 +1148,7 @@ CONFIG_NFS_FS=y # CONFIG_NFS_DIRECTIO is not set CONFIG_NFSD=y # CONFIG_NFSD_V3 is not set -# CONFIG_NFSD_TCP is not set +CONFIG_NFSD_TCP=y CONFIG_LOCKD=y CONFIG_EXPORTFS=y CONFIG_SUNRPC=y
arch/ia64/defconfig renamed from arch/ia64/defconfig~current~ +1 -1
@@ -999,7 +999,7 @@ CONFIG_NFS_DIRECTIO=y CONFIG_NFSD=y CONFIG_NFSD_V3=y # CONFIG_NFSD_V4 is not set -# CONFIG_NFSD_TCP is not set +CONFIG_NFSD_TCP=y CONFIG_LOCKD=y CONFIG_LOCKD_V4=y CONFIG_EXPORTFS=y
arch/ppc/defconfig renamed from arch/ppc/defconfig~current~ +1 -1
@@ -1230,7 +1230,7 @@ CONFIG_NFS_V3=y CONFIG_NFSD=y CONFIG_NFSD_V3=y # CONFIG_NFSD_V4 is not set -# CONFIG_NFSD_TCP is not set +CONFIG_NFSD_TCP=y CONFIG_LOCKD=y CONFIG_LOCKD_V4=y CONFIG_EXPORTFS=y
arch/s390/defconfig renamed from arch/s390/defconfig~current~ +1 -1
@@ -422,7 +422,7 @@ CONFIG_NFS_V3=y CONFIG_NFSD=y CONFIG_NFSD_V3=y # CONFIG_NFSD_V4 is not set -# CONFIG_NFSD_TCP is not set +CONFIG_NFSD_TCP=y CONFIG_LOCKD=y CONFIG_LOCKD_V4=y CONFIG_EXPORTFS=y
fs/Kconfig renamed from fs/Kconfig~current~ +6 -4
@@ -1469,11 +1469,13 @@ config NFSD_V4 If unsure, say N. config NFSD_TCP - bool "Provide NFS server over TCP support (EXPERIMENTAL)" - depends on NFSD && EXPERIMENTAL + bool "Provide NFS server over TCP support" + depends on NFSD + default y help - Enable NFS service over TCP connections. This the officially - still experimental, but seems to work well. + If you want your NFS server to support TCP connections, say Y here. + TCP connections usually perform better than the default UDP when + the network is lossy or congested. If unsure, say Y. config ROOT_NFS bool "Root file system on NFS"
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 Delete an obsolete comment from nfsd rpc code
In reply to NeilBrown### Diffstat output
./net/sunrpc/svcsock.c | 1 - 1 files changed, 1 deletion(-)
net/sunrpc/svcsock.c renamed from net/sunrpc/svcsock.c~current~ +0 -1
@@ -414,7 +414,6 @@ svc_sendto(struct svc_rqst *rqstp, struc }/* send tail */ if (xdr->tail[0 ].iov_len) { -/* The tail *will* be in respages[0]; */ result = sock->ops->sendpage (sock, rqstp->rq_respages[rqstp->rq_restailpage], ((unsigned long )xdr->tail[0 ].iov_base)& (PAGE_SIZE -1 ), xdr->tail[0 ].iov_len,0 );
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4 lockowner fixes
In reply to NeilBrownInsist that the first time a client presents a new lockowner, the seqid should be 0. (RFC 3530 section 8.1.5)
Also, return an error if the client presents a previously-used lockowner as if it were new.
Quoted 1 line
From Andy Adamson <[email protected]>
### Diffstat output
./fs/nfsd/nfs4state.c | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +14 -8
@@ -1510,10 +1510,12 @@ nfs4_preprocess_seqid_op(struct svc_fh * status = nfserr_bad_stateid; -/* for new lock stateowners, check that the lock->v.new.open_stateid -* refers to an open stateowner, and that the lockclid -* (nfs4_lock->v.new.clientid) is the same as the -* open_stateid->st_stateowner->so_client->clientid +/* for new lock stateowners: +* check that the lock->v.new.open_stateid +* refers to an open stateowner +* +* check that the lockclid (nfs4_lock->v.new.clientid) is the same +* as the open_stateid->st_stateowner->so_client->clientid */ if (lockclid) {struct nfs4_stateowner *sop = stp->st_stateowner;
@@ -2007,7 +2009,11 @@ nfsd4_lock(struct svc_rqst *rqstp, strucprintk ("NFSD: nfsd4_lock: clientid is stale!\n" ); goto out; } -/* does the clientid in the lock owner own the open stateid? */ + +/* is the new lock seqid presented by the client zero? */ + status = nfserr_bad_seqid; +if (lock->v.new.lock_seqid !=0 ) + goto out;/* validate and update open stateid and open seqid */ status = nfs4_preprocess_seqid_op(current_fh,
@@ -2026,15 +2032,15 @@ nfsd4_lock(struct svc_rqst *rqstp, struc strhashval =lock_ownerstr_hashval (fp->fi_inode, open_sop->so_client->cl_clientid.cl_id, lock->v.new.owner); -/* * If we already have this lock owner, the client is in * error (or our bookeeping is wrong!) * for asking for a 'new lock'. */ status = nfserr_bad_stateid; -if (find_lockstateowner_str (strhashval, &lock->v.new.owner, - &lock->v.new.clientid, &lock_sop)) + lock_sop =find_lockstateowner (&lock->v.new.owner, + &lock->v.new.clientid); +if (lock_sop) goto out; status = nfserr_resource;if (!(lock->lk_stateowner =alloc_init_lock_stateowner (strhashval, open_sop->so_client, open_stp, lock)))
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 Simplify nfsd4_release_lockowner
In reply to NeilBrownSimplify nfsd4_release_lockowner a bit, factor out code that we need for another patch.
### Diffstat output
./fs/nfsd/nfs4state.c | 55 ++++++++++++++++++++++++++++++-------------------- 1 files changed, 33 insertions(+), 22 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +33 -22
@@ -1850,6 +1850,21 @@ nfs4_set_lock_denied(struct file_lock *f deny->ld_type =NFS4_WRITE_LT ; } +static struct nfs4_stateowner * +find_lockstateowner (struct xdr_netobj *owner,clientid_t *clid) +{ +struct nfs4_stateowner *local =NULL ; +int i; + +for (i =0 ; i <LOCK_HASH_SIZE ; i++) { +list_for_each_entry (local, &lock_ownerid_hashtbl[i], so_idhash) { +if (!cmp_owner_str (local, owner, clid)) +continue ; +return local; + } + } +return NULL ; +}static int find_lockstateowner_str (unsigned int hashval,struct xdr_netobj *owner,clientid_t *clid,struct nfs4_stateowner **op) {
@@ -2315,7 +2330,7 @@ nfsd4_release_lockowner(struct svc_rqstclientid_t *clid = &rlockowner->rl_clientid;struct nfs4_stateowner *local =NULL ;struct xdr_netobj *owner = &rlockowner->rl_owner; -int status, i; +int status;dprintk ("nfsd4_release_lockowner clientid: (%08x/%08x):\n" , clid->cl_boot, clid->cl_id);
@@ -2330,29 +2345,25 @@ nfsd4_release_lockowner(struct svc_rqstnfs4_lock_state (); -/* find the lockowner */ status = nfs_ok; -for (i=0 ; i <LOCK_HASH_SIZE ; i++) -list_for_each_entry (local, &lock_ownerstr_hashtbl[i], so_strhash) -if (cmp_owner_str (local, owner, clid)) { -struct nfs4_stateid *stp; - -/* check for any locks held by any stateid -* associated with the (lock) stateowner */ - status = nfserr_locks_held; -list_for_each_entry (stp, &local->so_perfilestate, - st_perfilestate) { -if (stp->st_vfs_set) { -if (check_for_locks (&stp->st_vfs_file, - local)) - goto out; - } - } -/* no locks held by (lock) stateowner */ - status = nfs_ok; -release_stateowner (local); - goto out; + local =find_lockstateowner (owner, clid); +if (local) { +struct nfs4_stateid *stp; + +/* check for any locks held by any stateid +* associated with the (lock) stateowner */ + status = nfserr_locks_held; +list_for_each_entry (stp, &local->so_perfilestate, + st_perfilestate) { +if (stp->st_vfs_set) { +if (check_for_locks (&stp->st_vfs_file, local)) + goto out; } + } +/* no locks held by (lock) stateowner */ + status = nfs_ok; +release_stateowner (local); + } out:nfs4_unlock_state ();return status;
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 Reduce stack usage in nfsd4
In reply to NeilBrownnfsd4_proc_compound is using over a thousand bytes of stack.
This is partly because it declares two local svc_fh's, partly because of a big switch statement which calls a bunch of functions which may be inlined.
### Diffstat output
./fs/nfsd/nfs4proc.c | 85 ++++++++++++++++++++++++++++----------------------- 1 files changed, 48 insertions(+), 37 deletions(-)
fs/nfsd/nfs4proc.c renamed from fs/nfsd/nfs4proc.c~current~ +48 -37
@@ -318,7 +318,7 @@ nfsd4_commit(struct svc_rqst *rqstp, strreturn status; } -static inline int +static int nfsd4_create (struct svc_rqst *rqstp,struct svc_fh *current_fh,struct nfsd4_create *create) {struct svc_fh resfh;
@@ -435,7 +435,7 @@ nfsd4_link(struct svc_rqst *rqstp, strucreturn status; } -static inline int +static int nfsd4_lookupp (struct svc_rqst *rqstp,struct svc_fh *current_fh) {struct svc_fh tmp_fh;
@@ -773,13 +773,20 @@ nfsd4_proc_compound(struct svc_rqst *rqs struct nfsd4_compoundres *resp) {struct nfsd4_op *op; -struct svc_fh current_fh; -struct svc_fh save_fh; +struct svc_fh *current_fh =NULL ; +struct svc_fh *save_fh =NULL ;int slack_space;/* in words, not bytes! */ int status; -fh_init (¤t_fh,NFS4_FHSIZE ); -fh_init (&save_fh,NFS4_FHSIZE ); + status = nfserr_resource; + current_fh =kmalloc (sizeof (*current_fh),GFP_KERNEL ); +if (current_fh ==NULL ) + goto out; +fh_init (current_fh,NFS4_FHSIZE ); + save_fh =kmalloc (sizeof (*save_fh),GFP_KERNEL ); +if (save_fh ==NULL ) + goto out; +fh_init (save_fh,NFS4_FHSIZE ); resp->xbuf = &rqstp->rq_res; resp->p = rqstp->rq_res.head[0 ].iov_base + rqstp->rq_res.head[0 ].iov_len;
@@ -831,7 +838,7 @@ nfsd4_proc_compound(struct svc_rqst *rqs* SETATTR NOFILEHANDLE error handled in nfsd4_setattr * due to required returned bitmap argument */ - if ((!current_fh.fh_dentry) && + if ((!current_fh->fh_dentry) && !((op->opnum == OP_PUTFH) || (op->opnum == OP_PUTROOTFH) || (op->opnum == OP_SETCLIENTID) || (op->opnum == OP_SETCLIENTID_CONFIRM) ||
@@ -843,105 +850,105 @@ nfsd4_proc_compound(struct svc_rqst *rqs }switch (op->opnum) {case OP_ACCESS : - op->status =nfsd4_access (rqstp, ¤t_fh, &op->u.access); + op->status =nfsd4_access (rqstp, current_fh, &op->u.access);break ;case OP_CLOSE : - op->status =nfsd4_close (rqstp, ¤t_fh, &op->u.close); + op->status =nfsd4_close (rqstp, current_fh, &op->u.close);if (op->u.close.cl_stateowner) op->replay = &op->u.close.cl_stateowner->so_replay;break ;case OP_COMMIT : - op->status =nfsd4_commit (rqstp, ¤t_fh, &op->u.commit); + op->status =nfsd4_commit (rqstp, current_fh, &op->u.commit);break ;case OP_CREATE : - op->status =nfsd4_create (rqstp, ¤t_fh, &op->u.create); + op->status =nfsd4_create (rqstp, current_fh, &op->u.create);break ;case OP_GETATTR : - op->status =nfsd4_getattr (rqstp, ¤t_fh, &op->u.getattr); + op->status =nfsd4_getattr (rqstp, current_fh, &op->u.getattr);break ;case OP_GETFH : - op->status =nfsd4_getfh (¤t_fh, &op->u.getfh); + op->status =nfsd4_getfh (current_fh, &op->u.getfh);break ;case OP_LINK : - op->status =nfsd4_link (rqstp, ¤t_fh, &save_fh, &op->u.link); + op->status =nfsd4_link (rqstp, current_fh, save_fh, &op->u.link);break ;case OP_LOCK : - op->status =nfsd4_lock (rqstp, ¤t_fh, &op->u.lock); + op->status =nfsd4_lock (rqstp, current_fh, &op->u.lock);if (op->u.lock.lk_stateowner) op->replay = &op->u.lock.lk_stateowner->so_replay;break ;case OP_LOCKT : - op->status =nfsd4_lockt (rqstp, ¤t_fh, &op->u.lockt); + op->status =nfsd4_lockt (rqstp, current_fh, &op->u.lockt);break ;case OP_LOCKU : - op->status =nfsd4_locku (rqstp, ¤t_fh, &op->u.locku); + op->status =nfsd4_locku (rqstp, current_fh, &op->u.locku);if (op->u.locku.lu_stateowner) op->replay = &op->u.locku.lu_stateowner->so_replay;break ;case OP_LOOKUP : - op->status =nfsd4_lookup (rqstp, ¤t_fh, &op->u.lookup); + op->status =nfsd4_lookup (rqstp, current_fh, &op->u.lookup);break ;case OP_LOOKUPP : - op->status =nfsd4_lookupp (rqstp, ¤t_fh); + op->status =nfsd4_lookupp (rqstp, current_fh);break ;case OP_NVERIFY : - op->status =nfsd4_verify (rqstp, ¤t_fh, &op->u.nverify); + op->status =nfsd4_verify (rqstp, current_fh, &op->u.nverify);if (op->status == nfserr_not_same) op->status = nfs_ok;break ;case OP_OPEN : - op->status =nfsd4_open (rqstp, ¤t_fh, &op->u.open); + op->status =nfsd4_open (rqstp, current_fh, &op->u.open);if (op->u.open.op_stateowner) op->replay = &op->u.open.op_stateowner->so_replay;break ;case OP_OPEN_CONFIRM : - op->status =nfsd4_open_confirm (rqstp, ¤t_fh, &op->u.open_confirm); + op->status =nfsd4_open_confirm (rqstp, current_fh, &op->u.open_confirm);if (op->u.open_confirm.oc_stateowner) op->replay = &op->u.open_confirm.oc_stateowner->so_replay;break ;case OP_OPEN_DOWNGRADE : - op->status =nfsd4_open_downgrade (rqstp, ¤t_fh, &op->u.open_downgrade); + op->status =nfsd4_open_downgrade (rqstp, current_fh, &op->u.open_downgrade);if (op->u.open_downgrade.od_stateowner) op->replay = &op->u.open_downgrade.od_stateowner->so_replay;break ;case OP_PUTFH : - op->status =nfsd4_putfh (rqstp, ¤t_fh, &op->u.putfh); + op->status =nfsd4_putfh (rqstp, current_fh, &op->u.putfh);break ;case OP_PUTROOTFH : - op->status =nfsd4_putrootfh (rqstp, ¤t_fh); + op->status =nfsd4_putrootfh (rqstp, current_fh);break ;case OP_READ : - op->status =nfsd4_read (rqstp, ¤t_fh, &op->u.read); + op->status =nfsd4_read (rqstp, current_fh, &op->u.read);break ;case OP_READDIR : - op->status =nfsd4_readdir (rqstp, ¤t_fh, &op->u.readdir); + op->status =nfsd4_readdir (rqstp, current_fh, &op->u.readdir);break ;case OP_READLINK : - op->status =nfsd4_readlink (rqstp, ¤t_fh, &op->u.readlink); + op->status =nfsd4_readlink (rqstp, current_fh, &op->u.readlink);break ;case OP_REMOVE : - op->status =nfsd4_remove (rqstp, ¤t_fh, &op->u.remove); + op->status =nfsd4_remove (rqstp, current_fh, &op->u.remove);break ;case OP_RENAME : - op->status =nfsd4_rename (rqstp, ¤t_fh, &save_fh, &op->u.rename); + op->status =nfsd4_rename (rqstp, current_fh, save_fh, &op->u.rename);break ;case OP_RENEW : op->status =nfsd4_renew (&op->u.renew);break ;case OP_RESTOREFH : - op->status =nfsd4_restorefh (¤t_fh, &save_fh); + op->status =nfsd4_restorefh (current_fh, save_fh);break ;case OP_SAVEFH : - op->status =nfsd4_savefh (¤t_fh, &save_fh); + op->status =nfsd4_savefh (current_fh, save_fh);break ;case OP_SETATTR : - op->status =nfsd4_setattr (rqstp, ¤t_fh, &op->u.setattr); + op->status =nfsd4_setattr (rqstp, current_fh, &op->u.setattr);break ;case OP_SETCLIENTID : op->status =nfsd4_setclientid (rqstp, &op->u.setclientid);
@@ -950,12 +957,12 @@ nfsd4_proc_compound(struct svc_rqst *rqs op->status =nfsd4_setclientid_confirm (rqstp, &op->u.setclientid_confirm);break ;case OP_VERIFY : - op->status =nfsd4_verify (rqstp, ¤t_fh, &op->u.verify); + op->status =nfsd4_verify (rqstp, current_fh, &op->u.verify);if (op->status == nfserr_same) op->status = nfs_ok;break ;case OP_WRITE : - op->status =nfsd4_write (rqstp, ¤t_fh, &op->u.write); + op->status =nfsd4_write (rqstp, current_fh, &op->u.write);break ;case OP_RELEASE_LOCKOWNER : op->status =nfsd4_release_lockowner (rqstp, &op->u.release_lockowner);
@@ -990,8 +997,12 @@ out:kfree (tb->buf);kfree (tb); } -fh_put (¤t_fh); -fh_put (&save_fh); +if (current_fh) +fh_put (current_fh); +kfree (current_fh); +if (save_fh) +fh_put (save_fh); +kfree (save_fh);return status; }
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 Improve cleaning up of nfsd4 requests
In reply to NeilBrownCurrently nfs4_arg->to_free keeps a list of void ptrs on which kfree is called when freeing the nfs4_arg. This allows us to do cleanup on e.g. xdr decode failures. To allow more complicated objects to be freed (in particular, acls), we add a "void (*release)(void *)" to allow us to request something other than kfree be called when freeing.
### Diffstat output
./fs/nfsd/nfs4proc.c | 15 --------- ./fs/nfsd/nfs4xdr.c | 68 +++++++++++++++++++++++++++----------------- ./include/linux/nfsd/xdr4.h | 2 + 3 files changed, 46 insertions(+), 39 deletions(-)
fs/nfsd/nfs4proc.c renamed from fs/nfsd/nfs4proc.c~current~ +1 -14
@@ -983,20 +983,7 @@ encode_op: } out: -if (args->ops != args->iops) { -kfree (args->ops); - args->ops = args->iops; - } -if (args->tmpp) { -kfree (args->tmpp); - args->tmpp =NULL ; - } -while (args->to_free) { -struct tmpbuf *tb = args->to_free; - args->to_free = tb->next; -kfree (tb->buf); -kfree (tb); - } +nfsd4_release_compoundargs (args);if (current_fh)fh_put (current_fh);kfree (current_fh);
fs/nfsd/nfs4xdr.c renamed from fs/nfsd/nfs4xdr.c~current~ +43 -25
96 lines not on this page · raw message
include/linux/nfsd/xdr4.h renamed from include/linux/nfsd/xdr4.h~current~ +2 -0
@@ -378,6 +378,7 @@ struct nfsd4_compoundargs {u32 * tmpp;struct tmpbuf {struct tmpbuf *next; +void (*release)(const void *);void *buf; } *to_free;
@@ -449,6 +450,7 @@ extern int nfsd4_locku(struct svc_rqst *extern int nfsd4_release_lockowner (struct svc_rqst *rqstp,struct nfsd4_release_lockowner *rlockowner); +extern void nfsd4_release_compoundargs (struct nfsd4_compoundargs *);#endif /*
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 Allow user to set NFSv4 lease time.
In reply to NeilBrownAllow the lease to be set from /proc/fs/nfs/nfsv4leasetime.
To comply with rfc3530, this appears as a server reboot from the point of view of the client, which must reclaim state with the grace period.
Quoted 1 line
From Andy Adamson <[email protected]>
### Diffstat output
./fs/nfsd/nfs4proc.c | 9 - ./fs/nfsd/nfs4state.c | 222 ++++++++++++++++++++++++++++++++++++++++--- ./fs/nfsd/nfsctl.c | 31 +++++- ./include/linux/nfsd/nfsd.h | 6 - ./include/linux/nfsd/state.h | 15 ++ 5 files changed, 263 insertions(+), 20 deletions(-)
fs/nfsd/nfs4proc.c renamed from fs/nfsd/nfs4proc.c~current~ +5 -4
@@ -135,9 +135,11 @@ do_open_fhandle(struct svc_rqst *rqstp, {int status; -dprintk ("NFSD: do_open_fhandle\n" ); +/* Only reclaims from previously confirmed clients are valid */ +if ((status =nfs4_check_open_reclaim (&open->op_clientid))) +return status; -/* we don't know the target directory, and therefore can not +/* We don't know the target directory, and therefore can not * set the change info */
@@ -172,8 +174,7 @@ nfsd4_open(struct svc_rqst *rqstp, strucif (nfs4_in_grace () && open->op_claim_type !=NFS4_OPEN_CLAIM_PREVIOUS )return nfserr_grace; -if (nfs4_in_no_grace () && - open->op_claim_type ==NFS4_OPEN_CLAIM_PREVIOUS ) +if (!nfs4_in_grace () && open->op_claim_type ==NFS4_OPEN_CLAIM_PREVIOUS )return nfserr_no_grace;/* This check required by spec. */
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +209 -13
304 lines not on this page · raw message
fs/nfsd/nfsctl.c renamed from fs/nfsd/nfsctl.c~current~ +30 -1
@@ -36,7 +36,7 @@#include <asm/uaccess.h> /* -* We have a single directory with 8 nodes in it. +* We have a single directory with 9 nodes in it. */ enum { NFSD_Root =1 ,
@@ -50,6 +50,7 @@ enum { NFSD_List, NFSD_Fh, NFSD_Threads, + NFSD_Leasetime, };/*
@@ -64,6 +65,7 @@ static ssize_t write_getfd(struct file *static ssize_t write_getfs (struct file *file,char *buf,size_t size);static ssize_t write_filehandle (struct file *file,char *buf,size_t size);static ssize_t write_threads (struct file *file,char *buf,size_t size); +static ssize_t write_leasetime (struct file *file,char *buf,size_t size);static ssize_t (*write_op[])(struct file *,char *,size_t ) = { [NFSD_Svc] = write_svc,
@@ -75,6 +77,7 @@ static ssize_t (*write_op[])(struct file [NFSD_Getfs] = write_getfs, [NFSD_Fh] = write_filehandle, [NFSD_Threads] = write_threads, + [NFSD_Leasetime] = write_leasetime, };/* an argresp is stored in an allocated page and holds the
@@ -393,6 +396,29 @@ static ssize_t write_threads(struct filereturn strlen (buf); } +extern time_t nfs4_leasetime (void ); + +static ssize_t write_leasetime (struct file *file,char *buf,size_t size) +{ +/* if size > 10 seconds, call +* nfs4_reset_lease() then write out the new lease (seconds) as reply +*/ +char *mesg = buf; +int rv; + +if (size >0 ) { +int lease; + rv =get_int (&mesg, &lease); +if (rv) +return rv; +if (lease <10 || lease >3600 ) +return -EINVAL ; +nfs4_reset_lease (lease); + } +sprintf (buf,"%ld\n" ,nfs4_lease_time ()); +return strlen (buf); +} +/*----------------------------------------------------------------------------*/ /* * populating the filesystem.
@@ -411,6 +437,9 @@ static int nfsd_fill_super(struct super_ [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, [NFSD_Fh] = {"filehandle", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Threads] = {"threads" , &transaction_ops,S_IWUSR |S_IRUSR }, +#ifdef CONFIG_NFSD_V4 + [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, +#endif /* last one */ {""} };return simple_fill_super (sb,0x6e667364 , nfsd_files);
include/linux/nfsd/nfsd.h renamed from include/linux/nfsd/nfsd.h~current~ +5 -1
@@ -126,9 +126,13 @@ int nfsd_permission(struct svc_export *#ifdef CONFIG_NFSD_V4 void nfs4_state_init (void );void nfs4_state_shutdown (void ); +time_t nfs4_lease_time (void ); +void nfs4_reset_lease (time_t leasetime);#else void static inline nfs4_state_init (void ){}void static inline nfs4_state_shutdown (void ){} +time_t static inline nfs4_lease_time (void ){return 0 ;} +void static inline nfs4_reset_lease (time_t leasetime){}#endif /*
@@ -249,7 +253,7 @@ static inline int is_fsid(struct svc_fh#define COMPOUND_SLACK_SPACE 140/* OP_GETFH */ #define COMPOUND_ERR_SLACK_SPACE 12/* OP_SETATTR */ -#define NFSD_LEASE_TIME 60/* seconds */ +#define NFSD_LEASE_TIME (nfs4_lease_time())#define NFSD_LAUNDROMAT_MINTIMEOUT 10/* seconds */ /*
include/linux/nfsd/state.h renamed from include/linux/nfsd/state.h~current~ +14 -1
@@ -105,6 +105,19 @@ struct nfs4_client {clientid_t cl_clientid;/* generated by server */ nfs4_verifier cl_confirm;/* generated by server */ struct nfs4_callback cl_callback;/* callback info */ +time_t cl_first_state;/* first state aquisition*/ +}; + +/* struct nfs4_client_reset +* one per old client. Populates reset_str_hashtbl. Filled from conf_id_hashtbl +* upon lease reset, or from upcall to state_daemon (to read in state +* from non-volitile storage) upon reboot. +*/ +struct nfs4_client_reclaim { +struct list_head cr_strhash;/* hash by cr_name */ +struct xdr_netobj cr_name;/* id generated by client */ +time_t cr_first_state;/* first state aquisition */ +u32 cr_expired;/* boolean: lease expired? */ }; static inline void
@@ -234,5 +247,5 @@ extern int nfs4_share_conflict(struct svextern void nfs4_lock_state (void );extern void nfs4_unlock_state (void );extern int nfs4_in_grace (void ); -extern int nfs4_in_no_grace (void ); +extern int nfs4_check_open_reclaim (clientid_t *clid);#endif /* NFSD4_STATE_H */
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 Parse nsfd4 callback information
In reply to NeilBrownPreparation for delegations: parse callback information provided in setclientid request.
Quoted 1 line
From Andy Adamson <[email protected]>
### Diffstat output
./fs/nfsd/nfs4state.c | 94 ++++++++++++++++++++++++++++++++++++++++++- ./include/linux/nfsd/state.h | 18 ++++++++ 2 files changed, 111 insertions(+), 1 deletion(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +93 -1
@@ -339,6 +339,95 @@ move_to_confirmed(struct nfs4_client *clrenew_client (clp); } + +/* a helper function for parse_callback */ +static int +parse_octet (unsigned int *lenp,char **addrp) +{ +unsigned int len = *lenp; +char *p = *addrp; +int n =-1 ; +char c; + +for (;;) { +if (!len) +break ; + len--; + c = *p++; +if (c =='.' ) +break ; +if ((c <'0' ) || (c >'9' )) { + n =-1 ; +break ; + } +if (n <0 ) + n =0 ; + n = (n *10 ) + (c -'0' ); +if (n >255 ) { + n =-1 ; +break ; + } + } + *lenp = len; + *addrp = p; +return n; +} + +/* parse and set the setclientid ipv4 callback address */ +int +parse_ipv4 (unsigned int addr_len,char *addr_val,unsigned int *cbaddrp,unsigned short *cbportp) +{ +int temp =0 ; +u32 cbaddr =0 ; +u16 cbport =0 ; +u32 addrlen = addr_len; +char *addr = addr_val; +int i, shift; + +/* ipaddress */ + shift =24 ; +for (i =4 ; i >0 ; i--) { +if ((temp =parse_octet (&addrlen, &addr)) <0 ) { +return 0 ; + } + cbaddr |= (temp << shift); +if (shift >0 ) + shift -=8 ; + } + *cbaddrp = cbaddr; + +/* port */ + shift =8 ; +for (i =2 ; i >0 ; i--) { +if ((temp =parse_octet (&addrlen, &addr)) <0 ) { +return 0 ; + } + cbport |= (temp << shift); +if (shift >0 ) + shift -=8 ; + } + *cbportp = cbport; +return 1 ; +} + +void +gen_callback (struct nfs4_client *clp,struct nfsd4_setclientid *se) +{ +struct nfs4_callback *cb = &clp->cl_callback; + +if ( !(parse_ipv4 (se->se_callback_addr_len, se->se_callback_addr_val, + &cb->cb_addr, &cb->cb_port))) { +printk (KERN_INFO "NFSD: BAD callback address. client will not receive delegations\n" ); + cb->cb_parsed =0 ; +return ; + } + cb->cb_netid.len = se->se_callback_netid_len; + cb->cb_netid.data = se->se_callback_netid_val; + cb->cb_prog = se->se_callback_prog; + cb->cb_ident = se->se_callback_ident; + cb->cb_parsed =1 ; +} +/* * RFC 3010 has a complex implmentation description of processing a * SETCLIENTID request consisting of 5 bullets, labeled as
@@ -450,6 +539,7 @@ nfsd4_setclientid(struct svc_rqst *rqstpcopy_cred (&new->cl_cred,&rqstp->rq_cred);gen_clid (new);gen_confirm (new); +gen_callback (new, setclid);add_to_unconfirmed (new, strhashval); }else if (cmp_verf (&conf->cl_verifier, &clverifier)) {/*
@@ -477,6 +567,7 @@ nfsd4_setclientid(struct svc_rqst *rqstpcopy_cred (&new->cl_cred,&rqstp->rq_cred);copy_clid (new, conf);gen_confirm (new); +gen_callback (new, setclid);add_to_unconfirmed (new,strhashval); }else if (!unconf) {/*
@@ -494,6 +585,7 @@ nfsd4_setclientid(struct svc_rqst *rqstpcopy_cred (&new->cl_cred,&rqstp->rq_cred);gen_clid (new);gen_confirm (new); +gen_callback (new, setclid);add_to_unconfirmed (new, strhashval); }else if (!cmp_verf (&conf->cl_confirm, &unconf->cl_confirm)) {/*
@@ -519,6 +611,7 @@ nfsd4_setclientid(struct svc_rqst *rqstpcopy_cred (&new->cl_cred,&rqstp->rq_cred);gen_clid (new);gen_confirm (new); +gen_callback (new, setclid);add_to_unconfirmed (new, strhashval); }else {/* No cases hit !!! */
@@ -529,7 +622,6 @@ nfsd4_setclientid(struct svc_rqst *rqstp setclid->se_clientid.cl_boot = new->cl_clientid.cl_boot; setclid->se_clientid.cl_id = new->cl_clientid.cl_id;memcpy (setclid->se_confirm.data, new->cl_confirm.data,sizeof (setclid->se_confirm.data)); -printk (KERN_INFO "NFSD: this client will not receive delegations\n" ); status = nfs_ok; out:nfs4_unlock_state ();
include/linux/nfsd/state.h renamed from include/linux/nfsd/state.h~current~ +18 -0
@@ -38,6 +38,7 @@#define _NFSD4_STATE_H#include <linux/list.h> +#include <linux/sunrpc/clnt.h> #define NFS4_OPAQUE_LIMIT 1024 typedef struct {
@@ -65,6 +66,22 @@ extern stateid_t onestateid;#define ZERO_STATEID (stateid) (!memcmp((stateid), &zerostateid, sizeof(stateid_t)))#define ONE_STATEID (stateid) (!memcmp((stateid), &onestateid, sizeof(stateid_t))) +/* client delegation callback info */ +struct nfs4_callback { +/* SETCLIENTID info */ +u32 cb_parsed;/* addr parsed */ +u32 cb_addr; +unsigned short cb_port; +u32 cb_prog; +u32 cb_ident; +struct xdr_netobj cb_netid; +/* RPC client info */ +u32 cb_set;/* successful CB_NULL call */ +struct rpc_program cb_program; +struct rpc_stat cb_stat; +struct rpc_clnt * cb_client; +}; +/* * struct nfs4_client - one per client. Clientids live here. * o Each nfs4_client is hashed by clientid.
@@ -87,6 +104,7 @@ struct nfs4_client {struct svc_cred cl_cred;/* setclientid principal */ clientid_t cl_clientid;/* generated by server */ nfs4_verifier cl_confirm;/* generated by server */ +struct nfs4_callback cl_callback;/* callback info */ }; static inline void
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs