summaryrefslogtreecommitdiffstats
path: root/sys/gnu/fs
diff options
context:
space:
mode:
authorssouhlal <ssouhlal@FreeBSD.org>2005-09-02 15:27:23 +0000
committerssouhlal <ssouhlal@FreeBSD.org>2005-09-02 15:27:23 +0000
commitf8217f350bcfc82b94c814a04faf8cdd5326d033 (patch)
tree6d3fd63626ff1d58add99ac395ebda844196e694 /sys/gnu/fs
parent912d183e0b4eff2d1cfeacc98dc5720f1461a947 (diff)
downloadFreeBSD-src-f8217f350bcfc82b94c814a04faf8cdd5326d033.zip
FreeBSD-src-f8217f350bcfc82b94c814a04faf8cdd5326d033.tar.gz
*_mountfs() (if the filesystem mounts from a device) needs devvp to be
locked, so lock it. Glanced at by: phk MFC after: 3 days
Diffstat (limited to 'sys/gnu/fs')
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c8
-rw-r--r--sys/gnu/fs/reiserfs/reiserfs_vfsops.c6
2 files changed, 5 insertions, 9 deletions
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index de198ce..d125a24 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -248,14 +248,14 @@ ext2_mount(mp, td)
*/
if (fspec == NULL)
return (EINVAL);
- NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, td);
+ NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td);
if ((error = namei(ndp)) != 0)
return (error);
NDFREE(ndp, NDF_ONLY_PNBUF);
devvp = ndp->ni_vp;
if (!vn_isdisk(devvp, &error)) {
- vrele(devvp);
+ vput(devvp);
return (error);
}
@@ -267,12 +267,10 @@ ext2_mount(mp, td)
accessmode = VREAD;
if ((mp->mnt_flag & MNT_RDONLY) == 0)
accessmode |= VWRITE;
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
if ((error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td)) != 0) {
vput(devvp);
return (error);
}
- VOP_UNLOCK(devvp, 0, td);
}
if ((mp->mnt_flag & MNT_UPDATE) == 0) {
@@ -281,7 +279,7 @@ ext2_mount(mp, td)
if (devvp != ump->um_devvp)
error = EINVAL; /* needs translation */
else
- vrele(devvp);
+ vput(devvp);
}
if (error) {
vrele(devvp);
diff --git a/sys/gnu/fs/reiserfs/reiserfs_vfsops.c b/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
index 4bb425a..0acaf44 100644
--- a/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
+++ b/sys/gnu/fs/reiserfs/reiserfs_vfsops.c
@@ -114,14 +114,14 @@ reiserfs_mount(struct mount *mp, struct thread *td)
if (fspec == NULL)
return (EINVAL);
- NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, td);
+ NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td);
if ((error = namei(ndp)) != 0)
return (error);
NDFREE(ndp, NDF_ONLY_PNBUF);
devvp = ndp->ni_vp;
if (!vn_isdisk(devvp, &error)) {
- vrele(devvp);
+ vput(devvp);
return (error);
}
@@ -131,13 +131,11 @@ reiserfs_mount(struct mount *mp, struct thread *td)
accessmode = VREAD;
if ((mp->mnt_flag & MNT_RDONLY) == 0)
accessmode |= VWRITE;
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
if ((error = VOP_ACCESS(devvp,
accessmode, td->td_ucred, td)) != 0) {
vput(devvp);
return (error);
}
- VOP_UNLOCK(devvp, 0, td);
}
if ((mp->mnt_flag & MNT_UPDATE) == 0) {
OpenPOWER on IntegriCloud