kern/50541: raidframe does not work
Tim Robbins
tim at robbins.dropbear.id.au
Wed Apr 2 04:00:29 PST 2003
>Number: 50541
>Category: kern
>Synopsis: raidframe does not work
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Apr 02 04:00:26 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Tim Robbins
>Release: FreeBSD 5.0-CURRENT
>Organization:
The FreeBSD Project
>Environment:
System: FreeBSD 5.0-CURRENT dated April 2, 2003
>Description:
RAIDframe does not work in FreeBSD 5.0-CURRENT: attempts to initialise an
array cause a kernel panic.
Mounting root from ufs:/dev/ad0s1a
RAIDFRAME: protectedSectors is 64
Waiting for DAG engine to start
Warning: p_fd fields not set
panic: lockmgr: thread 0xc0a08390, not exclusive lock holder 0xc1239ab0 unlocking
panic: from debugger
Uptime: 5m42s
This is easily reproduceable, and seems to be occurring when raidlookup() calls
vn_open().
In addition to this problem, there seems to be a misunderstanding between
threads and processes in rf_threadstuff.h, specifically RF_CREATE_THREAD.
It tries to return a struct proc * from kthread_create() into the caller's
struct thread *. A patch is attached for this problem, but not for the
lockmgr panic.
>How-To-Repeat:
cat <<EOF >mirror
START array
# numRow numCol numSpare
1 2 0
START disks
/dev/md0c
/dev/md1c
START layout
# sectPerSU SUsPerParityUnit SUsPerReconUnit RAID_level_0
128 1 1 1
START queue
fifo 100
EOF
mdconfig -a -t swap -s 32m
disklabel -r -w md0 auto
mdconfig -a -t swap -s 32m
disklabel -r -w md1 auto
raidctl -C mirror
>Fix:
Fix for thread/proc mixup:
Index: rf_threadstuff.h
===================================================================
RCS file: /home/ncvs/src/sys/dev/raidframe/rf_threadstuff.h,v
retrieving revision 1.2
diff -u -r1.2 rf_threadstuff.h
--- rf_threadstuff.h 20 Mar 2003 21:17:39 -0000 1.2
+++ rf_threadstuff.h 2 Apr 2003 07:41:41 -0000
@@ -125,9 +125,21 @@
kthread_exit(ret)
#elif defined(__FreeBSD__)
#if __FreeBSD_version > 500005
+static __inline int
+rf_create_thread(struct thread **_handle, void (*_func)(void *), void *_arg,
+ const char *_name)
+{
+ struct proc *p;
+ int ret;
+
+ ret = kthread_create(_func, _arg, &p, 0, 4, _name);
+ if (ret == 0)
+ *_handle = FIRST_THREAD_IN_PROC(p);
+ return (ret);
+}
#define RF_CREATE_THREAD(_handle_, _func_, _arg_, _name_) \
- kthread_create((void (*)(void *))(_func_), (void *)(_arg_), \
- (struct proc **)&(_handle_), 0, 4, _name_)
+ rf_create_thread(&(_handle_), (void (*)(void *))(_func_), _arg_, \
+ _name_)
#define RF_THREAD_EXIT(ret) \
kthread_exit(ret)
#else
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list