aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2006-10-03 10:47:04 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2006-10-03 10:47:04 +0000
commit30af71199e5b4f6959f4ff15ee614594751de272 (patch)
treef208ea8fc9e93064439efb11864fcf850ffb9750
parent9a3fc40a26671d15305ab06020c28d9c61509ec1 (diff)
downloadsrc-30af71199e5b4f6959f4ff15ee614594751de272.tar.gz
src-30af71199e5b4f6959f4ff15ee614594751de272.zip
Notes
-rw-r--r--sys/kern/vfs_mount.c6
-rw-r--r--sys/sys/mount.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index c89a5fa35fb0..0598905f499e 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -475,6 +475,7 @@ vfs_mount_alloc(struct vnode *vp, struct vfsconf *vfsp,
MNT_ILOCK(mp);
mp->mnt_flag |= vfsp->vfc_flags & MNT_VISFLAGMASK;
MNT_IUNLOCK(mp);
+ mp->mnt_gen++;
strlcpy(mp->mnt_stat.f_fstypename, vfsp->vfc_name, MFSNAMELEN);
mp->mnt_vnodecovered = vp;
mp->mnt_cred = crdup(td->td_ucred);
@@ -1148,10 +1149,12 @@ dounmount(mp, flags, td)
struct vnode *coveredvp, *fsrootvp;
int error;
int async_flag;
+ int mnt_gen_r;
mtx_assert(&Giant, MA_OWNED);
if ((coveredvp = mp->mnt_vnodecovered) != NULL) {
+ mnt_gen_r = mp->mnt_gen;
VI_LOCK(coveredvp);
vholdl(coveredvp);
error = vn_lock(coveredvp, LK_EXCLUSIVE | LK_INTERLOCK, td);
@@ -1162,7 +1165,8 @@ dounmount(mp, flags, td)
*/
if (error)
return (error);
- if (coveredvp->v_mountedhere != mp) {
+ if (coveredvp->v_mountedhere != mp ||
+ coveredvp->v_mountedhere->mnt_gen != mnt_gen_r) {
VOP_UNLOCK(coveredvp, 0, td);
return (EBUSY);
}
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 16ea687672ca..e67de9cf4c84 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -145,6 +145,7 @@ struct vfsopt;
struct mount {
struct lock mnt_lock; /* mount structure lock */
struct mtx mnt_mtx; /* mount structure interlock */
+ int mnt_gen; /* struct mount generation */
#define mnt_startzero mnt_list
TAILQ_ENTRY(mount) mnt_list; /* (m) mount list */
struct vfsops *mnt_op; /* operations on fs */