summaryrefslogtreecommitdiffstats
path: root/sys/fs/ntfs
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2002-03-17 01:25:47 +0000
committermckusick <mckusick@FreeBSD.org>2002-03-17 01:25:47 +0000
commit14dd08fd153468502c32dc2d9c1e25a6c2d761d1 (patch)
treeee06559e7b5061e6fc6cf074dfca793dd31c681b /sys/fs/ntfs
parent34dcf8975d103d034d7e8b6788c0645cc93af254 (diff)
downloadFreeBSD-src-14dd08fd153468502c32dc2d9c1e25a6c2d761d1.zip
FreeBSD-src-14dd08fd153468502c32dc2d9c1e25a6c2d761d1.tar.gz
Add a flags parameter to VFS_VGET to pass through the desired
locking flags when acquiring a vnode. The immediate purpose is to allow polling lock requests (LK_NOWAIT) needed by soft updates to avoid deadlock when enlisting other processes to help with the background cleanup. For the future it will allow the use of shared locks for read access to vnodes. This change touches a lot of files as it affects most filesystems within the system. It has been well tested on FFS, loopback, and CD-ROM filesystems. only lightly on the others, so if you find a problem there, please let me (mckusick@mckusick.com) know.
Diffstat (limited to 'sys/fs/ntfs')
-rw-r--r--sys/fs/ntfs/ntfs_subr.c2
-rw-r--r--sys/fs/ntfs/ntfs_vfsops.c16
-rw-r--r--sys/fs/ntfs/ntfs_vnops.c4
3 files changed, 12 insertions, 10 deletions
diff --git a/sys/fs/ntfs/ntfs_subr.c b/sys/fs/ntfs/ntfs_subr.c
index f14d741..de239f0 100644
--- a/sys/fs/ntfs/ntfs_subr.c
+++ b/sys/fs/ntfs/ntfs_subr.c
@@ -1946,7 +1946,7 @@ ntfs_toupper_use(mp, ntmp)
MALLOC(ntfs_toupper_tab, wchar *, 65536 * sizeof(wchar),
M_NTFSRDATA, M_WAITOK);
- if ((error = VFS_VGET(mp, NTFS_UPCASEINO, &vp)))
+ if ((error = VFS_VGET(mp, NTFS_UPCASEINO, LK_EXCLUSIVE, &vp)))
goto out;
error = ntfs_readattr(ntmp, VTONT(vp), NTFS_A_DATA, NULL,
0, 65536*sizeof(wchar), (char *) ntfs_toupper_tab, NULL);
diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c
index 712d4d3..48bacbe 100644
--- a/sys/fs/ntfs/ntfs_vfsops.c
+++ b/sys/fs/ntfs/ntfs_vfsops.c
@@ -68,7 +68,7 @@ static int ntfs_root __P((struct mount *, struct vnode **));
static int ntfs_statfs __P((struct mount *, struct statfs *,
struct thread *));
static int ntfs_unmount __P((struct mount *, int, struct thread *));
-static int ntfs_vget __P((struct mount *mp, ino_t ino,
+static int ntfs_vget __P((struct mount *mp, ino_t ino, int lkflags,
struct vnode **vpp));
static int ntfs_mountfs __P((register struct vnode *, struct mount *,
struct ntfs_args *, struct thread *));
@@ -367,7 +367,8 @@ ntfs_mountfs(devvp, mp, argsp, td)
{
int pi[3] = { NTFS_MFTINO, NTFS_ROOTINO, NTFS_BITMAPINO };
for (i=0; i<3; i++) {
- error = VFS_VGET(mp, pi[i], &(ntmp->ntm_sysvn[pi[i]]));
+ error = VFS_VGET(mp, pi[i], LK_EXCLUSIVE,
+ &(ntmp->ntm_sysvn[pi[i]]));
if(error)
goto out1;
ntmp->ntm_sysvn[pi[i]]->v_flag |= VSYSTEM;
@@ -397,7 +398,7 @@ ntfs_mountfs(devvp, mp, argsp, td)
struct attrdef ad;
/* Open $AttrDef */
- error = VFS_VGET(mp, NTFS_ATTRDEFINO, &vp );
+ error = VFS_VGET(mp, NTFS_ATTRDEFINO, LK_EXCLUSIVE, &vp );
if(error)
goto out1;
@@ -537,7 +538,7 @@ ntfs_root(
dprintf(("ntfs_root(): sysvn: %p\n",
VFSTONTFS(mp)->ntm_sysvn[NTFS_ROOTINO]));
- error = VFS_VGET(mp, (ino_t)NTFS_ROOTINO, &nvp);
+ error = VFS_VGET(mp, (ino_t)NTFS_ROOTINO, LK_EXCLUSIVE, &nvp);
if(error) {
printf("ntfs_root: VFS_VGET failed: %d\n",error);
return (error);
@@ -625,7 +626,7 @@ ntfs_fhtovp(
ddprintf(("ntfs_fhtovp(): %d\n", ntfhp->ntfid_ino));
- if ((error = VFS_VGET(mp, ntfhp->ntfid_ino, &nvp)) != 0) {
+ if ((error = VFS_VGET(mp, ntfhp->ntfid_ino, LK_EXCLUSIVE, &nvp)) != 0) {
*vpp = NULLVP;
return (error);
}
@@ -768,10 +769,11 @@ static int
ntfs_vget(
struct mount *mp,
ino_t ino,
+ int lkflags,
struct vnode **vpp)
{
- return ntfs_vgetex(mp, ino, NTFS_A_DATA, NULL,
- LK_EXCLUSIVE | LK_RETRY, 0, curthread, vpp);
+ return ntfs_vgetex(mp, ino, NTFS_A_DATA, NULL, lkflags, 0,
+ curthread, vpp);
}
static struct vfsops ntfs_vfsops = {
diff --git a/sys/fs/ntfs/ntfs_vnops.c b/sys/fs/ntfs/ntfs_vnops.c
index e07914b..31b910b 100644
--- a/sys/fs/ntfs/ntfs_vnops.c
+++ b/sys/fs/ntfs/ntfs_vnops.c
@@ -629,8 +629,8 @@ ntfs_lookup(ap)
dprintf(("ntfs_lookup: parentdir: %d\n",
vap->va_a_name->n_pnumber));
- error = VFS_VGET(ntmp->ntm_mountp,
- vap->va_a_name->n_pnumber,ap->a_vpp);
+ error = VFS_VGET(ntmp->ntm_mountp, vap->va_a_name->n_pnumber,
+ LK_EXCLUSIVE, ap->a_vpp);
ntfs_ntvattrrele(vap);
if (error) {
if (vn_lock(dvp,LK_EXCLUSIVE|LK_RETRY,cnp->cn_thread)==0)
OpenPOWER on IntegriCloud