ext2fs locks help

Aditya Sarawgi sarawgi.aditya at gmail.com
Wed Nov 25 13:42:05 UTC 2009


Hi,

I am experiencing a strange problem with some locks I have applied to 
ext2fs. Here's what is happening

636 	static daddr_t
637 	ext2_alloccg(struct inode *ip, int cg, daddr_t bpref, int size)
638 	{
639 	        struct m_ext2fs *fs;
640 	        struct buf *bp;
641 	        struct ext2mount *ump;
642 	        int error, bno, start, end, loc;
643 	        char *bbp;
644 	        /* XXX ondisk32 */
645 	        mtx_assert(EXT2_MTX(ip->i_ump), MA_OWNED);
646 	        fs = ip->i_e2fs;
647 	        ump = ip->i_ump;
648 	        if (fs->e2fs_gd[cg].ext2bgd_nbfree == 0)
649 	                return (0);
650 	        EXT2_UNLOCK(ump);
		/* snip */

712 	        EXT2_LOCK(ump);

I have added a mutex to ext2mount for protecting fs similar to what ffs 
does. 

Now the problem is that system always panics at line 650 saying that 
panic: lock (sleep mutex) EXT2FS not locked @ 
/usr/src/sys/modules/ext2fs/../../fs/ext2fs/ext2_alloc.c:650

the assertion at 645 never fails and the system always panic at 650 
only. I also tried commenting line 650, the system panics saying that 
trying to recurse a non-recursive lock @ line 712. So the lock is 
getting lost in between. Is this due to some other process unlocking the 
system ?


 
-- 
Aditya Sarawgi


More information about the freebsd-fs mailing list