* [PATCH kNFSd 0 of 9] Introduction
@ 2004-09-03 2:34 NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 1 of 9] Calls to break_lease in nfsd should be O_NONBLOCKing NeilBrown
` (8 more replies)
0 siblings, 9 replies; 11+ messages in thread
From: NeilBrown @ 2004-09-03 2:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: nfs
9 patches for knfsd in 2.6.9-rc1-mm2
The first three affect all versions. The remaining are v4 specific.
1 - Add O_NONBLOCK to calls to break_lease so the nfs server doesn't block
pointlessly. Return nfserr_jukebox for v3, or just drop the reques for
v2 if we get a EWOULDBLOCK.
2 - Change a return of "ESTALE" or "EACCES" in a situation where ACCES is
argueable the more correct error, and real people have had real problems
that were really fixed.
3 - Fix some indentation.
4 - Check is filesystem supports acls before returning "acl supported" attribute
5-9 assorted v4 locking changes.
NeilBrown
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH kNFSd 1 of 9] Calls to break_lease in nfsd should be O_NONBLOCKing.
2004-09-03 2:34 [PATCH kNFSd 0 of 9] Introduction NeilBrown
@ 2004-09-03 2:34 ` NeilBrown
2004-10-07 20:18 ` J. Bruce Fields
2004-09-03 2:34 ` [PATCH kNFSd 2 of 9] Return EACCES instead of ESTALE for certain filehandle lookup failures NeilBrown
` (7 subsequent siblings)
8 siblings, 1 reply; 11+ messages in thread
From: NeilBrown @ 2004-09-03 2:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: nfs
If we would block, we return "err-jukebox" for nfsv3,
or just drop the request for v2.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
### Diffstat output
./fs/nfsd/nfsproc.c | 1 +
./fs/nfsd/nfssvc.c | 2 ++
./fs/nfsd/vfs.c | 8 ++++----
3 files changed, 7 insertions(+), 4 deletions(-)
diff ./fs/nfsd/nfsproc.c~current~ ./fs/nfsd/nfsproc.c
--- ./fs/nfsd/nfsproc.c~current~ 2004-09-03 11:34:26.000000000 +1000
+++ ./fs/nfsd/nfsproc.c 2004-09-03 11:34:29.000000000 +1000
@@ -586,6 +586,7 @@ nfserrno (int errno)
{ nfserr_dquot, -EDQUOT },
#endif
{ nfserr_stale, -ESTALE },
+ { nfserr_jukebox, -EWOULDBLOCK },
{ nfserr_jukebox, -ETIMEDOUT },
{ nfserr_dropit, -EAGAIN },
{ nfserr_dropit, -ENOMEM },
diff ./fs/nfsd/nfssvc.c~current~ ./fs/nfsd/nfssvc.c
--- ./fs/nfsd/nfssvc.c~current~ 2004-09-03 11:34:26.000000000 +1000
+++ ./fs/nfsd/nfssvc.c 2004-09-03 11:34:29.000000000 +1000
@@ -328,6 +328,8 @@ nfsd_dispatch(struct svc_rqst *rqstp, u3
/* Now call the procedure handler, and encode NFS status. */
nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
+ if (nfserr == nfserr_jukebox && rqstp->rq_vers == 2)
+ nfserr = nfserr_dropit;
if (nfserr == nfserr_dropit) {
dprintk("nfsd: Dropping request due to malloc failure!\n");
nfsd_cache_update(rqstp, RC_NOCACHE, NULL);
diff ./fs/nfsd/vfs.c~current~ ./fs/nfsd/vfs.c
--- ./fs/nfsd/vfs.c~current~ 2004-09-03 11:34:26.000000000 +1000
+++ ./fs/nfsd/vfs.c 2004-09-03 11:34:29.000000000 +1000
@@ -303,8 +303,8 @@ nfsd_setattr(struct svc_rqst *rqstp, str
* If we are changing the size of the file, then
* we need to break all leases.
*/
- err = break_lease(inode, FMODE_WRITE);
- if (err)
+ err = break_lease(inode, FMODE_WRITE | O_NONBLOCK);
+ if (err) /* ENOMEM or EWOULDBLOCK */
goto out_nfserr;
err = get_write_access(inode);
@@ -669,8 +669,8 @@ nfsd_open(struct svc_rqst *rqstp, struct
* Check to see if there are any leases on this file.
* This may block while leases are broken.
*/
- err = break_lease(inode, (access & MAY_WRITE) ? FMODE_WRITE : 0);
- if (err)
+ err = break_lease(inode, O_NONBLOCK | ((access & MAY_WRITE) ? FMODE_WRITE : 0));
+ if (err) /* NOMEM or WOULDBLOCK */
goto out_nfserr;
if (access & MAY_WRITE) {
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH kNFSd 6 of 9] nfsd4 could leak a stateid in an error path
2004-09-03 2:34 [PATCH kNFSd 0 of 9] Introduction NeilBrown
` (4 preceding siblings ...)
2004-09-03 2:34 ` [PATCH kNFSd 5 of 9] trivial cleanup of nfs4state.c NeilBrown
@ 2004-09-03 2:34 ` NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 3 of 9] fix incorrect indentation in fh_verify NeilBrown
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: NeilBrown @ 2004-09-03 2:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: nfs
nfsd4 could leak a stateid in a case of kmalloc failure; fix.
Signed-off-by: Andy Adamson <andros@umich.edu>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
### Diffstat output
./fs/nfsd/nfs4state.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)
diff ./fs/nfsd/nfs4state.c~current~ ./fs/nfsd/nfs4state.c
--- ./fs/nfsd/nfs4state.c~current~ 2004-09-03 11:57:20.000000000 +1000
+++ ./fs/nfsd/nfs4state.c 2004-09-03 11:57:34.000000000 +1000
@@ -2153,8 +2153,10 @@ nfsd4_lock(struct svc_rqst *rqstp, struc
if (!(lock->lk_stateowner = alloc_init_lock_stateowner(strhashval, open_sop->so_client, open_stp, lock)))
goto out;
if ((lock_stp = alloc_init_lock_stateid(lock->lk_stateowner,
- fp, open_stp)) == NULL)
+ fp, open_stp)) == NULL) {
+ release_stateowner(lock->lk_stateowner);
goto out;
+ }
/* bump the open seqid used to create the lock */
open_sop->so_seqid++;
} else {
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH kNFSd 8 of 9] nfsd4: store current->tgid instead of lockowner hash in fl_pid
2004-09-03 2:34 [PATCH kNFSd 0 of 9] Introduction NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 1 of 9] Calls to break_lease in nfsd should be O_NONBLOCKing NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 2 of 9] Return EACCES instead of ESTALE for certain filehandle lookup failures NeilBrown
@ 2004-09-03 2:34 ` NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 9 of 9] Remove redundant initialization in nfsd4_lockt NeilBrown
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: NeilBrown @ 2004-09-03 2:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: nfs
The file_lock.fl_pid is no longer used in posix_same_owner() tests. So just
set it to current->tgid for informational purposes.
Signed-off-by: Andy Adamson <andros@umich.edu>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
### Diffstat output
./fs/nfsd/nfs4state.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff ./fs/nfsd/nfs4state.c~current~ ./fs/nfsd/nfs4state.c
--- ./fs/nfsd/nfs4state.c~current~ 2004-09-03 11:57:34.000000000 +1000
+++ ./fs/nfsd/nfs4state.c 2004-09-03 11:57:34.000000000 +1000
@@ -1950,9 +1950,10 @@ static inline void
nfs4_set_lock_denied(struct file_lock *fl, struct nfsd4_lock_denied *deny)
{
struct nfs4_stateowner *sop = (struct nfs4_stateowner *) fl->fl_owner;
+ unsigned int hval = lockownerid_hashval(sop->so_id);
deny->ld_sop = NULL;
- if (nfs4_verify_lock_stateowner(sop, fl->fl_pid))
+ if (nfs4_verify_lock_stateowner(sop, hval))
deny->ld_sop = sop;
deny->ld_start = fl->fl_start;
deny->ld_length = ~(u64)0;
@@ -2196,7 +2197,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struc
goto out;
}
file_lock.fl_owner = (fl_owner_t) lock->lk_stateowner;
- file_lock.fl_pid = lockownerid_hashval(lock->lk_stateowner->so_id);
+ file_lock.fl_pid = current->tgid;
file_lock.fl_file = filp;
file_lock.fl_flags = FL_POSIX;
@@ -2322,7 +2323,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, stru
sop = lockt->lt_stateowner;
if (sop) {
file_lock.fl_owner = (fl_owner_t) sop;
- file_lock.fl_pid = lockownerid_hashval(sop->so_id);
+ file_lock.fl_pid = current->tgid;
} else {
file_lock.fl_owner = NULL;
file_lock.fl_pid = 0;
@@ -2386,7 +2387,7 @@ nfsd4_locku(struct svc_rqst *rqstp, stru
locks_init_lock(&file_lock);
file_lock.fl_type = F_UNLCK;
file_lock.fl_owner = (fl_owner_t) locku->lu_stateowner;
- file_lock.fl_pid = lockownerid_hashval(locku->lu_stateowner->so_id);
+ file_lock.fl_pid = current->tgid;
file_lock.fl_file = filp;
file_lock.fl_flags = FL_POSIX;
file_lock.fl_start = locku->lu_offset;
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH kNFSd 3 of 9] fix incorrect indentation in fh_verify
2004-09-03 2:34 [PATCH kNFSd 0 of 9] Introduction NeilBrown
` (5 preceding siblings ...)
2004-09-03 2:34 ` [PATCH kNFSd 6 of 9] nfsd4 could leak a stateid in an error path NeilBrown
@ 2004-09-03 2:34 ` NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 7 of 9] nfsd4: postpone release of stateowner on CLOSE NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 4 of 9] nfsd4: Support acl_support attribute NeilBrown
8 siblings, 0 replies; 11+ messages in thread
From: NeilBrown @ 2004-09-03 2:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: nfs
fix incorrect indentation in fh_verify
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
### Diffstat output
./fs/nfsd/nfsfh.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff ./fs/nfsd/nfsfh.c~current~ ./fs/nfsd/nfsfh.c
--- ./fs/nfsd/nfsfh.c~current~ 2004-09-03 11:56:47.000000000 +1000
+++ ./fs/nfsd/nfsfh.c 2004-09-03 11:56:56.000000000 +1000
@@ -190,10 +190,10 @@ fh_verify(struct svc_rqst *rqstp, struct
dentry = dget(exp->ex_dentry);
else {
struct export_operations *nop = exp->ex_mnt->mnt_sb->s_export_op;
- dentry = CALL(nop,decode_fh)(exp->ex_mnt->mnt_sb,
- datap, data_left,
- fileid_type,
- nfsd_acceptable, exp);
+ dentry = CALL(nop,decode_fh)(exp->ex_mnt->mnt_sb,
+ datap, data_left,
+ fileid_type,
+ nfsd_acceptable, exp);
}
if (dentry == NULL)
goto out;
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH kNFSd 4 of 9] nfsd4: Support acl_support attribute
2004-09-03 2:34 [PATCH kNFSd 0 of 9] Introduction NeilBrown
` (7 preceding siblings ...)
2004-09-03 2:34 ` [PATCH kNFSd 7 of 9] nfsd4: postpone release of stateowner on CLOSE NeilBrown
@ 2004-09-03 2:34 ` NeilBrown
8 siblings, 0 replies; 11+ messages in thread
From: NeilBrown @ 2004-09-03 2:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: nfs
The nfs4 attributes supported_attrs and aclsupport should not be
static; they need to depend on the exported filesystem's acl support. Test the
latter by attempting to get an acl, and adjust the returned attributes
apropriately.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
### Diffstat output
./fs/nfsd/nfs4xdr.c | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diff ./fs/nfsd/nfs4xdr.c~current~ ./fs/nfsd/nfs4xdr.c
--- ./fs/nfsd/nfs4xdr.c~current~ 2004-09-03 11:56:48.000000000 +1000
+++ ./fs/nfsd/nfs4xdr.c 2004-09-03 11:57:04.000000000 +1000
@@ -1414,6 +1414,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, s
u64 dummy64;
u32 *p = buffer;
int status;
+ int aclsupport = 0;
struct nfs4_acl *acl = NULL;
BUG_ON(bmval1 & NFSD_WRITEONLY_ATTRS_WORD1);
@@ -1437,12 +1438,16 @@ nfsd4_encode_fattr(struct svc_fh *fhp, s
goto out;
fhp = &tempfh;
}
- if (bmval0 & FATTR4_WORD0_ACL) {
+ if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT
+ | FATTR4_WORD0_SUPPORTED_ATTRS)) {
status = nfsd4_get_nfs4_acl(rqstp, dentry, &acl);
- if (status == -EOPNOTSUPP)
- bmval0 &= ~FATTR4_WORD0_ACL;
- else if (status < 0)
- goto out_nfserr;
+ aclsupport = (status == 0);
+ if (bmval0 & FATTR4_WORD0_ACL) {
+ if (status == -EOPNOTSUPP)
+ bmval0 &= ~FATTR4_WORD0_ACL;
+ else if (status != 0)
+ goto out_nfserr;
+ }
}
if ((buflen -= 16) < 0)
goto out_resource;
@@ -1456,9 +1461,9 @@ nfsd4_encode_fattr(struct svc_fh *fhp, s
if ((buflen -= 12) < 0)
goto out_resource;
WRITE32(2);
- /* XXX Should depend on exported filesystem (e.g.
- * for acl support) */
- WRITE32(NFSD_SUPPORTED_ATTRS_WORD0);
+ WRITE32(aclsupport ?
+ NFSD_SUPPORTED_ATTRS_WORD0 :
+ NFSD_SUPPORTED_ATTRS_WORD0 & ~FATTR4_WORD0_ACL);
WRITE32(NFSD_SUPPORTED_ATTRS_WORD1);
}
if (bmval0 & FATTR4_WORD0_TYPE) {
@@ -1565,8 +1570,8 @@ out_acl:
if (bmval0 & FATTR4_WORD0_ACLSUPPORT) {
if ((buflen -= 4) < 0)
goto out_resource;
- /* XXX: should depend on exported filesystem: */
- WRITE32(ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL);
+ WRITE32(aclsupport ?
+ ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL : 0);
}
if (bmval0 & FATTR4_WORD0_CANSETTIME) {
if ((buflen -= 4) < 0)
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH kNFSd 9 of 9] Remove redundant initialization in nfsd4_lockt
2004-09-03 2:34 [PATCH kNFSd 0 of 9] Introduction NeilBrown
` (2 preceding siblings ...)
2004-09-03 2:34 ` [PATCH kNFSd 8 of 9] nfsd4: store current->tgid instead of lockowner hash in fl_pid NeilBrown
@ 2004-09-03 2:34 ` NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 5 of 9] trivial cleanup of nfs4state.c NeilBrown
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: NeilBrown @ 2004-09-03 2:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: nfs
No need to set fl_owner and fl_pid to 0, since that's already been done by
locks_init_lock.
Signed-off-by: Andy Adamson <andros@umich.edu>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
### Diffstat output
./fs/nfsd/nfs4state.c | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
diff ./fs/nfsd/nfs4state.c~current~ ./fs/nfsd/nfs4state.c
--- ./fs/nfsd/nfs4state.c~current~ 2004-09-03 11:57:34.000000000 +1000
+++ ./fs/nfsd/nfs4state.c 2004-09-03 11:57:34.000000000 +1000
@@ -2268,7 +2268,6 @@ int
nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lockt *lockt)
{
struct inode *inode;
- struct nfs4_stateowner *sop;
struct file file;
struct file_lock file_lock;
struct file_lock *conflicting_lock;
@@ -2320,14 +2319,9 @@ nfsd4_lockt(struct svc_rqst *rqstp, stru
find_lockstateowner_str(strhashval, &lockt->lt_owner,
&lockt->lt_clientid,
&lockt->lt_stateowner);
- sop = lockt->lt_stateowner;
- if (sop) {
- file_lock.fl_owner = (fl_owner_t) sop;
- file_lock.fl_pid = current->tgid;
- } else {
- file_lock.fl_owner = NULL;
- file_lock.fl_pid = 0;
- }
+ if (lockt->lt_stateowner)
+ file_lock.fl_owner = (fl_owner_t)lockt->lt_stateowner;
+ file_lock.fl_pid = current->tgid;
file_lock.fl_flags = FL_POSIX;
file_lock.fl_start = lockt->lt_offset;
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH kNFSd 5 of 9] trivial cleanup of nfs4state.c
2004-09-03 2:34 [PATCH kNFSd 0 of 9] Introduction NeilBrown
` (3 preceding siblings ...)
2004-09-03 2:34 ` [PATCH kNFSd 9 of 9] Remove redundant initialization in nfsd4_lockt NeilBrown
@ 2004-09-03 2:34 ` NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 6 of 9] nfsd4 could leak a stateid in an error path NeilBrown
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: NeilBrown @ 2004-09-03 2:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: nfs
Whitespace cleanup, fix one dprintk, remove superfluous casts of NULL.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
### Diffstat output
./fs/nfsd/nfs4state.c | 72 +++++++++++++++++++++++++-------------------------
1 files changed, 36 insertions(+), 36 deletions(-)
diff ./fs/nfsd/nfs4state.c~current~ ./fs/nfsd/nfs4state.c
--- ./fs/nfsd/nfs4state.c~current~ 2004-09-03 11:56:48.000000000 +1000
+++ ./fs/nfsd/nfs4state.c 2004-09-03 11:57:20.000000000 +1000
@@ -236,7 +236,7 @@ static struct nfs4_client *
create_client(struct xdr_netobj name) {
struct nfs4_client *clp;
- if(!(clp = alloc_client(name)))
+ if (!(clp = alloc_client(name)))
goto out;
INIT_LIST_HEAD(&clp->cl_idhash);
INIT_LIST_HEAD(&clp->cl_strhash);
@@ -268,7 +268,7 @@ copy_cred(struct svc_cred *target, struc
static int
cmp_name(struct xdr_netobj *n1, struct xdr_netobj *n2) {
- if(!n1 || !n2)
+ if (!n1 || !n2)
return 0;
return((n1->len == n2->len) && !memcmp(n1->data, n2->data, n2->len));
}
@@ -399,7 +399,7 @@ parse_ipv4(unsigned int addr_len, char *
return 0;
}
cbaddr |= (temp << shift);
- if(shift > 0)
+ if (shift > 0)
shift -= 8;
}
*cbaddrp = cbaddr;
@@ -411,7 +411,7 @@ parse_ipv4(unsigned int addr_len, char *
return 0;
}
cbport |= (temp << shift);
- if(shift > 0)
+ if (shift > 0)
shift -= 8;
}
*cbportp = cbport;
@@ -423,7 +423,7 @@ gen_callback(struct nfs4_client *clp, st
{
struct nfs4_callback *cb = &clp->cl_callback;
- if( !(parse_ipv4(se->se_callback_addr_len, se->se_callback_addr_val,
+ 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;
@@ -431,9 +431,9 @@ gen_callback(struct nfs4_client *clp, st
}
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;
+ cb->cb_prog = se->se_callback_prog;
+ cb->cb_ident = se->se_callback_ident;
+ cb->cb_parsed = 1;
}
/*
@@ -812,7 +812,7 @@ alloc_init_file(unsigned int hashval, st
alloc_file++;
return fp;
}
- return (struct nfs4_file *)NULL;
+ return NULL;
}
static void
@@ -825,7 +825,7 @@ release_all_files(void)
while (!list_empty(&file_hashtbl[i])) {
fp = list_entry(file_hashtbl[i].next, struct nfs4_file, fi_hash);
/* this should never be more than once... */
- if(!list_empty(&fp->fi_perfile)) {
+ if (!list_empty(&fp->fi_perfile)) {
printk("ERROR: release_all_files: file %p is open, creating dangling state !!!\n",fp);
}
release_file(fp);
@@ -839,20 +839,20 @@ alloc_stateowner(struct xdr_netobj *owne
struct nfs4_stateowner *sop;
if ((sop = kmalloc(sizeof(struct nfs4_stateowner),GFP_KERNEL))) {
- if((sop->so_owner.data = kmalloc(owner->len, GFP_KERNEL))) {
+ if ((sop->so_owner.data = kmalloc(owner->len, GFP_KERNEL))) {
memcpy(sop->so_owner.data, owner->data, owner->len);
sop->so_owner.len = owner->len;
return sop;
}
kfree(sop);
}
- return (struct nfs4_stateowner *)NULL;
+ return NULL;
}
/* should use a slab cache */
static void
free_stateowner(struct nfs4_stateowner *sop) {
- if(sop) {
+ if (sop) {
kfree(sop->so_owner.data);
kfree(sop);
sop = NULL;
@@ -867,7 +867,7 @@ alloc_init_open_stateowner(unsigned int
unsigned int idhashval;
if (!(sop = alloc_stateowner(&open->op_owner)))
- return (struct nfs4_stateowner *)NULL;
+ return NULL;
idhashval = ownerid_hashval(current_ownerid);
INIT_LIST_HEAD(&sop->so_idhash);
INIT_LIST_HEAD(&sop->so_strhash);
@@ -921,7 +921,7 @@ release_stateowner(struct nfs4_stateowne
while (!list_empty(&sop->so_perfilestate)) {
stp = list_entry(sop->so_perfilestate.next,
struct nfs4_stateid, st_perfilestate);
- if(sop->so_is_open_owner)
+ if (sop->so_is_open_owner)
release_stateid(stp, OPEN_STATE);
else
release_stateid(stp, LOCK_STATE);
@@ -960,7 +960,7 @@ release_stateid(struct nfs4_stateid *stp
list_del_perfile++;
list_del(&stp->st_perfile);
list_del(&stp->st_perfilestate);
- if((stp->st_vfs_set) && (flags & OPEN_STATE)) {
+ if ((stp->st_vfs_set) && (flags & OPEN_STATE)) {
release_stateid_lockowner(stp);
nfsd_close(stp->st_vfs_file);
vfsclose++;
@@ -991,8 +991,8 @@ move_to_close_lru(struct nfs4_stateowner
list_del_init(&sop->so_strhash);
list_del_init(&sop->so_perlockowner);
- list_add_tail(&sop->so_close_lru, &close_lru);
- sop->so_time = get_seconds();
+ list_add_tail(&sop->so_close_lru, &close_lru);
+ sop->so_time = get_seconds();
}
void
@@ -1030,7 +1030,7 @@ find_openstateowner_str(unsigned int has
struct nfs4_stateowner *local = NULL;
list_for_each_entry(local, &ownerstr_hashtbl[hashval], so_strhash) {
- if(!cmp_owner_str(local, &open->op_owner, &open->op_clientid))
+ if (!cmp_owner_str(local, &open->op_owner, &open->op_clientid))
continue;
*op = local;
return(1);
@@ -1078,7 +1078,7 @@ set_access(unsigned int *access, unsigne
*access = 0;
for (i = 1; i < 4; i++) {
- if(test_bit(i, &bmap))
+ if (test_bit(i, &bmap))
*access |= i;
}
}
@@ -1089,7 +1089,7 @@ set_deny(unsigned int *deny, unsigned lo
*deny = 0;
for (i = 0; i < 4; i++) {
- if(test_bit(i, &bmap))
+ if (test_bit(i, &bmap))
*deny |= i ;
}
}
@@ -1278,7 +1278,7 @@ nfsd4_process_open2(struct svc_rqst *rqs
/* Search for conflicting share reservations */
status = nfserr_share_denied;
list_for_each_entry(stq, &fp->fi_perfile, st_perfile) {
- if(stq->st_stateowner == sop) {
+ if (stq->st_stateowner == sop) {
stp = stq;
continue;
}
@@ -1484,7 +1484,7 @@ find_openstateowner_id(u32 st_id, int fl
dprintk("NFSD: find_openstateowner_id %d\n", st_id);
if (flags & CLOSE_STATE) {
list_for_each_entry(local, &close_lru, so_close_lru) {
- if(local->so_id == st_id)
+ if (local->so_id == st_id)
return local;
}
}
@@ -1888,16 +1888,16 @@ find_stateid(stateid_t *stid, int flags)
if ((flags & LOCK_STATE) || (flags & RDWR_STATE)) {
hashval = stateid_hashval(st_id, f_id);
list_for_each_entry(local, &lockstateid_hashtbl[hashval], st_hash) {
- if((local->st_stateid.si_stateownerid == st_id) &&
- (local->st_stateid.si_fileid == f_id))
+ if ((local->st_stateid.si_stateownerid == st_id) &&
+ (local->st_stateid.si_fileid == f_id))
return local;
}
}
if ((flags & OPEN_STATE) || (flags & RDWR_STATE)) {
hashval = stateid_hashval(st_id, f_id);
list_for_each_entry(local, &stateid_hashtbl[hashval], st_hash) {
- if((local->st_stateid.si_stateownerid == st_id) &&
- (local->st_stateid.si_fileid == f_id))
+ if ((local->st_stateid.si_stateownerid == st_id) &&
+ (local->st_stateid.si_fileid == f_id))
return local;
}
} else
@@ -1967,7 +1967,7 @@ find_lockstateowner(struct xdr_netobj *o
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))
+ if (!cmp_owner_str(local, owner, clid))
continue;
return local;
}
@@ -1980,7 +1980,7 @@ find_lockstateowner_str(unsigned int has
struct nfs4_stateowner *local = NULL;
list_for_each_entry(local, &lock_ownerstr_hashtbl[hashval], so_strhash) {
- if(!cmp_owner_str(local, owner, clid))
+ if (!cmp_owner_str(local, owner, clid))
continue;
*op = local;
return(1);
@@ -2005,7 +2005,7 @@ alloc_init_lock_stateowner(unsigned int
unsigned int idhashval;
if (!(sop = alloc_stateowner(&lock->lk_new_owner)))
- return (struct nfs4_stateowner *)NULL;
+ return NULL;
idhashval = lockownerid_hashval(current_ownerid);
INIT_LIST_HEAD(&sop->so_idhash);
INIT_LIST_HEAD(&sop->so_strhash);
@@ -2068,7 +2068,7 @@ int
check_lock_length(u64 offset, u64 length)
{
return ((length == 0) || ((length != ~(u64)0) &&
- LOFF_OVERFLOW(offset, length)));
+ LOFF_OVERFLOW(offset, length)));
}
/*
@@ -2210,7 +2210,7 @@ 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_test_lock passed. posix_lock_file status %d\n",status);
+ dprintk("NFSD: nfsd4_lock: posix_lock_file status %d\n",status);
switch (-status) {
case 0: /* success! */
update_stateid(&lock_stp->st_stateid);
@@ -2459,7 +2459,7 @@ nfsd4_release_lockowner(struct svc_rqst
nfs4_lock_state();
- status = nfs_ok;
+ status = nfs_ok;
local = find_lockstateowner(owner, clid);
if (local) {
struct nfs4_stateid *stp;
@@ -2469,7 +2469,7 @@ nfsd4_release_lockowner(struct svc_rqst
status = nfserr_locks_held;
list_for_each_entry(stp, &local->so_perfilestate,
st_perfilestate) {
- if(stp->st_vfs_set) {
+ if (stp->st_vfs_set) {
if (check_for_locks(stp->st_vfs_file, local))
goto out;
}
@@ -2496,7 +2496,7 @@ alloc_reclaim(int namelen)
kfree(crp);
return NULL;
}
- return crp;
+ return crp;
}
/*
@@ -2566,7 +2566,7 @@ nfs4_find_reclaim_client(clientid_t *cli
strhashval = clientstr_hashval(client->cl_name.data,
client->cl_name.len);
list_for_each_entry(crp, &reclaim_str_hashtbl[strhashval], cr_strhash) {
- if(cmp_name(&crp->cr_name, &client->cl_name)) {
+ if (cmp_name(&crp->cr_name, &client->cl_name)) {
return crp;
}
}
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH kNFSd 2 of 9] Return EACCES instead of ESTALE for certain filehandle lookup failures
2004-09-03 2:34 [PATCH kNFSd 0 of 9] Introduction NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 1 of 9] Calls to break_lease in nfsd should be O_NONBLOCKing NeilBrown
@ 2004-09-03 2:34 ` NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 8 of 9] nfsd4: store current->tgid instead of lockowner hash in fl_pid NeilBrown
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: NeilBrown @ 2004-09-03 2:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: nfs
As 'nfs_acceptable' uses the authnetication user in it's checks,
the filehandle might not be truely "stale" - EACCES is safer.
Thanks Olaf Kirch <okir@suse.de> and others.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
### Diffstat output
./fs/exportfs/expfs.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletion(-)
diff ./fs/exportfs/expfs.c~current~ ./fs/exportfs/expfs.c
--- ./fs/exportfs/expfs.c~current~ 2004-09-03 11:34:26.000000000 +1000
+++ ./fs/exportfs/expfs.c 2004-09-03 11:37:53.000000000 +1000
@@ -283,7 +283,12 @@ find_exported_dentry(struct super_block
/* drat - I just cannot find anything acceptable */
dput(result);
- return ERR_PTR(-ESTALE);
+ /* It might be justifiable to return ESTALE here,
+ * but the filehandle at-least looks reasonable good
+ * and it just be a permission problem, so returning
+ * -EACCESS is safer
+ */
+ return ERR_PTR(-EACCES);
err_target:
dput(target_dir);
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH kNFSd 7 of 9] nfsd4: postpone release of stateowner on CLOSE
2004-09-03 2:34 [PATCH kNFSd 0 of 9] Introduction NeilBrown
` (6 preceding siblings ...)
2004-09-03 2:34 ` [PATCH kNFSd 3 of 9] fix incorrect indentation in fh_verify NeilBrown
@ 2004-09-03 2:34 ` NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 4 of 9] nfsd4: Support acl_support attribute NeilBrown
8 siblings, 0 replies; 11+ messages in thread
From: NeilBrown @ 2004-09-03 2:34 UTC (permalink / raw)
To: Andrew Morton; +Cc: nfs
Postpone the release of a stateowner on CLOSE for lease time to enable the
CLOSE replay cache. Place stateowner on the close_lru list to be reaped by the
laundromat service.
Signed-off-by: Andy Adamson <andros@umich.edu>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
### Diffstat output
./fs/nfsd/nfs4state.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff ./fs/nfsd/nfs4state.c~current~ ./fs/nfsd/nfs4state.c
--- ./fs/nfsd/nfs4state.c~current~ 2004-09-03 11:57:34.000000000 +1000
+++ ./fs/nfsd/nfs4state.c 2004-09-03 11:57:34.000000000 +1000
@@ -908,7 +908,7 @@ release_stateid_lockowner(struct nfs4_st
}
static void
-release_stateowner(struct nfs4_stateowner *sop)
+unhash_stateowner(struct nfs4_stateowner *sop)
{
struct nfs4_stateid *stp;
@@ -916,7 +916,6 @@ release_stateowner(struct nfs4_stateowne
list_del(&sop->so_strhash);
list_del(&sop->so_perclient);
list_del(&sop->so_perlockowner);
- list_del(&sop->so_close_lru);
del_perclient++;
while (!list_empty(&sop->so_perfilestate)) {
stp = list_entry(sop->so_perfilestate.next,
@@ -926,6 +925,13 @@ release_stateowner(struct nfs4_stateowne
else
release_stateid(stp, LOCK_STATE);
}
+}
+
+static void
+release_stateowner(struct nfs4_stateowner *sop)
+{
+ unhash_stateowner(sop);
+ list_del(&sop->so_close_lru);
free_stateowner(sop);
}
@@ -986,11 +992,8 @@ void
move_to_close_lru(struct nfs4_stateowner *sop)
{
dprintk("NFSD: move_to_close_lru nfs4_stateowner %p\n", sop);
- /* remove stateowner from all other hash lists except perclient */
- list_del_init(&sop->so_idhash);
- list_del_init(&sop->so_strhash);
- list_del_init(&sop->so_perlockowner);
+ unhash_stateowner(sop);
list_add_tail(&sop->so_close_lru, &close_lru);
sop->so_time = get_seconds();
}
@@ -1456,7 +1459,8 @@ nfs4_laundromat(void)
}
dprintk("NFSD: purging unused open stateowner (so_id %d)\n",
sop->so_id);
- release_stateowner(sop);
+ list_del(&sop->so_close_lru);
+ free_stateowner(sop);
}
if (clientid_val < NFSD_LAUNDROMAT_MINTIMEOUT)
clientid_val = NFSD_LAUNDROMAT_MINTIMEOUT;
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH kNFSd 1 of 9] Calls to break_lease in nfsd should be O_NONBLOCKing.
2004-09-03 2:34 ` [PATCH kNFSd 1 of 9] Calls to break_lease in nfsd should be O_NONBLOCKing NeilBrown
@ 2004-10-07 20:18 ` J. Bruce Fields
0 siblings, 0 replies; 11+ messages in thread
From: J. Bruce Fields @ 2004-10-07 20:18 UTC (permalink / raw)
To: NeilBrown; +Cc: Andrew Morton, nfs
On Fri, Sep 03, 2004 at 12:34:25PM +1000, NeilBrown wrote:
>
> If we would block, we return "err-jukebox" for nfsv3,
> or just drop the request for v2.
Sorry, only just noticed there's a problem here:
> diff ./fs/nfsd/nfsproc.c~current~ ./fs/nfsd/nfsproc.c
> --- ./fs/nfsd/nfsproc.c~current~ 2004-09-03 11:34:26.000000000 +1000
> +++ ./fs/nfsd/nfsproc.c 2004-09-03 11:34:29.000000000 +1000
> @@ -586,6 +586,7 @@ nfserrno (int errno)
> { nfserr_dquot, -EDQUOT },
> #endif
> { nfserr_stale, -ESTALE },
> + { nfserr_jukebox, -EWOULDBLOCK },
> { nfserr_jukebox, -ETIMEDOUT },
> { nfserr_dropit, -EAGAIN },
> { nfserr_dropit, -ENOMEM },
Note that EWOULDBLOCK is defined to be EAGAIN in
include/asm-generic/errno.h, so the effect of this is to map EAGAIN to
nfserr_jukebox instead of nfserr_dropit.
The cache upcall deferral code depends on EAGAIN being mapped to
nfserr_dropit. So now whenever cache upcall deferral happens, the
client gets a nfserr_jukebox response, which isn't what we want.
--b.
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-10-07 20:19 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-03 2:34 [PATCH kNFSd 0 of 9] Introduction NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 1 of 9] Calls to break_lease in nfsd should be O_NONBLOCKing NeilBrown
2004-10-07 20:18 ` J. Bruce Fields
2004-09-03 2:34 ` [PATCH kNFSd 2 of 9] Return EACCES instead of ESTALE for certain filehandle lookup failures NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 8 of 9] nfsd4: store current->tgid instead of lockowner hash in fl_pid NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 9 of 9] Remove redundant initialization in nfsd4_lockt NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 5 of 9] trivial cleanup of nfs4state.c NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 6 of 9] nfsd4 could leak a stateid in an error path NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 3 of 9] fix incorrect indentation in fh_verify NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 7 of 9] nfsd4: postpone release of stateowner on CLOSE NeilBrown
2004-09-03 2:34 ` [PATCH kNFSd 4 of 9] nfsd4: Support acl_support attribute NeilBrown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.