Date: Wed, 7 May 2008 19:21:18 +0400 From: pluknet <pluknet@gmail.com> To: "Coleman Kane" <cokane@freebsd.org> Cc: josh.carroll@gmail.com, freebsd-current@freebsd.org Subject: Re: panic mounting ntfs Message-ID: <a31046fc0805070821i742a0065i9f938e9964bb144e@mail.gmail.com> In-Reply-To: <1210172870.2043.17.camel@localhost> References: <8cb6106e0805062004r681045b5ge2981ae73e777a49@mail.gmail.com> <1210163153.2043.11.camel@localhost> <8cb6106e0805070800m46101f21sa8298b33e82bbfbd@mail.gmail.com> <1210172870.2043.17.camel@localhost>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
Hi, Josh.
>In doing some data recovery for my brother-in-law, I tried to mount
>his win2k partition (NTFS), and the box immediately panic'd.
What about this (maybe not very clean) patch?
It helped me to mount ntfs volume without a panic.
I guess ntfs was not modified after some lockmgr changes in feb/march.
wbr,
pluknet
[-- Attachment #2 --]
--- 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 <sys/file.h>
#include <sys/malloc.h>
#include <sys/lock.h>
+#include <sys/sx.h>
#include <sys/iconv.h>
/* #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 <sys/_sx.h>
+
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;
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a31046fc0805070821i742a0065i9f938e9964bb144e>
