diff options
author | delphij <delphij@FreeBSD.org> | 2007-08-10 05:24:49 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2007-08-10 05:24:49 +0000 |
commit | 1e2d5f7f4ae5c6c278371f5d357ee949df152bcc (patch) | |
tree | 3c511dcb1596e97903bfbb7bc035dbea359cc6ea /sys/fs/tmpfs/tmpfs_vfsops.c | |
parent | b6abc7d242e6b81169bb513bdf42663b15f6cc98 (diff) | |
download | FreeBSD-src-1e2d5f7f4ae5c6c278371f5d357ee949df152bcc.zip FreeBSD-src-1e2d5f7f4ae5c6c278371f5d357ee949df152bcc.tar.gz |
MFp4:
- Respect cnflag and don't lock vnode always as LK_EXCLUSIVE [1]
- Properly lock around tn_vnode to avoid NULL deference
- Be more careful handling vnodes (*)
(*) This is a WIP
[1] by pjd via howardsu
Thanks kib@ for his valuable VFS related comments.
Tested with: fsx, fstest, tmpfs regression test set
Found by: pho's stress2 suite
Approved by: re (tmpfs blanket)
Diffstat (limited to 'sys/fs/tmpfs/tmpfs_vfsops.c')
-rw-r--r-- | sys/fs/tmpfs/tmpfs_vfsops.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index e860e16..a2ebf09 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -390,7 +390,7 @@ static int tmpfs_root(struct mount *mp, int flags, struct vnode **vpp, struct thread *td) { int error; - error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, vpp, td); + error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp, td); if (!error) (*vpp)->v_vflag |= VV_ROOT; @@ -429,7 +429,10 @@ tmpfs_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp) } TMPFS_UNLOCK(tmp); - return found ? tmpfs_alloc_vp(mp, node, vpp, curthread) : EINVAL; + if (found) + return (tmpfs_alloc_vp(mp, node, LK_EXCLUSIVE, vpp, curthread)); + + return (EINVAL); } /* --------------------------------------------------------------------- */ |