Commit 774b1478 authored by J. Bruce Fields's avatar J. Bruce Fields

nfsd: make V4ROOT exports read-only

I can't see any use for writeable V4ROOT exports.
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent 03a816b4
...@@ -355,7 +355,7 @@ static struct svc_export *svc_export_update(struct svc_export *new, ...@@ -355,7 +355,7 @@ static struct svc_export *svc_export_update(struct svc_export *new,
struct svc_export *old); struct svc_export *old);
static struct svc_export *svc_export_lookup(struct svc_export *); static struct svc_export *svc_export_lookup(struct svc_export *);
static int check_export(struct inode *inode, int flags, unsigned char *uuid) static int check_export(struct inode *inode, int *flags, unsigned char *uuid)
{ {
/* /*
...@@ -367,6 +367,13 @@ static int check_export(struct inode *inode, int flags, unsigned char *uuid) ...@@ -367,6 +367,13 @@ static int check_export(struct inode *inode, int flags, unsigned char *uuid)
!S_ISREG(inode->i_mode)) !S_ISREG(inode->i_mode))
return -ENOTDIR; return -ENOTDIR;
/*
* Mountd should never pass down a writeable V4ROOT export, but,
* just to make sure:
*/
if (*flags & NFSEXP_V4ROOT)
*flags |= NFSEXP_READONLY;
/* There are two requirements on a filesystem to be exportable. /* There are two requirements on a filesystem to be exportable.
* 1: We must be able to identify the filesystem from a number. * 1: We must be able to identify the filesystem from a number.
* either a device number (so FS_REQUIRES_DEV needed) * either a device number (so FS_REQUIRES_DEV needed)
...@@ -375,7 +382,7 @@ static int check_export(struct inode *inode, int flags, unsigned char *uuid) ...@@ -375,7 +382,7 @@ static int check_export(struct inode *inode, int flags, unsigned char *uuid)
* This means that s_export_op must be set. * This means that s_export_op must be set.
*/ */
if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) && if (!(inode->i_sb->s_type->fs_flags & FS_REQUIRES_DEV) &&
!(flags & NFSEXP_FSID) && !(*flags & NFSEXP_FSID) &&
uuid == NULL) { uuid == NULL) {
dprintk("exp_export: export of non-dev fs without fsid\n"); dprintk("exp_export: export of non-dev fs without fsid\n");
return -EINVAL; return -EINVAL;
...@@ -590,7 +597,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen) ...@@ -590,7 +597,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
goto out4; goto out4;
} }
err = check_export(exp.ex_path.dentry->d_inode, exp.ex_flags, err = check_export(exp.ex_path.dentry->d_inode, &exp.ex_flags,
exp.ex_uuid); exp.ex_uuid);
if (err) if (err)
goto out4; goto out4;
...@@ -1029,7 +1036,7 @@ exp_export(struct nfsctl_export *nxp) ...@@ -1029,7 +1036,7 @@ exp_export(struct nfsctl_export *nxp)
goto finish; goto finish;
} }
err = check_export(path.dentry->d_inode, nxp->ex_flags, NULL); err = check_export(path.dentry->d_inode, &nxp->ex_flags, NULL);
if (err) goto finish; if (err) goto finish;
err = -ENOMEM; err = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment