Introduction
Subsystems (3)
PATCH 1/1 Introduction
(I sent these to Andrew already an inadvertantly didn't copy to the nfs list as is my practice. So this set is to the list and not to Andrew).
Just in time for -rc1 (if I'm lucky:-) here are a bunch of nfsd patches.
The last 4 are from Al Viro on Christmas day and are trivial. The 20 before that are from the NFSv4 team and mostly affect
only -v4 (which is still experimental).
The second rearranges removes two 'inlines' saving many bytes. The first causes any error from 'fsync' on a directory to be propagated
back to the client.
Thanks,
NeilBrown
[PATCH kNFSd 000 of 26] Introduction
[PATCH kNFSd 001 of 26] Check error status from nfsd_sync_dir
[PATCH kNFSd 002 of 26] Remove inline from a couple of large NFS functions. [PATCH kNFSd 003 of 26] svcrpc: save and restore the daddr field when request deferred [PATCH kNFSd 004 of 26] nfsd4: misc lock fixes
[PATCH kNFSd 005 of 26] nfsd4: fix nfsd4_lock cleanup on failure
[PATCH kNFSd 006 of 26] nfsd4: rename lk_stateowner
[PATCH kNFSd 007 of 26] nfsd4: remove release_state_owner()
[PATCH kNFSd 008 of 26] nfsd4: fix check_for_locks
[PATCH kNFSd 009 of 26] nfsd4: operation debugging
[PATCH kNFSd 010 of 26] svcrpc: gss: handle the GSS_S_CONTINUE
[PATCH kNFSd 011 of 26] svcrpc: gss: server context init failure handling [PATCH kNFSd 012 of 26] svcrpc: gss: svc context creation error handling [PATCH kNFSd 013 of 26] nfsd4: fix open of recovery directory
[PATCH kNFSd 014 of 26] nfsd4: recovery lookup dir check
[PATCH kNFSd 015 of 26] nfsd4: handle replays of failed open reclaims [PATCH kNFSd 016 of 26] nfsd4: no replays on unconfirmed owners
[PATCH kNFSd 017 of 26] nfsd4: nfs4state.c miscellaneous goto removals [PATCH kNFSd 018 of 26] nfsd4: simplify process-open1 logic
[PATCH kNFSd 019 of 26] nfsd4: don't create on open that fails due to ERR_GRACE [PATCH kNFSd 020 of 26] nfsd4: fix open_downgrade
[PATCH kNFSd 021 of 26] nfsd4: Fix bug in rdattr_error return
[PATCH kNFSd 022 of 26] nfsd4: clean up settattr code
[PATCH kNFSd 023 of 26] nfsd/vfs.c: endianness fixes
[PATCH kNFSd 024 of 26] nfsd4_truncate() bogus return value
[PATCH kNFSd 025 of 26] NFSERR_SERVERFAULT returned host-endian
[PATCH kNFSd 026 of 26] Subject: [PATCH] nfsd4_lock() returns bogus values to clients
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 svcrpc: save and restore the daddr field when request deferred
The server code currently keeps track of the destination address on every request so that it can reply using the same address. However we forget to do that in the case of a deferred request. Remedy this oversight.
PATCH 1/1 Check error status from nfsd_sync_dir
In reply to NeilBrownFrom: YAMAMOTO Takashi <[email protected]>
Change nfsd_sync_dir to return an error if ->sync fails, and pass that error up through the stack.
This involves a number of rearrangements of error paths, and care to distinguish between Linux -errno numbers and NFSERR numbers.
In the 'create' routines, we continue with the 'setattr' even if a previous sync_dir failed.
This patch is quite different from Takashi's in a few ways, but there is still a strong lineage.
### Diffstat output
./fs/nfsd/vfs.c | 80 ++++++++++++++++++++++++-------------------- ./include/linux/nfsd/nfsd.h | 2 - 2 files changed, 45 insertions(+), 37 deletions(-)
fs/nfsd/vfs.c renamed from fs/nfsd/vfs.c~current~ +44 -36
@@ -710,14 +710,15 @@ static inline int nfsd_dosync(struct fil {struct inode *inode = dp->d_inode;int (*fsync) (struct file *,struct dentry *,int ); -int err = nfs_ok; +int err; -filemap_fdatawrite (inode->i_mapping); -if (fop && (fsync = fop->fsync)) - err=fsync (filp, dp,0 ); -filemap_fdatawait (inode->i_mapping); + err =filemap_fdatawrite (inode->i_mapping); +if (err ==0 && fop && (fsync = fop->fsync)) + err =fsync (filp, dp,0 ); +if (err ==0 ) + err =filemap_fdatawait (inode->i_mapping); -return nfserrno (err); +return err; }
@@ -734,10 +735,10 @@ nfsd_sync(struct file *filp)return err; } -void +int nfsd_sync_dir (struct dentry *dp) { -nfsd_dosync (NULL , dp, dp->d_inode->i_fop); +return nfsd_dosync (NULL , dp, dp->d_inode->i_fop); }/*
@@ -1065,6 +1066,7 @@ nfsd_commit(struct svc_rqst *rqstp, struif (EX_ISSYNC (fhp->fh_export)) {if (file->f_op && file->f_op->fsync) { err =nfsd_sync (file); + err =nfserrno (err); }else { err = nfserr_notsupp; }
@@ -1175,7 +1177,7 @@ nfsd_create(struct svc_rqst *rqstp, stru goto out_nfserr;if (EX_ISSYNC (fhp->fh_export)) { -nfsd_sync_dir (dentry); + err =nfsd_sync_dir (dentry);write_inode_now (dchild->d_inode,1 ); }
@@ -1185,9 +1187,11 @@ nfsd_create(struct svc_rqst *rqstp, stru* send along the gid when it tries to implement setgid * directories via NFS. */ - err =0 ; -if ((iap->ia_valid &= ~(ATTR_UID |ATTR_GID |ATTR_MODE )) !=0 ) - err =nfsd_setattr (rqstp, resfhp, iap,0 , (time_t )0 ); +if ((iap->ia_valid &= ~(ATTR_UID |ATTR_GID |ATTR_MODE )) !=0 ) { +int err2 =nfsd_setattr (rqstp, resfhp, iap,0 , (time_t )0 ); +if (err2) + err = err2; + }/* * Update the file handle to get the new inode info. */
@@ -1306,17 +1310,12 @@ nfsd_create_v3(struct svc_rqst *rqstp, s goto out_nfserr;if (EX_ISSYNC (fhp->fh_export)) { -nfsd_sync_dir (dentry); + err =nfsd_sync_dir (dentry); +if (err) + err =nfserrno (err);/* setattr will sync the child (or not) */ } -/* -* Update the filehandle to get the new inode info. -*/ - err =fh_update (resfhp); -if (err) - goto out; -if (createmode ==NFS3_CREATE_EXCLUSIVE ) {/* Cram the verifier into atime/mtime/mode */ iap->ia_valid =ATTR_MTIME |ATTR_ATIME
@@ -1337,8 +1336,17 @@ nfsd_create_v3(struct svc_rqst *rqstp, s* implement setgid directories via NFS. Clear out all that cruft. */ set_attr: -if ((iap->ia_valid &= ~(ATTR_UID |ATTR_GID )) !=0 ) - err =nfsd_setattr (rqstp, resfhp, iap,0 , (time_t )0 ); +if ((iap->ia_valid &= ~(ATTR_UID |ATTR_GID )) !=0 ) { +int err2 =nfsd_setattr (rqstp, resfhp, iap,0 , (time_t )0 ); +if (err2) + err =nfserrno (err2); + } + +/* +* Update the filehandle to get the new inode info. +*/ +if (!err) + err =fh_update (resfhp); out:fh_unlock (fhp);
@@ -1447,10 +1455,10 @@ nfsd_symlink(struct svc_rqst *rqstp, str }else err =vfs_symlink (dentry->d_inode, dnew, path, mode); -if (!err) { +if (!err)if (EX_ISSYNC (fhp->fh_export)) -nfsd_sync_dir (dentry); - }else + err =nfsd_sync_dir (dentry); +if (err) err =nfserrno (err);fh_unlock (fhp);
@@ -1506,8 +1514,10 @@ nfsd_link(struct svc_rqst *rqstp, struct err =vfs_link (dold, dirp, dnew);if (!err) {if (EX_ISSYNC (ffhp->fh_export)) { -nfsd_sync_dir (ddir); + err =nfsd_sync_dir (ddir);write_inode_now (dest,1 ); +if (err) + err =nfserrno (err); } }else {if (err == -EXDEV && rqstp->rq_vers ==2 )
@@ -1595,8 +1605,9 @@ nfsd_rename(struct svc_rqst *rqstp, stru#endif err =vfs_rename (fdir, odentry, tdir, ndentry);if (!err &&EX_ISSYNC (tfhp->fh_export)) { -nfsd_sync_dir (tdentry); -nfsd_sync_dir (fdentry); + err =nfsd_sync_dir (tdentry); +if (!err) + err =nfsd_sync_dir (fdentry); } out_dput_new:
@@ -1671,17 +1682,14 @@ nfsd_unlink(struct svc_rqst *rqstp, strudput (rdentry); -if (err) - goto out_nfserr; -if (EX_ISSYNC (fhp->fh_export)) -nfsd_sync_dir (dentry); - -out: -return err; +if (err ==0 && +EX_ISSYNC (fhp->fh_export)) + err =nfsd_sync_dir (dentry); out_nfserr: err =nfserrno (err); - goto out; +out: +return err; }/*
include/linux/nfsd/nfsd.h renamed from include/linux/nfsd/nfsd.h~current~ +1 -1
@@ -124,7 +124,7 @@ int nfsd_statfs(struct svc_rqst *, struint nfsd_notify_change (struct inode *,struct iattr *);int nfsd_permission (struct svc_export *,struct dentry *,int ); -void nfsd_sync_dir (struct dentry *dp); +int nfsd_sync_dir (struct dentry *dp);#if defined(CONFIG_NFSD_V2_ACL ) || defined(CONFIG_NFSD_V3_ACL )#ifdef CONFIG_NFSD_V2_ACL
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: misc lock fixes
In reply to NeilBrownLogic fixes for LOCK and UNLOCK.
- Move the permission check on the current file handle outside of nfs4_lock_state()
- remove the file manager fl_release_private calls; fl_ops is not set.
### Diffstat output
./fs/nfsd/nfs4state.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +5 -9
@@ -2700,6 +2700,11 @@ nfsd4_lock(struct svc_rqst *rqstp, strucif (check_lock_length (lock->lk_offset, lock->lk_length))return nfserr_inval; +if ((status =fh_verify (rqstp, current_fh,S_IFREG ,MAY_LOCK ))) { +dprintk ("NFSD: nfsd4_lock: permission denied!\n" ); +return status; + } +nfs4_lock_state ();if (lock->lk_is_new) {
@@ -2757,11 +2762,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struc/* lock->lk_stateowner and lock_stp have been created or found */ filp = lock_stp->st_vfs_file; -if ((status =fh_verify (rqstp, current_fh,S_IFREG ,MAY_LOCK ))) { -dprintk ("NFSD: nfsd4_lock: permission denied!\n" ); - goto out; - } - status = nfserr_grace;if (nfs4_in_grace () && !lock->lk_reclaim) goto out;
@@ -2802,8 +2802,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struc*/ status =posix_lock_file (filp, &file_lock); -if (file_lock.fl_ops && file_lock.fl_ops->fl_release_private) - file_lock.fl_ops->fl_release_private (&file_lock);dprintk ("NFSD: nfsd4_lock: posix_lock_file status %d\n" ,status);switch (-status) {case 0 :/* success! */
@@ -2977,8 +2975,6 @@ nfsd4_locku(struct svc_rqst *rqstp, stru* Try to unlock the file in the VFS. */ status =posix_lock_file (filp, &file_lock); -if (file_lock.fl_ops && file_lock.fl_ops->fl_release_private) - file_lock.fl_ops->fl_release_private (&file_lock);if (status) {dprintk ("NFSD: nfs4_locku: posix_lock_file failed!\n" ); goto out_nfserr;
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: rename lk_stateowner
In reply to NeilBrownOne of the things that's confusing about nfsd4_lock is that the lk_stateowner field could be set to either of two different lockowners: the open owner or the lock owner. Rename to lk_replay_owner and add a comment to make it clear that it's used for whichever stateowner has its sequence id bumped for replay detection.
### Diffstat output
./fs/nfsd/nfs4state.c | 16 ++++++++-------- ./fs/nfsd/nfs4xdr.c | 5 ++--- ./include/linux/nfsd/xdr4.h | 5 +++-- 3 files changed, 13 insertions(+), 13 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +8 -8
@@ -2725,11 +2725,11 @@ nfsd4_lock(struct svc_rqst *rqstp, struc lock->lk_new_open_seqid, &lock->lk_new_open_stateid,CHECK_FH |OPEN_STATE , - &lock->lk_stateowner, &open_stp, + &lock->lk_replay_owner, &open_stp, lock);if (status) goto out; - open_sop = lock->lk_stateowner; + open_sop = lock->lk_replay_owner;/* create lockowner and lock stateid */ fp = open_stp->st_file; strhashval = lock_ownerstr_hashval(fp->fi_inode,
@@ -2752,12 +2752,12 @@ nfsd4_lock(struct svc_rqst *rqstp, struc lock->lk_old_lock_seqid, &lock->lk_old_lock_stateid,CHECK_FH |LOCK_STATE , - &lock->lk_stateowner, &lock_stp, lock); + &lock->lk_replay_owner, &lock_stp, lock);if (status) goto out; - lock_sop = lock->lk_stateowner; + lock_sop = lock->lk_replay_owner; } -/* lock->lk_stateowner and lock_stp have been created or found */ +/* lock->lk_replay_owner and lock_stp have been created or found */ filp = lock_stp->st_vfs_file; status = nfserr_grace;
@@ -2830,9 +2830,9 @@ conflicting_lock: out:if (status && lock->lk_is_new && lock_sop)release_stateowner (lock_sop); -if (lock->lk_stateowner) { -nfs4_get_stateowner (lock->lk_stateowner); - *replay_owner = lock->lk_stateowner; +if (lock->lk_replay_owner) { +nfs4_get_stateowner (lock->lk_replay_owner); + *replay_owner = lock->lk_replay_owner; }nfs4_unlock_state ();return status;
fs/nfsd/nfs4xdr.c renamed from fs/nfsd/nfs4xdr.c~current~ +2 -3
@@ -528,7 +528,7 @@ nfsd4_decode_lock(struct nfsd4_compounda {DECODE_HEAD ; - lock->lk_stateowner =NULL ; + lock->lk_replay_owner =NULL ;/* * type, reclaim(boolean), offset, length, new_lock_owner(boolean) */
@@ -1895,7 +1895,6 @@ nfsd4_encode_lock_denied(struct nfsd4_costatic void nfsd4_encode_lock (struct nfsd4_compoundres *resp,int nfserr,struct nfsd4_lock *lock) { -ENCODE_SEQID_OP_HEAD ;if (!nfserr) {
@@ -1906,7 +1905,7 @@ nfsd4_encode_lock(struct nfsd4_compoundr }else if (nfserr == nfserr_denied)nfsd4_encode_lock_denied (resp, &lock->lk_denied); -ENCODE_SEQID_OP_TAIL (lock->lk_stateowner); +ENCODE_SEQID_OP_TAIL (lock->lk_replay_owner); } static void
include/linux/nfsd/xdr4.h renamed from include/linux/nfsd/xdr4.h~current~ +3 -2
@@ -145,8 +145,9 @@ struct nfsd4_lock { } ok;struct nfsd4_lock_denied denied; } u; - -struct nfs4_stateowner *lk_stateowner; +/* The lk_replay_owner is the open owner in the open_to_lock_owner +* case and the lock owner otherwise: */ +struct nfs4_stateowner *lk_replay_owner; };#define lk_new_open_seqid v.new.open_seqid#define lk_new_open_stateid v.new.open_stateid
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: remove release_state_owner()
In reply to NeilBrownIt's confusing having both release_stateowner() and release_state_owner(). And as it turns out, release_state_owner() is short and only called from one place; so just remove it.
Also note the confirmed check is superfluous there--preprocess_seqid_op already check this.
And remove a redundant comment and a superfluous line assignment while we're at it.
### Diffstat output
./fs/nfsd/nfs4state.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +9 -22
@@ -1178,7 +1178,6 @@ release_stateid(struct nfs4_stateid *stplocks_remove_posix (filp, (fl_owner_t ) stp->st_stateowner);put_nfs4_file (stp->st_file);kmem_cache_free (stateid_slab, stp); - stp =NULL ; } static void
@@ -1191,22 +1190,6 @@ move_to_close_lru(struct nfs4_stateowner sop->so_time =get_seconds (); } -static void -release_state_owner (struct nfs4_stateid *stp,int flag) -{ -struct nfs4_stateowner *sop = stp->st_stateowner; - -dprintk ("NFSD: release_state_owner\n" ); -release_stateid (stp, flag); - -/* place unused nfs4_stateowners on so_close_lru list to be -* released by the laundromat service after the lease period -* to enable us to handle CLOSE replay -*/ -if (sop->so_confirmed &&list_empty (&sop->so_stateids)) -move_to_close_lru (sop); -} -static int cmp_owner_str (struct nfs4_stateowner *sop,struct xdr_netobj *owner,clientid_t *clid) { return ((sop->so_owner.len == owner->len) &&
@@ -2423,15 +2406,19 @@ nfsd4_close(struct svc_rqst *rqstp, stru CHECK_FH | OPEN_STATE | CLOSE_STATE, &close->cl_stateowner, &stp, NULL))) goto out; -/* -* Return success, but first update the stateid. -*/ status = nfs_ok;update_stateid (&stp->st_stateid);memcpy (&close->cl_stateid, &stp->st_stateid,sizeof (stateid_t)); -/* release_state_owner() calls nfsd_close() if needed */ -release_state_owner (stp,OPEN_STATE ); +/* release_stateid() calls nfsd_close() if needed */ +release_stateid (stp,OPEN_STATE ); + +/* place unused nfs4_stateowners on so_close_lru list to be +* released by the laundromat service after the lease period +* to enable us to handle CLOSE replay +*/ +if (list_empty (&close->cl_stateowner->so_stateids)) +move_to_close_lru (close->cl_stateowner); out:if (close->cl_stateowner) {nfs4_get_stateowner (close->cl_stateowner);
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 Remove inline from a couple of large NFS functions.
In reply to NeilBrownThese are both called from two places close together. I could rearrange that code so there is only one call site, but just removing the 'inline' is probably best.
### Diffstat output
./fs/nfsd/vfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/vfs.c renamed from fs/nfsd/vfs.c~current~ +2 -2
@@ -815,7 +815,7 @@ nfsd_read_actor(read_descriptor_t *desc,return size; } -static inline int +static int nfsd_vfs_read (struct svc_rqst *rqstp,struct svc_fh *fhp,struct file *file,loff_t offset,struct kvec *vec,int vlen,unsigned long *count) {
@@ -879,7 +879,7 @@ static void kill_suid(struct dentry *denmutex_unlock (&dentry->d_inode->i_mutex); } -static inline int +static int nfsd_vfs_write (struct svc_rqst *rqstp,struct svc_fh *fhp,struct file *file,loff_t offset,struct kvec *vec,int vlen,unsigned long cnt,int *stablep)
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: fix nfsd4_lock cleanup on failure
In reply to NeilBrownrelease_state_owner also puts the lock owner on the close_lru. There's no need for that, though; replays of the failed lock would be handled by the openowner not the lockowner.
Also consolidate the cleanup a bit, fixing leaks that can happen if errors occur between the time a new lock owner is allocated and the lock is done.
Remove a comment and dprintk that look a little redundant.
### Diffstat output
./fs/nfsd/nfs4state.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +4 -14
@@ -2744,10 +2744,8 @@ nfsd4_lock(struct svc_rqst *rqstp, strucif (lock_sop ==NULL ) goto out; lock_stp =alloc_init_lock_stateid (lock_sop, fp, open_stp); -if (lock_stp ==NULL ) { -release_stateowner (lock_sop); +if (lock_stp ==NULL ) goto out; - } }else {/* lock (lock owner + lock stateid) already exists */ status = nfs4_preprocess_seqid_op(current_fh,
@@ -2815,7 +2813,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struc status = nfserr_deadlock;default :dprintk ("NFSD: nfsd4_lock: posix_lock_file() failed! status %d\n" ,status); - goto out_destroy_new_stateid; + goto out; } conflicting_lock:
@@ -2829,17 +2827,9 @@ conflicting_lock: goto out; }nfs4_set_lock_denied (conflock, &lock->lk_denied); - -out_destroy_new_stateid: -if (lock->lk_is_new) { -dprintk ("NFSD: nfsd4_lock: destroy new stateid!\n" ); -/* -* An error encountered after instantiation of the new -* stateid has forced us to destroy it. -*/ -release_state_owner (lock_stp,LOCK_STATE ); - } out: +if (status && lock->lk_is_new && lock_sop) +release_stateowner (lock_sop);if (lock->lk_stateowner) {nfs4_get_stateowner (lock->lk_stateowner); *replay_owner = lock->lk_stateowner;
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: fix check_for_locks
In reply to NeilBrownFix some bad logic.
### Diffstat output
./fs/nfsd/nfs4state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +2 -1
@@ -2989,9 +2989,10 @@ check_for_locks(struct file *filp, struclock_kernel ();for (flpp = &inode->i_flock; *flpp !=NULL ; flpp = &(*flpp)->fl_next) { -if ((*flpp)->fl_owner == (fl_owner_t )lowner) +if ((*flpp)->fl_owner == (fl_owner_t )lowner) { status =1 ; goto out; + } } out:unlock_kernel ();
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 svcrpc: gss: handle the GSS_S_CONTINUE
In reply to NeilBrownKerberos context initiation is handled in a single round trip, but other mechanisms (including spkm3) may require more, so we need to handle the GSS_S_CONTINUE case in svcauth_gss_accept. Send a null verifier.
### Diffstat output
./net/sunrpc/auth_gss/svcauth_gss.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-)
net/sunrpc/auth_gss/svcauth_gss.c renamed from net/sunrpc/auth_gss/svcauth_gss.c~current~ +25 -5
@@ -586,6 +586,20 @@ gss_verify_header(struct svc_rqst *rqstp }static int +gss_write_null_verf (struct svc_rqst *rqstp) +{ +u32 *p; + +svc_putu32 (rqstp->rq_res.head,htonl (RPC_AUTH_NULL )); + p = rqstp->rq_res.head->iov_base + rqstp->rq_res.head->iov_len; +/* don't really need to check if head->iov_len > PAGE_SIZE ... */ + *p++ =0 ; +if (!xdr_ressize_check (rqstp, p)) +return -1 ; +return 0 ; +} + +static int gss_write_verf (struct svc_rqst *rqstp,struct gss_ctx *ctx_id,u32 seq) {u32 xdr_seq;
@@ -876,12 +890,18 @@ svcauth_gss_accept(struct svc_rqst *rqstcase -ENOENT : goto drop;case 0 : - rsci =gss_svc_searchbyctx (&rsip->out_handle); -if (!rsci) { - goto drop; +if (rsip->major_status ==GSS_S_COMPLETE ) { + rsci =gss_svc_searchbyctx (&rsip->out_handle); +if (!rsci) { + goto drop; + } +if (gss_write_verf (rqstp, rsci->mechctx, +GSS_SEQ_WIN )) + goto drop; + }else { +if (gss_write_null_verf (rqstp)) + goto drop; } -if (gss_write_verf (rqstp, rsci->mechctx,GSS_SEQ_WIN )) - goto drop;if (resv->iov_len +4 >PAGE_SIZE ) goto drop;svc_putu32 (resv, rpc_success);
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: operation debugging
In reply to NeilBrownSimple, useful debugging printk: print the number of each op as we process it.
### Diffstat output
./fs/nfsd/nfs4proc.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfsd/nfs4proc.c renamed from fs/nfsd/nfs4proc.c~current~ +2 -0
@@ -768,6 +768,8 @@ nfsd4_proc_compound(struct svc_rqst *rqswhile (!status && resp->opcnt < args->opcnt) { op = &args->ops[resp->opcnt++]; +dprintk ("nfsv4 compound op #%d: %d\n" , resp->opcnt, op->opnum); +/* * The XDR decode routines may have pre-set op->status; * for example, if there is a miscellaneous XDR error
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 svcrpc: gss: svc context creation error handling
In reply to NeilBrownAllow mechanisms to return more varied errors on the context creation downcall.
### Diffstat output
./net/sunrpc/auth_gss/svcauth_gss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/sunrpc/auth_gss/svcauth_gss.c renamed from net/sunrpc/auth_gss/svcauth_gss.c~current~ +2 -1
@@ -420,7 +420,8 @@ static int rsc_parse(struct cache_detailgss_mech_put (gm); goto out; } -if (gss_import_sec_context (buf, len, gm, &rsci.mechctx)) { + status =gss_import_sec_context (buf, len, gm, &rsci.mechctx); +if (status) {gss_mech_put (gm); goto out; }
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 svcrpc: gss: server context init failure handling
In reply to NeilBrownWe require the server's gssd to create a completed context before asking the kernel to send a final context init reply. However, gssd could be buggy, or under some bizarre circumstances we might purge the context from our cache before we get the chance to use it here.
Handle this case by returning GSS_S_NO_CONTEXT to the client.
Also move the relevant code here to a separate function rather than nesting excessively.
Quoted 1 line
From Kevin Coffman <[email protected]>
### Diffstat output
./net/sunrpc/auth_gss/svcauth_gss.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-)
net/sunrpc/auth_gss/svcauth_gss.c renamed from net/sunrpc/auth_gss/svcauth_gss.c~current~ +17 -12
@@ -755,6 +755,21 @@ svcauth_gss_set_client(struct svc_rqst *return SVC_OK ; } +static inline int +gss_write_init_verf (struct svc_rqst *rqstp,struct rsi *rsip) +{ +struct rsc *rsci; + +if (rsip->major_status !=GSS_S_COMPLETE ) +return gss_write_null_verf (rqstp); + rsci =gss_svc_searchbyctx (&rsip->out_handle); +if (rsci ==NULL ) { + rsip->major_status =GSS_S_NO_CONTEXT ; +return gss_write_null_verf (rqstp); + } +return gss_write_verf (rqstp, rsci->mechctx,GSS_SEQ_WIN ); +} +/* * Accept an rpcsec packet. * If context establishment, punt to user space
@@ -890,18 +905,8 @@ svcauth_gss_accept(struct svc_rqst *rqstcase -ENOENT : goto drop;case 0 : -if (rsip->major_status ==GSS_S_COMPLETE ) { - rsci =gss_svc_searchbyctx (&rsip->out_handle); -if (!rsci) { - goto drop; - } -if (gss_write_verf (rqstp, rsci->mechctx, -GSS_SEQ_WIN )) - goto drop; - }else { -if (gss_write_null_verf (rqstp)) - goto drop; - } +if (gss_write_init_verf (rqstp, rsip)) + goto drop;if (resv->iov_len +4 >PAGE_SIZE ) goto drop;svc_putu32 (resv, rpc_success);
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: handle replays of failed open reclaims
In reply to NeilBrownWe need to make sure open reclaims are marked confirmed immediately so that we can handle replays even if they fail (e.g. with a seqid-incrementing error). (See 8.1.8.)
### Diffstat output
./fs/nfsd/nfs4proc.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfsd/nfs4proc.c renamed from fs/nfsd/nfs4proc.c~current~ +2 -0
@@ -210,6 +210,7 @@ nfsd4_open(struct svc_rqst *rqstp, struc goto out;break ;case NFS4_OPEN_CLAIM_PREVIOUS : + open->op_stateowner->so_confirmed =1 ;/* * The CURRENT_FH is already set to the file being * opened. (1) set open->op_cinfo, (2) set
@@ -221,6 +222,7 @@ nfsd4_open(struct svc_rqst *rqstp, struc goto out;break ;case NFS4_OPEN_CLAIM_DELEGATE_PREV : + open->op_stateowner->so_confirmed =1 ;printk ("NFSD: unsupported OPEN claim type %d\n" , open->op_claim_type); status = nfserr_notsupp;
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: fix open of recovery directory
In reply to NeilBrownWe should be opening this directory RDONLY, not RDWR.
Thanks to Christoph Hellwig for the bug report.
### Diffstat output
./fs/nfsd/nfs4recover.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfsd/nfs4recover.c renamed from fs/nfsd/nfs4recover.c~current~ +1 -2
@@ -222,8 +222,7 @@ nfsd4_list_rec_dir(struct dentry *dir, rnfs4_save_user (&uid, &gid); - filp =dentry_open (dget (dir),mntget (rec_dir.mnt), -O_RDWR ); + filp =dentry_open (dget (dir),mntget (rec_dir.mnt),O_RDONLY ); status =PTR_ERR (filp);if (IS_ERR (filp)) goto out;
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: simplify process-open1 logic
In reply to NeilBrownnfsd4_process_open1 is very highly nested; flatten it out a bit.
Also, the preceding comment, which just outlines the logic, seems redundant.
### Diffstat output
./fs/nfsd/nfs4state.c | 99 +++++++++++++++++--------------------------------- 1 file changed, 35 insertions(+), 64 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +35 -64
@@ -1429,90 +1429,61 @@ static struct lock_manager_operations nf }; -/* -* nfsd4_process_open1() -* lookup stateowner. -* found: -* check confirmed -* confirmed: -* check seqid -* not confirmed: -* delete owner -* create new owner -* notfound: -* verify clientid -* create new owner -* -* called with nfs4_lock_state() held. -*/ int nfsd4_process_open1 (struct nfsd4_open *open) { -int status;clientid_t *clientid = &open->op_clientid;struct nfs4_client *clp =NULL ;unsigned int strhashval;struct nfs4_stateowner *sop =NULL ; - status = nfserr_inval;if (!check_name (open->op_owner)) - goto out; +return nfserr_inval;if (STALE_CLIENTID (&open->op_clientid))return nfserr_stale_clientid; strhashval =ownerstr_hashval (clientid->cl_id, open->op_owner); sop =find_openstateowner_str (strhashval, open); -if (sop) { - open->op_stateowner = sop; -if (!sop->so_confirmed) { -/* Replace any unconfirmed stateowner without -* even checking for replays */ - clp = sop->so_client; -release_stateowner (sop); - }else if (open->op_seqid == sop->so_seqid) { -/* normal case */ - goto renew; - }else if (open->op_seqid == sop->so_seqid -1 ) { -/* replay */ -if (sop->so_replay.rp_buflen) -return NFSERR_REPLAY_ME ; -else { -/* The original OPEN failed so spectacularly -* that we don't even have replay data saved! -* Therefore, we have no choice but to continue -* processing this OPEN; presumably, we'll -* fail again for the same reason. -*/ -dprintk ("nfsd4_process_open1:" -" replay with no replay cache\n" ); - goto renew; - } - }else { - status = nfserr_bad_seqid; - goto out; - } - }else { -/* nfs4_stateowner not found. -* Verify clientid and instantiate new nfs4_stateowner. -* If verify fails this is presumably the result of the -* client's lease expiring. -*/ - status = nfserr_expired; + open->op_stateowner = sop; +if (!sop) { +/* Make sure the client's lease hasn't expired. */ clp =find_confirmed_client (clientid);if (clp ==NULL ) - goto out; +return nfserr_expired; + goto renew; } - status = nfserr_resource; - sop =alloc_init_open_stateowner (strhashval, clp, open); -if (sop ==NULL ) - goto out; - open->op_stateowner = sop; +if (!sop->so_confirmed) { +/* Replace unconfirmed owners without checking for replay. */ + clp = sop->so_client; +release_stateowner (sop); + open->op_stateowner =NULL ; + goto renew; + } +if (open->op_seqid == sop->so_seqid -1 ) { +if (sop->so_replay.rp_buflen) +return NFSERR_REPLAY_ME ; +/* The original OPEN failed so spectacularly +* that we don't even have replay data saved! +* Therefore, we have no choice but to continue +* processing this OPEN; presumably, we'll +* fail again for the same reason. +*/ +dprintk ("nfsd4_process_open1: replay with no replay cache\n" ); + goto renew; + } +if (open->op_seqid != sop->so_seqid) +return nfserr_bad_seqid; renew: - status = nfs_ok; +if (open->op_stateowner ==NULL ) { + sop =alloc_init_open_stateowner (strhashval, clp, open); +if (sop ==NULL ) +return nfserr_resource; + open->op_stateowner = sop; + } +list_del_init (&sop->so_close_lru);renew_client (sop->so_client); -out: -return status; +return nfs_ok; } static inline int
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: Fix bug in rdattr_error return
In reply to NeilBrownFix bug in rdattr_error return which causes correct error code to be overwritten by nfserr_toosmall.
### Diffstat output
./fs/nfsd/nfs4xdr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/nfsd/nfs4xdr.c renamed from fs/nfsd/nfs4xdr.c~current~ +3 -2
@@ -1764,10 +1764,11 @@ nfsd4_encode_dirent(struct readdir_cd *c*/ if (!(cd->rd_bmval[0 ] &FATTR4_WORD0_RDATTR_ERROR )) goto fail; - nfserr = nfserr_toosmall; p =nfsd4_encode_rdattr_error (p, buflen, nfserr); -if (p ==NULL ) +if (p ==NULL ) { + nfserr = nfserr_toosmall; goto fail; + } } cd->buflen -= (p - cd->buffer); cd->buffer = p;
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: clean up settattr code
In reply to NeilBrownClean up some unnecessary special-casing in the setattr code..
### Diffstat output
./fs/nfsd/nfs4proc.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
fs/nfsd/nfs4proc.c renamed from fs/nfsd/nfs4proc.c~current~ +1 -9
@@ -594,10 +594,6 @@ nfsd4_setattr(struct svc_rqst *rqstp, st {int status = nfs_ok; -if (!current_fh->fh_dentry) -return nfserr_nofilehandle; - - status = nfs_ok;if (setattr->sa_iattr.ia_valid &ATTR_SIZE ) {nfs4_lock_state (); status = nfs4_preprocess_stateid_op(current_fh,
@@ -799,17 +795,13 @@ nfsd4_proc_compound(struct svc_rqst *rqs/* All operations except RENEW, SETCLIENTID, RESTOREFH * SETCLIENTID_CONFIRM, PUTFH and PUTROOTFH * require a valid current filehandle -* -* SETATTR NOFILEHANDLE error handled in nfsd4_setattr -* due to required returned bitmap argument */ if ((!current_fh->fh_dentry) && !((op->opnum ==OP_PUTFH ) || (op->opnum ==OP_PUTROOTFH ) || (op->opnum ==OP_SETCLIENTID ) || (op->opnum ==OP_SETCLIENTID_CONFIRM ) || (op->opnum ==OP_RENEW ) || (op->opnum ==OP_RESTOREFH ) || - (op->opnum ==OP_RELEASE_LOCKOWNER ) || - (op->opnum ==OP_SETATTR ))) { + (op->opnum ==OP_RELEASE_LOCKOWNER ))) { op->status = nfserr_nofilehandle; goto encode_op; }
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4_truncate() bogus return value
In reply to NeilBrownFrom: Al Viro <[email protected]>
Date: 1135492779 -0500
-EINVAL (in host order, no less) is not a good thing to return to client. nfsd4_truncate() returns it in one case and its callers expect nfs_.... from it. AFAICS, it should be nfserr_inval
### Diffstat output
./fs/nfsd/nfs4state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +1 -1
@@ -1600,7 +1600,7 @@ nfsd4_truncate(struct svc_rqst *rqstp, sif (!open->op_truncate)return 0 ;if (!(open->op_share_access &NFS4_SHARE_ACCESS_WRITE )) -return -EINVAL ; +return nfserr_inval;return nfsd_setattr (rqstp, fh, &iattr,0 , (time_t )0 ); }
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: no replays on unconfirmed owners
In reply to NeilBrownWe shouldn't check for replays until after checking whether the open owner is confirmed. Clients are allowed to reuse openowners without bumping the seqid.
### Diffstat output
./fs/nfsd/nfs4state.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +11 -13
@@ -1465,8 +1465,16 @@ nfsd4_process_open1(struct nfsd4_open *o sop =find_openstateowner_str (strhashval, open);if (sop) { open->op_stateowner = sop; -/* check for replay */ -if (open->op_seqid == sop->so_seqid -1 ){ +if (!sop->so_confirmed) { +/* Replace any unconfirmed stateowner without +* even checking for replays */ + clp = sop->so_client; +release_stateowner (sop); + }else if (open->op_seqid == sop->so_seqid) { +/* normal case */ + goto renew; + }else if (open->op_seqid == sop->so_seqid -1 ) { +/* replay */ if (sop->so_replay.rp_buflen)return NFSERR_REPLAY_ME ;else {
@@ -1480,19 +1488,9 @@ nfsd4_process_open1(struct nfsd4_open *o " replay with no replay cache\n"); goto renew; } - }else if (sop->so_confirmed) { -if (open->op_seqid == sop->so_seqid) - goto renew; + }else { status = nfserr_bad_seqid; goto out; - }else { -/* If we get here, we received an OPEN for an -* unconfirmed nfs4_stateowner. Since the seqid's are -* different, purge the existing nfs4_stateowner, and -* instantiate a new one. -*/ - clp = sop->so_client; -release_stateowner (sop); } }else {/* nfs4_stateowner not found.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: recovery lookup dir check
In reply to NeilBrownMake sure we get a directory when we look up the recovery directory.
Thanks to Christoph Hellwig for the bug report.
Based on feedback from Christoph and others, we may remove the need for this lookup and just pass in a file descriptor from userspace instead, and/or completely move the directory handling to userspace. For now we're just fixing the obvious bugs.
### Diffstat output
./fs/nfsd/nfs4recover.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/nfsd/nfs4recover.c renamed from fs/nfsd/nfs4recover.c~current~ +4 -3
@@ -399,9 +399,10 @@ nfsd4_init_recdir(char *rec_dirname)nfs4_save_user (&uid, &gid); - status =path_lookup (rec_dirname,LOOKUP_FOLLOW , &rec_dir); -if (status == -ENOENT ) -printk ("NFSD: recovery directory %s doesn't exist\n" , + status =path_lookup (rec_dirname,LOOKUP_FOLLOW |LOOKUP_DIRECTORY , + &rec_dir); +if (status) +printk ("NFSD: unable to find recovery directory %s\n" , rec_dirname);if (!status)
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Re: [PATCH kNFSd 014 of 26] nfsd4: recovery lookup dir check
Quoted 9 lines · NeilBrown
Make sure we get a directory when we look up the recovery directory.
Thanks to Christoph Hellwig for the bug report.
Based on feedback from Christoph and others, we may remove the need for this lookup and just pass in a file descriptor from userspace instead, and/or completely move the directory handling to userspace. For now we're just fixing the obvious bugs.
So can you please work on this real fix now? It's bad enough the current crappy state has been in mainline for so long.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: nfs4state.c miscellaneous goto removals
In reply to NeilBrownRemove some goto's that made the logic here a little more tortuous than necessary.
### Diffstat output
./fs/nfsd/nfs4proc.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-)
fs/nfsd/nfs4proc.c renamed from fs/nfsd/nfs4proc.c~current~ +14 -19
@@ -592,25 +592,21 @@ nfsd4_setattr(struct svc_rqst *rqstp, st status = nfs_ok;if (setattr->sa_iattr.ia_valid &ATTR_SIZE ) {nfs4_lock_state (); -if ((status =nfs4_preprocess_stateid_op (current_fh, - &setattr->sa_stateid, -CHECK_FH |WR_STATE ,NULL ))) { -dprintk ("NFSD: nfsd4_setattr: couldn't process stateid!\n" ); - goto out_unlock; - } + status =nfs4_preprocess_stateid_op (current_fh, + &setattr->sa_stateid,CHECK_FH |WR_STATE ,NULL );nfs4_unlock_state (); +if (status) { +dprintk ("NFSD: nfsd4_setattr: couldn't process stateid!" ); +return status; + } } status = nfs_ok;if (setattr->sa_acl !=NULL ) status =nfsd4_set_nfs4_acl (rqstp, current_fh, setattr->sa_acl);if (status) - goto out; +return status; status =nfsd_setattr (rqstp, current_fh, &setattr->sa_iattr,0 , (time_t )0 ); -out: -return status; -out_unlock: -nfs4_unlock_state ();return status; }
@@ -628,15 +624,17 @@ nfsd4_write(struct svc_rqst *rqstp, strureturn nfserr_inval;nfs4_lock_state (); -if ((status =nfs4_preprocess_stateid_op (current_fh, stateid, -CHECK_FH |WR_STATE , &filp))) { -dprintk ("NFSD: nfsd4_write: couldn't process stateid!\n" ); - goto out; - } + status =nfs4_preprocess_stateid_op (current_fh, stateid, +CHECK_FH |WR_STATE , &filp);if (filp)get_file (filp);nfs4_unlock_state (); +if (status) { +dprintk ("NFSD: nfsd4_write: couldn't process stateid!\n" ); +return status; + } + write->wr_bytes_written = write->wr_buflen; write->wr_how_written = write->wr_stable_how; p = (u32 *)write->wr_verifier.data;
@@ -652,9 +650,6 @@ nfsd4_write(struct svc_rqst *rqstp, struif (status == nfserr_symlink) status = nfserr_inval;return status; -out: -nfs4_unlock_state (); -return status; }/* This routine never returns NFS_OK! If there are no other errors, it
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: fix open_downgrade
In reply to NeilBrownBad bookkeeping of the share reservations when handling open upgrades was causing open downgrade to fail.
### Diffstat output
./fs/nfsd/nfs4state.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +11 -11
@@ -1609,26 +1609,26 @@ nfs4_upgrade_open(struct svc_rqst *rqstp {struct file *filp = stp->st_vfs_file;struct inode *inode = filp->f_dentry->d_inode; -unsigned int share_access; +unsigned int share_access, new_writer;int status;set_access (&share_access, stp->st_access_bmap); - share_access = ~share_access; - share_access &= open->op_share_access; - -if (!(share_access &NFS4_SHARE_ACCESS_WRITE )) -return nfsd4_truncate (rqstp, cur_fh, open); + new_writer = (~share_access) & open->op_share_access + &NFS4_SHARE_ACCESS_WRITE ; - status =get_write_access (inode); -if (status) -return nfserrno (status); +if (new_writer) { + status =get_write_access (inode); +if (status) +return nfserrno (status); + } status =nfsd4_truncate (rqstp, cur_fh, open);if (status) { -put_write_access (inode); +if (new_writer) +put_write_access (inode);return status; }/* remember the open */ - filp->f_mode = (filp->f_mode |FMODE_WRITE ) & ~FMODE_READ ; + filp->f_mode |= open->op_share_access;set_bit (open->op_share_access, &stp->st_access_bmap);set_bit (open->op_share_deny, &stp->st_deny_bmap);
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 NFSERR_SERVERFAULT returned host-endian
In reply to NeilBrownFrom: Al Viro <[email protected]>
Date: 1135492936 -0500
->rp_status is network-endian and nobody byteswaps it before sending to client; putting NFSERR_SERVERFAULT instead of nfserr_serverfault in there is not nice...
### Diffstat output
./fs/nfsd/nfs4state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +2 -2
@@ -1088,7 +1088,7 @@ alloc_init_open_stateowner(unsigned int sop->so_seqid = open->op_seqid; sop->so_confirmed =0 ; rp = &sop->so_replay; - rp->rp_status =NFSERR_SERVERFAULT ; + rp->rp_status = nfserr_serverfault; rp->rp_buflen =0 ; rp->rp_buf = rp->rp_ibuf;return sop;
@@ -2583,7 +2583,7 @@ alloc_init_lock_stateowner(unsigned int sop->so_seqid = lock->lk_new_lock_seqid +1 ; sop->so_confirmed =1 ; rp = &sop->so_replay; - rp->rp_status =NFSERR_SERVERFAULT ; + rp->rp_status = nfserr_serverfault; rp->rp_buflen =0 ; rp->rp_buf = rp->rp_ibuf;return sop;
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd/vfs.c: endianness fixes
In reply to NeilBrownFrom: Al Viro <[email protected]>
Date: 1135476096 -0500
several failure exits return -E<something> instead of nfserr_<something> and vice versa.
### Diffstat output
./fs/nfsd/vfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/nfsd/vfs.c renamed from fs/nfsd/vfs.c~current~ +3 -3
@@ -1134,7 +1134,7 @@ nfsd_create(struct svc_rqst *rqstp, stru"nfsd_create: parent %s/%s not locked!\n" , dentry->d_parent->d_name.name, dentry->d_name.name); - err = -EIO ; + err = nfserr_io; goto out; } }
@@ -1600,7 +1600,7 @@ nfsd_rename(struct svc_rqst *rqstp, struif ((ffhp->fh_export->ex_flags &NFSEXP_MSNFS ) && ((atomic_read (&odentry->d_count) >1 ) || (atomic_read (&ndentry->d_count) >1 ))) { - err = nfserr_perm; + err = -EPERM ; } else#endif err =vfs_rename (fdir, odentry, tdir, ndentry);
@@ -1672,7 +1672,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru#ifdef MSNFS if ((fhp->fh_export->ex_flags &NFSEXP_MSNFS ) && (atomic_read (&rdentry->d_count) >1 )) { - err = nfserr_perm; + err = -EPERM ; } else#endif err =vfs_unlink (dirp, rdentry);
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 Subject: [PATCH] nfsd4_lock() returns bogus values to clients
In reply to NeilBrownFrom: Al Viro <[email protected]>
Date: 1135493243 -0500
missing nfserrno() in default case of a switch by return value of posix_lock_file(); as the result we send negative host-endian to clients that expect positive network-endian, preferably mentioned in RFC... BTW, that case is not impossible - posix_lock_file() can return -ENOLCK and we do not handle that one explicitly.
### Diffstat output
./fs/nfsd/nfs4state.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +3 -0
@@ -2761,7 +2761,10 @@ nfsd4_lock(struct svc_rqst *rqstp, struc goto conflicting_lock;case (EDEADLK ): status = nfserr_deadlock; +dprintk ("NFSD: nfsd4_lock: posix_lock_file() failed! status %d\n" ,status); + goto out;default : + status =nfserrno (status);dprintk ("NFSD: nfsd4_lock: posix_lock_file() failed! status %d\n" ,status); goto out; }
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/1 nfsd4: don't create on open that fails due to ERR_GRACE
In reply to NeilBrownIn an earlier patch (commit b648330a1d741d5df8a5076b2a0a2519c69c8f41) I noted that a too-early grace-period check was preventing us from bumping the sequence id on open. Unfortunately in that patch I stupidly moved the grace-period check back too far, so now an open for create can succesfully create the file while still returning ERR_GRACE.
The correct place for that check is after we've set the open_owner and handled any replays, but before we actually start mucking with the filesystem.
Thanks to Avishay Traeger for reporting the bug.
### Diffstat output
./fs/nfsd/nfs4proc.c | 8 ++++++++ ./fs/nfsd/nfs4state.c | 6 ------ 2 files changed, 8 insertions(+), 6 deletions(-)
fs/nfsd/nfs4proc.c renamed from fs/nfsd/nfs4proc.c~current~ +8 -0
@@ -192,6 +192,14 @@ nfsd4_open(struct svc_rqst *rqstp, struc }if (status) goto out; + +/* Openowner is now set, so sequence id will get bumped. Now we need +* these checks before we do any creates: */ +if (nfs4_in_grace () && open->op_claim_type !=NFS4_OPEN_CLAIM_PREVIOUS ) +return nfserr_grace; +if (!nfs4_in_grace () && open->op_claim_type ==NFS4_OPEN_CLAIM_PREVIOUS ) +return nfserr_no_grace; +switch (open->op_claim_type) {case NFS4_OPEN_CLAIM_DELEGATE_CUR : status = nfserr_inval;
fs/nfsd/nfs4state.c renamed from fs/nfsd/nfs4state.c~current~ +0 -6
@@ -1732,12 +1732,6 @@ nfsd4_process_open2(struct svc_rqst *rqsstruct nfs4_delegation *dp =NULL ;int status; -if (nfs4_in_grace () && open->op_claim_type !=NFS4_OPEN_CLAIM_PREVIOUS ) -return nfserr_grace; - -if (!nfs4_in_grace () && open->op_claim_type ==NFS4_OPEN_CLAIM_PREVIOUS ) -return nfserr_no_grace; - status = nfserr_inval;if (!TEST_ACCESS (open->op_share_access) || !TEST_DENY (open->op_share_deny)) goto out;
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs