aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/vfs.c
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-08-15 14:11:45 -0400
committerSage Weil <sage@inktank.com>2013-08-15 14:11:45 -0400
commitee3e542fec6e69bc9fb668698889a37d93950ddf (patch)
treee74ee766a4764769ef1d3d45d266b4dea64101d3 /fs/nfsd/vfs.c
parentfe2a801b50c0bb8039d627e5ae1fec249d10ff39 (diff)
parentf1d6e17f540af37bb1891480143669ba7636c4cf (diff)
Merge remote-tracking branch 'linus/master' into testing
Diffstat (limited to 'fs/nfsd/vfs.c')
-rw-r--r--fs/nfsd/vfs.c42
1 files changed, 37 insertions, 5 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 84ce601d8063..c827acb0e943 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -28,6 +28,7 @@
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <linux/exportfs.h> 29#include <linux/exportfs.h>
30#include <linux/writeback.h> 30#include <linux/writeback.h>
31#include <linux/security.h>
31 32
32#ifdef CONFIG_NFSD_V3 33#ifdef CONFIG_NFSD_V3
33#include "xdr3.h" 34#include "xdr3.h"
@@ -621,6 +622,33 @@ int nfsd4_is_junction(struct dentry *dentry)
621 return 0; 622 return 0;
622 return 1; 623 return 1;
623} 624}
625#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
626__be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp,
627 struct xdr_netobj *label)
628{
629 __be32 error;
630 int host_error;
631 struct dentry *dentry;
632
633 error = fh_verify(rqstp, fhp, 0 /* S_IFREG */, NFSD_MAY_SATTR);
634 if (error)
635 return error;
636
637 dentry = fhp->fh_dentry;
638
639 mutex_lock(&dentry->d_inode->i_mutex);
640 host_error = security_inode_setsecctx(dentry, label->data, label->len);
641 mutex_unlock(&dentry->d_inode->i_mutex);
642 return nfserrno(host_error);
643}
644#else
645__be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp,
646 struct xdr_netobj *label)
647{
648 return nfserr_notsupp;
649}
650#endif
651
624#endif /* defined(CONFIG_NFSD_V4) */ 652#endif /* defined(CONFIG_NFSD_V4) */
625 653
626#ifdef CONFIG_NFSD_V3 654#ifdef CONFIG_NFSD_V3
@@ -802,9 +830,10 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,
802 flags = O_WRONLY|O_LARGEFILE; 830 flags = O_WRONLY|O_LARGEFILE;
803 } 831 }
804 *filp = dentry_open(&path, flags, current_cred()); 832 *filp = dentry_open(&path, flags, current_cred());
805 if (IS_ERR(*filp)) 833 if (IS_ERR(*filp)) {
806 host_err = PTR_ERR(*filp); 834 host_err = PTR_ERR(*filp);
807 else { 835 *filp = NULL;
836 } else {
808 host_err = ima_file_check(*filp, may_flags); 837 host_err = ima_file_check(*filp, may_flags);
809 838
810 if (may_flags & NFSD_MAY_64BIT_COOKIE) 839 if (may_flags & NFSD_MAY_64BIT_COOKIE)
@@ -1912,6 +1941,7 @@ struct buffered_dirent {
1912}; 1941};
1913 1942
1914struct readdir_data { 1943struct readdir_data {
1944 struct dir_context ctx;
1915 char *dirent; 1945 char *dirent;
1916 size_t used; 1946 size_t used;
1917 int full; 1947 int full;
@@ -1943,13 +1973,15 @@ static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen,
1943static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, 1973static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func,
1944 struct readdir_cd *cdp, loff_t *offsetp) 1974 struct readdir_cd *cdp, loff_t *offsetp)
1945{ 1975{
1946 struct readdir_data buf;
1947 struct buffered_dirent *de; 1976 struct buffered_dirent *de;
1948 int host_err; 1977 int host_err;
1949 int size; 1978 int size;
1950 loff_t offset; 1979 loff_t offset;
1980 struct readdir_data buf = {
1981 .ctx.actor = nfsd_buffered_filldir,
1982 .dirent = (void *)__get_free_page(GFP_KERNEL)
1983 };
1951 1984
1952 buf.dirent = (void *)__get_free_page(GFP_KERNEL);
1953 if (!buf.dirent) 1985 if (!buf.dirent)
1954 return nfserrno(-ENOMEM); 1986 return nfserrno(-ENOMEM);
1955 1987
@@ -1963,7 +1995,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func,
1963 buf.used = 0; 1995 buf.used = 0;
1964 buf.full = 0; 1996 buf.full = 0;
1965 1997
1966 host_err = vfs_readdir(file, nfsd_buffered_filldir, &buf); 1998 host_err = iterate_dir(file, &buf.ctx);
1967 if (buf.full) 1999 if (buf.full)
1968 host_err = 0; 2000 host_err = 0;
1969 2001