* Zerocpy NFS support (C) 2002 Hirokazu Takahashi <taka@valinux.co.jp>
*/
+#include <linux/config.h>
#include <linux/string.h>
#include <linux/time.h>
#include <linux/errno.h>
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)
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
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);
}
* 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);
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);
*/
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))
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.
if (isdotent(name, len))
goto out;
- fh_lock_nested(ffhp, I_MUTEX_PARENT);
+ fh_lock(ffhp);
ddir = ffhp->fh_dentry;
dirp = ddir->d_inode;
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;
}
/*
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;
if (err)
goto out;
- fh_lock_nested(fhp, I_MUTEX_PARENT);
+ fh_lock(fhp);
dentry = fhp->fh_dentry;
dirp = dentry->d_inode;
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;
}
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;