X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fnfsd%2Fvfs.c;fp=fs%2Fnfsd%2Fvfs.c;h=c9a49dae41e626c44e46d38f57f41ccbf4b3f290;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=98a6df8525f1c5a6db02b0ede932cd3036425b8c;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 98a6df852..c9a49dae4 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -16,6 +16,7 @@ * Zerocpy NFS support (C) 2002 Hirokazu Takahashi */ +#include #include #include #include @@ -370,6 +371,7 @@ out_nfserr: static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) { ssize_t buflen; + int error; buflen = vfs_getxattr(dentry, key, NULL, 0); if (buflen <= 0) @@ -379,7 +381,10 @@ static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) if (!*buf) return -ENOMEM; - return vfs_getxattr(dentry, key, *buf, buflen); + error = vfs_getxattr(dentry, key, *buf, buflen); + if (error < 0) + return error; + return buflen; } #endif @@ -672,10 +677,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, goto out_nfserr; if (access & MAY_WRITE) { - if (access & MAY_READ) - flags = O_RDWR|O_LARGEFILE; - else - flags = O_WRONLY|O_LARGEFILE; + flags = O_WRONLY|O_LARGEFILE; DQUOT_INIT(inode); } @@ -704,7 +706,7 @@ nfsd_close(struct file *filp) * after it. */ static inline int nfsd_dosync(struct file *filp, struct dentry *dp, - const struct file_operations *fop) + struct file_operations *fop) { struct inode *inode = dp->d_inode; int (*fsync) (struct file *, struct dentry *, int); @@ -836,7 +838,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, if (ra && ra->p_set) file->f_ra = ra->p_ra; - if (file->f_op->sendfile && rqstp->rq_sendfile_ok) { + if (file->f_op->sendfile) { svc_pushback_unused_pages(rqstp); err = file->f_op->sendfile(file, &offset, *count, nfsd_read_actor, rqstp); @@ -1114,7 +1116,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, */ if (!resfhp->fh_dentry) { /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create */ - fh_lock_nested(fhp, I_MUTEX_PARENT); + fh_lock(fhp); dchild = lookup_one_len(fname, dentry, flen); err = PTR_ERR(dchild); if (IS_ERR(dchild)) @@ -1240,7 +1242,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, err = nfserr_notdir; if(!dirp->i_op || !dirp->i_op->lookup) goto out; - fh_lock_nested(fhp, I_MUTEX_PARENT); + fh_lock(fhp); /* * Compose the response file handle. @@ -1496,7 +1498,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, if (isdotent(name, len)) goto out; - fh_lock_nested(ffhp, I_MUTEX_PARENT); + fh_lock(ffhp); ddir = ffhp->fh_dentry; dirp = ddir->d_inode; @@ -1521,15 +1523,14 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, err = nfserrno(err); } - dput(dnew); -out_unlock: fh_unlock(ffhp); + dput(dnew); out: return err; out_nfserr: err = nfserrno(err); - goto out_unlock; + goto out; } /* @@ -1558,7 +1559,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, tdir = tdentry->d_inode; err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev; - if (ffhp->fh_export != tfhp->fh_export) + if (fdir->i_sb != tdir->i_sb) goto out; err = nfserr_perm; @@ -1646,7 +1647,7 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, if (err) goto out; - fh_lock_nested(fhp, I_MUTEX_PARENT); + fh_lock(fhp); dentry = fhp->fh_dentry; dirp = dentry->d_inode; @@ -1742,7 +1743,7 @@ int nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) { int err = fh_verify(rqstp, fhp, 0, MAY_NOP); - if (!err && vfs_statfs(fhp->fh_dentry,stat)) + if (!err && vfs_statfs(fhp->fh_dentry->d_inode->i_sb,stat)) err = nfserr_io; return err; } @@ -1928,10 +1929,11 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl) value = kmalloc(size, GFP_KERNEL); if (!value) return -ENOMEM; - error = posix_acl_to_xattr(acl, value, size); - if (error < 0) + size = posix_acl_to_xattr(acl, value, size); + if (size < 0) { + error = size; goto getout; - size = error; + } } else size = 0;