mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
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
This commit is contained in:
parent
831aac011e
commit
ebcc9d9c8c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=83226
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -974,7 +974,6 @@ ntfs_vgetex(
|
||||
}
|
||||
}
|
||||
|
||||
VREF(ip->i_devvp);
|
||||
*vpp = vp;
|
||||
return (0);
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user