Remove calls to vfs_export() for exporting a filesystem for NFS mounting
from individual filesystems. Call it instead in vfs_mount.c, after we call VFS_MOUNT() for a specific filesystem.
This commit is contained in:
parent
7854550aa7
commit
055e2abe68
@ -128,9 +128,8 @@ static int
|
||||
cd9660_mount(struct mount *mp, struct thread *td)
|
||||
{
|
||||
struct vnode *devvp;
|
||||
struct export_args *export;
|
||||
char *fspec;
|
||||
int error, len;
|
||||
int error;
|
||||
mode_t accessmode;
|
||||
struct nameidata ndp;
|
||||
struct iso_mnt *imp = 0;
|
||||
@ -145,15 +144,10 @@ cd9660_mount(struct mount *mp, struct thread *td)
|
||||
return (error);
|
||||
|
||||
imp = VFSTOISOFS(mp);
|
||||
/*
|
||||
* If updating, check whether changing from read-only to
|
||||
* read/write; if there is no device name, that's all we do.
|
||||
*/
|
||||
|
||||
if (mp->mnt_flag & MNT_UPDATE) {
|
||||
error = vfs_getopt(mp->mnt_optnew,
|
||||
"export", (void **)&export, &len);
|
||||
if (error == 0 && len == sizeof *export && export->ex_flags)
|
||||
return (vfs_export(mp, export));
|
||||
if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0))
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* Not an update, or updating the name: look up the name
|
||||
|
@ -243,7 +243,6 @@ static int
|
||||
msdosfs_mount(struct mount *mp, struct thread *td)
|
||||
{
|
||||
struct vnode *devvp; /* vnode for blk device to mount */
|
||||
struct export_args export;
|
||||
/* msdosfs specific mount control block */
|
||||
struct msdosfsmount *pmp = NULL;
|
||||
struct nameidata ndp;
|
||||
@ -261,16 +260,12 @@ msdosfs_mount(struct mount *mp, struct thread *td)
|
||||
if (mp->mnt_flag & MNT_UPDATE) {
|
||||
pmp = VFSTOMSDOSFS(mp);
|
||||
|
||||
error = vfs_copyopt(mp->mnt_optnew, "export",
|
||||
&export, sizeof export);
|
||||
if (error == 0 && export.ex_flags != 0) {
|
||||
/*
|
||||
* Process export requests.
|
||||
*/
|
||||
if ((export.ex_flags & MNT_EXPORTED) != 0 &&
|
||||
(pmp->pm_flags & MSDOSFS_LARGEFS) != 0)
|
||||
if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0)) {
|
||||
/* Process export requests. */
|
||||
if ((pmp->pm_flags & MSDOSFS_LARGEFS) != 0)
|
||||
return (EOPNOTSUPP);
|
||||
return (vfs_export(mp, &export));
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
if (!(pmp->pm_flags & MSDOSFSMNT_RONLY) &&
|
||||
vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) {
|
||||
|
@ -157,7 +157,6 @@ ntfs_mount (
|
||||
struct vnode *devvp;
|
||||
struct nameidata ndp;
|
||||
char *from;
|
||||
struct export_args export;
|
||||
|
||||
if (vfs_filteropt(mp->mnt_optnew, ntfs_opts))
|
||||
return (EINVAL);
|
||||
@ -171,20 +170,14 @@ ntfs_mount (
|
||||
* read/write.
|
||||
*/
|
||||
if (mp->mnt_flag & MNT_UPDATE) {
|
||||
error = vfs_copyopt(mp->mnt_optnew, "export",
|
||||
&export, sizeof export);
|
||||
if ((error == 0) && export.ex_flags != 0) {
|
||||
/*
|
||||
* Process export requests. Jumping to "success"
|
||||
* will return the vfs_export() error code.
|
||||
*/
|
||||
err = vfs_export(mp, &export);
|
||||
if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0)) {
|
||||
/* Process export requests in vfs_mount.c */
|
||||
goto success;
|
||||
} else {
|
||||
printf("ntfs_mount(): MNT_UPDATE not supported\n");
|
||||
err = EINVAL;
|
||||
goto error_1;
|
||||
}
|
||||
|
||||
printf("ntfs_mount(): MNT_UPDATE not supported\n");
|
||||
err = EINVAL;
|
||||
goto error_1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -129,7 +129,6 @@ ext2_mount(mp, td)
|
||||
struct mount *mp;
|
||||
struct thread *td;
|
||||
{
|
||||
struct export_args *export;
|
||||
struct vfsoptlist *opts;
|
||||
struct vnode *devvp;
|
||||
struct ext2mount *ump = 0;
|
||||
@ -233,13 +232,9 @@ ext2_mount(mp, td)
|
||||
fs->s_rd_only = 0;
|
||||
mp->mnt_flag &= ~MNT_RDONLY;
|
||||
}
|
||||
if (fspec == NULL) {
|
||||
error = vfs_getopt(opts, "export", (void **)&export,
|
||||
&len);
|
||||
if (error || len != sizeof(struct export_args))
|
||||
return (EINVAL);
|
||||
/* Process export requests. */
|
||||
return (vfs_export(mp, export));
|
||||
if (vfs_flagopt(opts, "export", NULL, 0)) {
|
||||
/* Process export requests in vfs_mount.c. */
|
||||
return (error);
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
@ -128,9 +128,8 @@ static int
|
||||
cd9660_mount(struct mount *mp, struct thread *td)
|
||||
{
|
||||
struct vnode *devvp;
|
||||
struct export_args *export;
|
||||
char *fspec;
|
||||
int error, len;
|
||||
int error;
|
||||
mode_t accessmode;
|
||||
struct nameidata ndp;
|
||||
struct iso_mnt *imp = 0;
|
||||
@ -145,15 +144,10 @@ cd9660_mount(struct mount *mp, struct thread *td)
|
||||
return (error);
|
||||
|
||||
imp = VFSTOISOFS(mp);
|
||||
/*
|
||||
* If updating, check whether changing from read-only to
|
||||
* read/write; if there is no device name, that's all we do.
|
||||
*/
|
||||
|
||||
if (mp->mnt_flag & MNT_UPDATE) {
|
||||
error = vfs_getopt(mp->mnt_optnew,
|
||||
"export", (void **)&export, &len);
|
||||
if (error == 0 && len == sizeof *export && export->ex_flags)
|
||||
return (vfs_export(mp, export));
|
||||
if (vfs_flagopt(mp->mnt_optnew, "export", NULL, 0))
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* Not an update, or updating the name: look up the name
|
||||
|
@ -777,6 +777,7 @@ vfs_domount(
|
||||
struct vnode *vp;
|
||||
struct mount *mp;
|
||||
struct vfsconf *vfsp;
|
||||
struct export_args export;
|
||||
int error, flag = 0, kern_flag = 0;
|
||||
struct vattr va;
|
||||
struct nameidata nd;
|
||||
@ -933,6 +934,17 @@ vfs_domount(
|
||||
* get. No freeing of cn_pnbuf.
|
||||
*/
|
||||
error = VFS_MOUNT(mp, td);
|
||||
|
||||
/*
|
||||
* Process the export option only if we are
|
||||
* updating mount options.
|
||||
*/
|
||||
if (!error && (fsflags & MNT_UPDATE)) {
|
||||
if (vfs_copyopt(mp->mnt_optnew, "export", &export,
|
||||
sizeof(export)) == 0)
|
||||
error = vfs_export(mp, &export);
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
if (mp->mnt_opt != NULL)
|
||||
vfs_freeopts(mp->mnt_opt);
|
||||
|
@ -130,7 +130,6 @@ ffs_mount(struct mount *mp, struct thread *td)
|
||||
int error, flags;
|
||||
mode_t accessmode;
|
||||
struct nameidata ndp;
|
||||
struct export_args export;
|
||||
char *fspec;
|
||||
|
||||
if (vfs_filteropt(mp->mnt_optnew, ffs_opts))
|
||||
@ -181,13 +180,6 @@ ffs_mount(struct mount *mp, struct thread *td)
|
||||
if (vfs_getopt(mp->mnt_optnew, "update", NULL, NULL) == 0)
|
||||
mp->mnt_flag |= MNT_UPDATE;
|
||||
|
||||
export.ex_root = -2; /* DEFAULT_ROOTID */
|
||||
|
||||
if (mp->mnt_flag & MNT_RDONLY)
|
||||
export.ex_flags = MNT_EXRDONLY;
|
||||
else
|
||||
export.ex_flags = 0;
|
||||
|
||||
/*
|
||||
* If updating, check whether changing from read-only to
|
||||
* read/write; if there is no device name, that's all we do.
|
||||
@ -329,17 +321,7 @@ ffs_mount(struct mount *mp, struct thread *td)
|
||||
*/
|
||||
if ((fs->fs_flags & FS_ACLS) != 0)
|
||||
mp->mnt_flag |= MNT_ACLS;
|
||||
/*
|
||||
* If not updating name, process export requests.
|
||||
*/
|
||||
error = 0;
|
||||
if (vfs_getopt(mp->mnt_optnew, "export", NULL, NULL) == 0) {
|
||||
error = vfs_copyopt(mp->mnt_optnew, "export",
|
||||
&export, sizeof export);
|
||||
}
|
||||
|
||||
if (error == 0 && export.ex_flags != 0)
|
||||
return (vfs_export(mp, &export));
|
||||
/*
|
||||
* If this is a snapshot request, take the snapshot.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user