diff options
author | mux <mux@FreeBSD.org> | 2002-05-23 23:02:19 +0000 |
---|---|---|
committer | mux <mux@FreeBSD.org> | 2002-05-23 23:02:19 +0000 |
commit | 67080508a876e1f11f67b14f032dea36788a310e (patch) | |
tree | d3e0f99d4809cc83209a4999a13558ca721cd416 /sys/kern | |
parent | 617cfa745a862b7dacb60c495c61c54120e91eba (diff) | |
download | FreeBSD-src-67080508a876e1f11f67b14f032dea36788a310e.zip FreeBSD-src-67080508a876e1f11f67b14f032dea36788a310e.tar.gz |
Slightly change the way we pass mount options to the filesystem
VFS_NMOUNT operations.
Reviewed by: phk
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_extattr.c | 18 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 18 |
2 files changed, 24 insertions, 12 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 6360b60..8117506 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -434,7 +434,6 @@ vfs_nmount(td, fsflags, fsoptions) mp->mnt_flag |= fsflags & (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT); VOP_UNLOCK(vp, 0, td); - mp->mnt_optnew = optlist; goto update; } /* @@ -528,8 +527,8 @@ vfs_nmount(td, fsflags, fsoptions) mp->mnt_iosize_max = DFLTPHYS; VOP_UNLOCK(vp, 0, td); - mp->mnt_opt = optlist; update: + mp->mnt_optnew = optlist; /* * Check if the fs implements the new VFS_NMOUNT() * function, since the new system call was used. @@ -567,6 +566,17 @@ update: * get. No freeing of cn_pnbuf. */ error = VFS_NMOUNT(mp, &nd, td); + if (!error) { + if (mp->mnt_opt != NULL) + vfs_freeopts(mp->mnt_opt); + mp->mnt_opt = mp->mnt_optnew; + } else + vfs_freeopts(mp->mnt_optnew); + /* + * Prevent external consumers of mount + * options to read mnt_optnew. + */ + mp->mnt_optnew = NULL; if (mp->mnt_flag & MNT_UPDATE) { if (mp->mnt_kern_flag & MNTK_WANTRDWR) mp->mnt_flag &= ~MNT_RDONLY; @@ -576,10 +586,6 @@ update: if (error) { mp->mnt_flag = flag; mp->mnt_kern_flag = kern_flag; - vfs_freeopts(mp->mnt_optnew); - } else { - vfs_freeopts(mp->mnt_opt); - mp->mnt_opt = mp->mnt_optnew; } if ((mp->mnt_flag & MNT_RDONLY) == 0) { if (mp->mnt_syncer == NULL) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 6360b60..8117506 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -434,7 +434,6 @@ vfs_nmount(td, fsflags, fsoptions) mp->mnt_flag |= fsflags & (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT); VOP_UNLOCK(vp, 0, td); - mp->mnt_optnew = optlist; goto update; } /* @@ -528,8 +527,8 @@ vfs_nmount(td, fsflags, fsoptions) mp->mnt_iosize_max = DFLTPHYS; VOP_UNLOCK(vp, 0, td); - mp->mnt_opt = optlist; update: + mp->mnt_optnew = optlist; /* * Check if the fs implements the new VFS_NMOUNT() * function, since the new system call was used. @@ -567,6 +566,17 @@ update: * get. No freeing of cn_pnbuf. */ error = VFS_NMOUNT(mp, &nd, td); + if (!error) { + if (mp->mnt_opt != NULL) + vfs_freeopts(mp->mnt_opt); + mp->mnt_opt = mp->mnt_optnew; + } else + vfs_freeopts(mp->mnt_optnew); + /* + * Prevent external consumers of mount + * options to read mnt_optnew. + */ + mp->mnt_optnew = NULL; if (mp->mnt_flag & MNT_UPDATE) { if (mp->mnt_kern_flag & MNTK_WANTRDWR) mp->mnt_flag &= ~MNT_RDONLY; @@ -576,10 +586,6 @@ update: if (error) { mp->mnt_flag = flag; mp->mnt_kern_flag = kern_flag; - vfs_freeopts(mp->mnt_optnew); - } else { - vfs_freeopts(mp->mnt_opt); - mp->mnt_opt = mp->mnt_optnew; } if ((mp->mnt_flag & MNT_RDONLY) == 0) { if (mp->mnt_syncer == NULL) |