Introduction
Subsystems (3)
PATCH 1/1 Introduction
Three more assorted nfsd patches.
The last is somewhat embarassing... a previous patch completely left out the nfsv2 section. This didn't cause compile errors, but completely broke NFSv2 service... and it was in -mm for at least a month with noone noticing.
[PATCH kNFSd 001 of 3] semaphore to mutex conversion.
[PATCH kNFSd 002 of 3] Fix some more errno/nfserr confusion in vfs.c [PATCH kNFSd 003 of 3] Provide missing NFSv2 part of patch for checking vfs_getattr.
-------------------------------------------------------
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 Fix some more errno/nfserr confusion in vfs.c
From: NeilBrown <[email protected]>
nfsd_sync* return an errno, which usually needs to be converted to an errno, sometimes immediately, sometimes a little later.
Also, nfsd_setattr returns an nfserr which SHOULDN'T be converted from an errno (because it isn't one).
Also some tidyups of the form:
err = XX
err = nfserrno(err)
and
err = XX
if (err)
err = nfserrno(err)
become
err = nfserrno(XX)
### Diffstat output
./fs/nfsd/vfs.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
fs/nfsd/vfs.c renamed from fs/nfsd/vfs.c~current~ +6 -11
@@ -891,9 +891,9 @@ nfsd_vfs_write(struct svc_rqst *rqstp, sint err =0 ;int stable = *stablep; +#ifdef MSNFS err = nfserr_perm; -#ifdef MSNFS if ((fhp->fh_export->ex_flags &NFSEXP_MSNFS ) && (!lock_may_write (file->f_dentry->d_inode, offset, cnt))) goto out;
@@ -1065,8 +1065,7 @@ nfsd_commit(struct svc_rqst *rqstp, strureturn err;if (EX_ISSYNC (fhp->fh_export)) {if (file->f_op && file->f_op->fsync) { - err =nfsd_sync (file); - err =nfserrno (err); + err =nfserrno (nfsd_sync (file)); }else { err = nfserr_notsupp; }
@@ -1177,7 +1176,7 @@ nfsd_create(struct svc_rqst *rqstp, stru goto out_nfserr;if (EX_ISSYNC (fhp->fh_export)) { - err =nfsd_sync_dir (dentry); + err =nfserrno (nfsd_sync_dir (dentry));write_inode_now (dchild->d_inode,1 ); }
@@ -1310,9 +1309,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, s goto out_nfserr;if (EX_ISSYNC (fhp->fh_export)) { - err =nfsd_sync_dir (dentry); -if (err) - err =nfserrno (err); + err =nfserrno (nfsd_sync_dir (dentry));/* setattr will sync the child (or not) */ }
@@ -1339,7 +1336,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, sif ((iap->ia_valid &= ~(ATTR_UID |ATTR_GID )) !=0 ) {int err2 =nfsd_setattr (rqstp, resfhp, iap,0 , (time_t )0 );if (err2) - err =nfserrno (err2); + err = err2; }/*
@@ -1514,10 +1511,8 @@ nfsd_link(struct svc_rqst *rqstp, struct err =vfs_link (dold, dirp, dnew);if (!err) {if (EX_ISSYNC (ffhp->fh_export)) { - err =nfsd_sync_dir (ddir); + err =nfserrno (nfsd_sync_dir (ddir));write_inode_now (dest,1 ); -if (err) - err =nfserrno (err); } }else {if (err == -EXDEV && rqstp->rq_vers ==2 )
-------------------------------------------------------
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 semaphore to mutex conversion.
In reply to NeilBrownFrom: Ingo Molnar <[email protected]>
the conversion was generated via scripts, and the result was validated automatically via a script as well.
build and boot tested.
### Diffstat output
./include/linux/sunrpc/svcsock.h | 2 +- ./net/sunrpc/svcsock.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
include/linux/sunrpc/svcsock.h renamed from include/linux/sunrpc/svcsock.h~current~ +1 -1
@@ -36,7 +36,7 @@ struct svc_sock {struct list_head sk_deferred;/* deferred requests that need to * be revisted */ -struct semaphore sk_sem;/* to serialize sending data */ +struct mutex sk_mutex;/* to serialize sending data */ int (*sk_recvfrom)(struct svc_rqst *rqstp);int (*sk_sendto)(struct svc_rqst *rqstp);
net/sunrpc/svcsock.c renamed from net/sunrpc/svcsock.c~current~ +4 -4
@@ -1296,13 +1296,13 @@ svc_send(struct svc_rqst *rqstp) xb->page_len + xb->tail[0 ].iov_len; -/* Grab svsk->sk_sem to serialize outgoing data. */ -down (&svsk->sk_sem); +/* Grab svsk->sk_mutex to serialize outgoing data. */ +mutex_lock (&svsk->sk_mutex);if (test_bit (SK_DEAD , &svsk->sk_flags)) len = -ENOTCONN ;else len = svsk->sk_sendto (rqstp); -up (&svsk->sk_sem); +mutex_unlock (&svsk->sk_mutex);svc_sock_release (rqstp);if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN )
@@ -1351,7 +1351,7 @@ svc_setup_socket(struct svc_serv *serv, svsk->sk_lastrecv =get_seconds ();INIT_LIST_HEAD (&svsk->sk_deferred);INIT_LIST_HEAD (&svsk->sk_ready); -sema_init (&svsk->sk_sem,1 ); +mutex_init (&svsk->sk_mutex);/* Initialize the socket */ if (sock->type ==SOCK_DGRAM )
-------------------------------------------------------
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 Provide missing NFSv2 part of patch for checking vfs_getattr.
In reply to NeilBrownFrom: David Shaw <[email protected]>
A recent patch which checked the return status of vfs_getattr in nfsd, completely missed the nfsproc.c (NFSv2) part. Here is it.
This patch moved the call to vfs_getattr from the xdr encoding (at which point it is too late to return an error) to the call handling. This means several calls to vfs_getattr are needed in nfsproc.c. Many are encapsulated in nfsd_return_attrs and nfsd_return_dirop.
### Diffstat output
./fs/nfsd/nfsproc.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-)
fs/nfsd/nfsproc.c renamed from fs/nfsd/nfsproc.c~current~ +30 -7
@@ -36,6 +36,22 @@ nfsd_proc_null(struct svc_rqst *rqstp, vreturn nfs_ok; } +static int +nfsd_return_attrs (int err,struct nfsd_attrstat *resp) +{ +if (err)return err; +return nfserrno (vfs_getattr (resp->fh.fh_export->ex_mnt, + resp->fh.fh_dentry, + &resp->stat)); +} +static int +nfsd_return_dirop (int err,struct nfsd_diropres *resp) +{ +if (err)return err; +return nfserrno (vfs_getattr (resp->fh.fh_export->ex_mnt, + resp->fh.fh_dentry, + &resp->stat)); +}/* * Get a file's attributes * N.B. After this call resp->fh needs an fh_put
@@ -44,10 +60,12 @@ static int nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, struct nfsd_attrstat *resp) { + int nfserr;dprintk ("nfsd: GETATTR %s\n" ,SVCFH_fmt (&argp->fh));fh_copy (&resp->fh, &argp->fh); -return fh_verify (rqstp, &resp->fh,0 ,MAY_NOP ); + nfserr =fh_verify (rqstp, &resp->fh,0 ,MAY_NOP ); +return nfsd_return_attrs (nfserr, resp); }/*
@@ -58,12 +76,14 @@ static int nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, struct nfsd_attrstat *resp) { + int nfserr;dprintk ("nfsd: SETATTR %s, valid=%x, size=%ld\n" ,SVCFH_fmt (&argp->fh), argp->attrs.ia_valid, (long ) argp->attrs.ia_size);fh_copy (&resp->fh, &argp->fh); -return nfsd_setattr (rqstp, &resp->fh, &argp->attrs,0 , (time_t )0 ); + nfserr =nfsd_setattr (rqstp, &resp->fh, &argp->attrs,0 , (time_t )0 ); +return nfsd_return_attrs (nfserr, resp); }/*
@@ -86,7 +106,7 @@ nfsd_proc_lookup(struct svc_rqst *rqstp, &resp->fh);fh_put (&argp->fh); -return nfserr; +return nfsd_return_dirop (nfserr, resp); }/*
@@ -142,7 +162,10 @@ nfsd_proc_read(struct svc_rqst *rqstp, s argp->vec, argp->vlen, &resp->count); -return nfserr; +if (nfserr)return nfserr; +return nfserrno (vfs_getattr (resp->fh.fh_export->ex_mnt, + resp->fh.fh_dentry, + &resp->stat)); }/*
@@ -165,7 +188,7 @@ nfsd_proc_write(struct svc_rqst *rqstp, argp->vec, argp->vlen, argp->len, &stable); -return nfserr; +return nfsd_return_attrs (nfserr, resp); }/*
@@ -322,7 +345,7 @@ out_unlock: done:fh_put (dirfhp); -return nfserr; +return nfsd_return_dirop (nfserr, resp); } static int
@@ -425,7 +448,7 @@ nfsd_proc_mkdir(struct svc_rqst *rqstp, nfserr =nfsd_create (rqstp, &argp->fh, argp->name, argp->len, &argp->attrs,S_IFDIR ,0 , &resp->fh);fh_put (&argp->fh); -return nfserr; +return nfsd_return_dirop (nfserr, resp); }/*
-------------------------------------------------------
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