[Yaffs] lock held at task exit time

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Todd Poynor
Date:  
To: yaffs
Subject: [Yaffs] lock held at task exit time
Tasks that use yaffs* filesystems may oops when the Realtime Preemption
patches from Ingo Molnar et al are applied and CONFIG_PREEMPT_RT=y:

BUG: cp/1120, lock held at task exit time!
 [c2ebe064] {&dev->sem}
.. held by:        cp: 1120 [c3a70420, 118]
... acquired at:  nandmtd_EraseBlockInNAND+0x90/0xbc


There is a "Semaphore for waiting on erasure" that is initialized to a
locked state but is not otherwise referenced in the code. In RT kernels
this downs an RT mutex.

Since the semaphore is not currently used, the following suggested patch
removes it for now. Please let me know if there's something in the
works such that it should be initialized unlocked instead. Thanks --
Todd

Index: yaffs_mtdif.c
===================================================================
RCS file: /home/aleph1/cvs/yaffs2/yaffs_mtdif.c,v
retrieving revision 1.13
diff -u -r1.13 yaffs_mtdif.c
--- yaffs_mtdif.c    7 Nov 2005 07:13:33 -0000    1.13
+++ yaffs_mtdif.c    13 Mar 2006 23:36:33 -0000
@@ -138,8 +138,6 @@


     /* Todo finish off the ei if required */


-    sema_init(&dev->sem, 0);
-
     retval = mtd->erase(mtd, &ei);


     if (retval == 0)
Index: yaffs_guts.h
===================================================================
RCS file: /home/aleph1/cvs/yaffs2/yaffs_guts.h,v
retrieving revision 1.20
diff -u -r1.20 yaffs_guts.h
--- yaffs_guts.h    8 Mar 2006 07:59:20 -0000    1.20
+++ yaffs_guts.h    13 Mar 2006 23:36:34 -0000
@@ -549,7 +549,6 @@


#ifdef __KERNEL__

-    struct semaphore sem;    /* Semaphore for waiting on erasure.*/
     struct semaphore grossLock;    /* Gross locking semaphore */
     __u8 *spareBuffer;    /* For mtdif2 use. Don't know the size of the buffer 
                  * at compile time so we have to allocate it.