diff --git a/sys/fs/ntfs/ntfs_subr.c b/sys/fs/ntfs/ntfs_subr.c index e537abc0e3db..2a2177ccb2fb 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 (LIST_FIRST(&ip->i_fnlist)) - panic("ntfs_ntput: ntnode has fnodes\n"); - - ntfs_nthashrem(ip); - - 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); - - FREE(ip, M_NTFSNTNODE); - } else { + if (ip->i_usecount > 0) { LOCKMGR(&ip->i_lock, LK_RELEASE|LK_INTERLOCK, &ip->i_interlock); + return; } + + dprintf(("ntfs_ntput: deallocating ntnode: %d\n", ip->i_number)); + + if (LIST_FIRST(&ip->i_fnlist)) + panic("ntfs_ntput: ntnode has fnodes\n"); + + ntfs_nthashrem(ip); + + 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 b4bfe4ee15f1..94af95ba24b2 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 3278ecd8f07b..be192a180044 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);