--- ntfs_subr.c.orig 2008-05-07 18:17:01.000000000 +0400 +++ ntfs_subr.c 2008-05-07 18:11:05.000000000 +0400 @@ -40,6 +40,7 @@ #include #include #include +#include #include /* #define NTFS_DEBUG 1 */ @@ -358,7 +359,8 @@ ntfs_ntget(ip) mtx_lock(&ip->i_interlock); ip->i_usecount++; - lockmgr(&ip->i_lock, LK_EXCLUSIVE | LK_INTERLOCK, &ip->i_interlock); + mtx_unlock(&ip->i_interlock); + sx_xlock(&ip->i_lock); return 0; } @@ -405,7 +407,7 @@ ntfs_ntlookup( VREF(ip->i_devvp); /* init lock and lock the newborn ntnode */ - lockinit(&ip->i_lock, PINOD, "ntnode", 0, LK_EXCLUSIVE); + sx_init(&ip->i_lock, "ntnode"); mtx_init(&ip->i_interlock, "ntnode interlock", NULL, MTX_DEF); ntfs_ntget(ip); @@ -447,7 +449,8 @@ ntfs_ntput(ip) #endif if (ip->i_usecount > 0) { - lockmgr(&ip->i_lock, LK_RELEASE|LK_INTERLOCK, &ip->i_interlock); + mtx_unlock(&ip->i_interlock); + sx_xunlock(&ip->i_lock); return; } @@ -462,9 +465,10 @@ ntfs_ntput(ip) LIST_REMOVE(vap,va_list); ntfs_freentvattr(vap); } - lockmgr(&ip->i_lock, LK_RELEASE | LK_INTERLOCK, &ip->i_interlock); + mtx_unlock(&ip->i_interlock); + sx_xunlock(&ip->i_lock); mtx_destroy(&ip->i_interlock); - lockdestroy(&ip->i_lock); + sx_destroy(&ip->i_lock); vrele(ip->i_devvp); FREE(ip, M_NTFSNTNODE); } --- ntfs_inode.h.orig 2008-05-07 18:14:59.000000000 +0400 +++ ntfs_inode.h 2008-05-07 15:10:59.000000000 +0400 @@ -41,6 +41,8 @@ #define IN_LOADED 0x8000 /* ntvattrs loaded */ #define IN_PRELOADED 0x4000 /* loaded from directory entry */ +#include + struct ntnode { struct vnode *i_devvp; /* vnode of blk dev we live on */ struct cdev *i_dev; /* Device associated with the inode. */ @@ -53,7 +55,7 @@ struct ntnode { u_int32_t i_flag; /* locking */ - struct lock i_lock; + struct sx i_lock; struct mtx i_interlock; int i_usecount;