diff options
author | semenu <semenu@FreeBSD.org> | 2001-09-08 22:57:03 +0000 |
---|---|---|
committer | semenu <semenu@FreeBSD.org> | 2001-09-08 22:57:03 +0000 |
commit | 4d49e9cd2b3b7ec38d869f666721755924573788 (patch) | |
tree | fa884121ffcae008978d368b4993a97af3e1eec4 /sys/fs/ntfs | |
parent | 72ce608646b8271247fd964d21b9afcdc13d9329 (diff) | |
download | FreeBSD-src-4d49e9cd2b3b7ec38d869f666721755924573788.zip FreeBSD-src-4d49e9cd2b3b7ec38d869f666721755924573788.tar.gz |
Reference devvp on ntnode creation and dereference on removal. Previous
code lead to page faults becouse i_devvp went zero after VOP_RECLAIM, but
ntnode was reused (not reclaimed).
MFC after: 2 weeks
Diffstat (limited to 'sys/fs/ntfs')
-rw-r--r-- | sys/fs/ntfs/ntfs_subr.c | 34 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_vfsops.c | 1 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_vnops.c | 4 |
3 files changed, 17 insertions, 22 deletions
diff --git a/sys/fs/ntfs/ntfs_subr.c b/sys/fs/ntfs/ntfs_subr.c index e537abc..2a2177c 100644 --- a/sys/fs/ntfs/ntfs_subr.c +++ b/sys/fs/ntfs/ntfs_subr.c @@ -405,6 +405,7 @@ ntfs_ntlookup( ip->i_mp = ntmp; LIST_INIT(&ip->i_fnlist); + VREF(ip->i_devvp); /* init lock and lock the newborn ntnode */ lockinit(&ip->i_lock, PINOD, "ntnode", 0, LK_EXCLUSIVE); @@ -448,28 +449,27 @@ ntfs_ntput(ip) } #endif - if (ip->i_usecount == 0) { - dprintf(("ntfs_ntput: deallocating ntnode: %d\n", - ip->i_number)); + if (ip->i_usecount > 0) { + LOCKMGR(&ip->i_lock, LK_RELEASE|LK_INTERLOCK, &ip->i_interlock); + return; + } - if (LIST_FIRST(&ip->i_fnlist)) - panic("ntfs_ntput: ntnode has fnodes\n"); + dprintf(("ntfs_ntput: deallocating ntnode: %d\n", ip->i_number)); - ntfs_nthashrem(ip); + if (LIST_FIRST(&ip->i_fnlist)) + panic("ntfs_ntput: ntnode has fnodes\n"); - while (LIST_FIRST(&ip->i_valist) != NULL) { - vap = LIST_FIRST(&ip->i_valist); - LIST_REMOVE(vap,va_list); - ntfs_freentvattr(vap); - } - mtx_unlock(&ip->i_interlock); - mtx_destroy(&ip->i_interlock); - lockdestroy(&ip->i_lock); + ntfs_nthashrem(ip); - FREE(ip, M_NTFSNTNODE); - } else { - LOCKMGR(&ip->i_lock, LK_RELEASE|LK_INTERLOCK, &ip->i_interlock); + while ((vap = LIST_FIRST(&ip->i_valist)) != NULL) { + LIST_REMOVE(vap,va_list); + ntfs_freentvattr(vap); } + mtx_unlock(&ip->i_interlock); + mtx_destroy(&ip->i_interlock); + lockdestroy(&ip->i_lock); + vrele(ip->i_devvp); + FREE(ip, M_NTFSNTNODE); } /* diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index b4bfe4e..94af95b 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -974,7 +974,6 @@ ntfs_vgetex( } } - VREF(ip->i_devvp); *vpp = vp; return (0); diff --git a/sys/fs/ntfs/ntfs_vnops.c b/sys/fs/ntfs/ntfs_vnops.c index 3278ecd..be192a1 100644 --- a/sys/fs/ntfs/ntfs_vnops.c +++ b/sys/fs/ntfs/ntfs_vnops.c @@ -277,10 +277,6 @@ ntfs_reclaim(ap) /* Purge old data structures associated with the inode. */ cache_purge(vp); - if (ip->i_devvp) { - vrele(ip->i_devvp); - ip->i_devvp = NULL; - } ntfs_frele(fp); ntfs_ntput(ip); |