Does this patch help? ===== fs/jfs/jfs_imap.c 1.37 vs edited ===== --- 1.37/fs/jfs/jfs_imap.c 2004-12-07 15:38:08 -06:00 +++ edited/fs/jfs/jfs_imap.c 2005-01-10 13:37:12 -06:00 @@ -2532,15 +2532,17 @@ * to include a new iag. */ + /* Must grab commit_sem before getting write lock on ipimap */ + down(&JFS_IP(ipimap)->commit_sem); + /* acquire inode map lock */ IWRITE_LOCK(ipimap); if (ipimap->i_size >> L2PSIZE != imap->im_nextiag + 1) { - IWRITE_UNLOCK(ipimap); - IAGFREE_UNLOCK(imap); jfs_error(imap->im_ipimap->i_sb, "diNewIAG: ipimap->i_size is wrong"); - return -EIO; + rc = -EIO; + goto unlock; } @@ -2551,11 +2553,8 @@ * number limit. */ if (iagno > (MAXIAGS - 1)) { - /* release the inode map lock */ - IWRITE_UNLOCK(ipimap); - rc = -ENOSPC; - goto out; + goto unlock; } /* @@ -2566,12 +2565,8 @@ /* Allocate extent for new iag page */ xlen = sbi->nbperpage; - if ((rc = dbAlloc(ipimap, 0, (s64) xlen, &xaddr))) { - /* release the inode map lock */ - IWRITE_UNLOCK(ipimap); - - goto out; - } + if ((rc = dbAlloc(ipimap, 0, (s64) xlen, &xaddr))) + goto unlock; /* assign a buffer for the page */ mp = get_metapage(ipimap, xaddr, PSIZE, 1); @@ -2581,11 +2576,8 @@ */ dbFree(ipimap, xaddr, (s64) xlen); - /* release the inode map lock */ - IWRITE_UNLOCK(ipimap); - rc = -EIO; - goto out; + goto unlock; } iagp = (struct iag *) mp->data; @@ -2617,22 +2609,17 @@ * addressing structure pointing to the new iag page; */ tid = txBegin(sb, COMMIT_FORCE); - down(&JFS_IP(ipimap)->commit_sem); /* update the inode map addressing structure to point to it */ if ((rc = xtInsert(tid, ipimap, 0, blkno, xlen, &xaddr, 0))) { txEnd(tid); - up(&JFS_IP(ipimap)->commit_sem); /* Free the blocks allocated for the iag since it was * not successfully added to the inode map */ dbFree(ipimap, xaddr, (s64) xlen); - /* release the inode map lock */ - IWRITE_UNLOCK(ipimap); - - goto out; + goto unlock; } /* update the inode map's inode to reflect the extension */ @@ -2660,11 +2647,6 @@ */ imap->im_freeiag = iagno; - /* Until we have logredo working, we want the imap inode & - * control page to be up to date. - */ - diSync(ipimap); - /* release the inode map lock */ IWRITE_UNLOCK(ipimap); } @@ -2688,11 +2670,17 @@ *iagnop = iagno; *mpp = mp; + goto out; + + unlock: + IWRITE_UNLOCK(ipimap); + up(&JFS_IP(ipimap)->commit_sem); + out: /* release the iag free lock */ IAGFREE_UNLOCK(imap); - return (rc); + return rc; } /*
_______________________________________________ Jfs-discussion mailing list Jfs-discussion@www-124.ibm.com http://www-124.ibm.com/developerworks/oss/mailman/listinfo/jfs-discussion