summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Egge <tegge@FreeBSD.org>2000-08-09 01:57:11 +0000
committerTor Egge <tegge@FreeBSD.org>2000-08-09 01:57:11 +0000
commit3c2498c0d3fc38e6bfc12e28c5e06f1860d87d17 (patch)
tree259bb8113907adc76c599ceebf81432877f6b0ad
parent1cfb436ae6614dcd7ad460ea058b3da147577379 (diff)
Notes
-rw-r--r--sys/kern/vfs_extattr.c23
-rw-r--r--sys/kern/vfs_syscalls.c23
2 files changed, 38 insertions, 8 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 3a15d64fe409..9b68dd7d182d 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -164,8 +164,6 @@ mount(p, uap)
vput(vp);
return (EOPNOTSUPP); /* Needs translation */
}
- mp->mnt_flag |= SCARG(uap, flags) &
- (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT);
/*
* Only root, or the user that did the original mount is
* permitted to update it.
@@ -179,6 +177,18 @@ mount(p, uap)
vput(vp);
return (EBUSY);
}
+ simple_lock(&vp->v_interlock);
+ if ((vp->v_flag & VMOUNT) != 0 ||
+ vp->v_mountedhere != NULL) {
+ simple_unlock(&vp->v_interlock);
+ vfs_unbusy(mp, p);
+ vput(vp);
+ return (EBUSY);
+ }
+ vp->v_flag |= VMOUNT;
+ simple_unlock(&vp->v_interlock);
+ mp->mnt_flag |= SCARG(uap, flags) &
+ (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT);
VOP_UNLOCK(vp, 0, p);
goto update;
}
@@ -192,8 +202,10 @@ mount(p, uap)
vput(vp);
return (error);
}
- if ((error = vinvalbuf(vp, V_SAVE, p->p_ucred, p, 0, 0)) != 0)
+ if ((error = vinvalbuf(vp, V_SAVE, p->p_ucred, p, 0, 0)) != 0) {
+ vput(vp);
return (error);
+ }
if (vp->v_type != VDIR) {
vput(vp);
return (ENOTDIR);
@@ -300,7 +312,6 @@ update:
*/
error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p);
if (mp->mnt_flag & MNT_UPDATE) {
- vrele(vp);
if (mp->mnt_kern_flag & MNTK_WANTRDWR)
mp->mnt_flag &= ~MNT_RDONLY;
mp->mnt_flag &=~
@@ -319,6 +330,10 @@ update:
mp->mnt_syncer = NULL;
}
vfs_unbusy(mp, p);
+ simple_lock(&vp->v_interlock);
+ vp->v_flag &= ~VMOUNT;
+ simple_unlock(&vp->v_interlock);
+ vrele(vp);
return (error);
}
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 3a15d64fe409..9b68dd7d182d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -164,8 +164,6 @@ mount(p, uap)
vput(vp);
return (EOPNOTSUPP); /* Needs translation */
}
- mp->mnt_flag |= SCARG(uap, flags) &
- (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT);
/*
* Only root, or the user that did the original mount is
* permitted to update it.
@@ -179,6 +177,18 @@ mount(p, uap)
vput(vp);
return (EBUSY);
}
+ simple_lock(&vp->v_interlock);
+ if ((vp->v_flag & VMOUNT) != 0 ||
+ vp->v_mountedhere != NULL) {
+ simple_unlock(&vp->v_interlock);
+ vfs_unbusy(mp, p);
+ vput(vp);
+ return (EBUSY);
+ }
+ vp->v_flag |= VMOUNT;
+ simple_unlock(&vp->v_interlock);
+ mp->mnt_flag |= SCARG(uap, flags) &
+ (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT);
VOP_UNLOCK(vp, 0, p);
goto update;
}
@@ -192,8 +202,10 @@ mount(p, uap)
vput(vp);
return (error);
}
- if ((error = vinvalbuf(vp, V_SAVE, p->p_ucred, p, 0, 0)) != 0)
+ if ((error = vinvalbuf(vp, V_SAVE, p->p_ucred, p, 0, 0)) != 0) {
+ vput(vp);
return (error);
+ }
if (vp->v_type != VDIR) {
vput(vp);
return (ENOTDIR);
@@ -300,7 +312,6 @@ update:
*/
error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p);
if (mp->mnt_flag & MNT_UPDATE) {
- vrele(vp);
if (mp->mnt_kern_flag & MNTK_WANTRDWR)
mp->mnt_flag &= ~MNT_RDONLY;
mp->mnt_flag &=~
@@ -319,6 +330,10 @@ update:
mp->mnt_syncer = NULL;
}
vfs_unbusy(mp, p);
+ simple_lock(&vp->v_interlock);
+ vp->v_flag &= ~VMOUNT;
+ simple_unlock(&vp->v_interlock);
+ vrele(vp);
return (error);
}
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);