[Ocfs2-commits] zab commits r2140 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed Apr 13 15:58:04 CDT 2005


Author: zab
Signed-off-by: mfasheh
Date: 2005-04-13 15:58:03 -0500 (Wed, 13 Apr 2005)
New Revision: 2140

Modified:
   trunk/fs/ocfs2/aio.c
Log:
Simplify and fix the pending aio dtor tracking.
 
o the non-interrupt case wasn't removing the pending item. the interrupt case
  was removing the pending item twice.  full marks for symmetry!
o always push dtor work to keventd so umount can sync with it
o add some more bug_ons to catch freeing okps that are still on lists

Signed-off-by: mfasheh


Modified: trunk/fs/ocfs2/aio.c
===================================================================
--- trunk/fs/ocfs2/aio.c	2005-04-12 22:20:23 UTC (rev 2139)
+++ trunk/fs/ocfs2/aio.c	2005-04-13 20:58:03 UTC (rev 2140)
@@ -63,6 +63,9 @@
 {
 	BUG_ON(okp->kp_inode == NULL);
 
+	BUG_ON(!list_empty(&okp->kp_teardown_item));
+	BUG_ON(!list_empty(&okp->kp_pending_item));
+
 	if (okp->kp_info.wl_unlock_ctxt)
 		ocfs2_unlock_buffer_inodes(&okp->kp_ctxt);
 	if (okp->kp_have_alloc_sem) 
@@ -110,6 +113,7 @@
 {
 	struct ocfs2_kiocb_private *okp = iocb->private;
 	unsigned long flags;
+	ocfs_super *osb = okp->kp_osb;
 
 	/* okp_alloc only assigns the iocb->private and ->ki_dtor pointers if
 	 * it was able to alloc the okp and get an inode reference */
@@ -121,24 +125,21 @@
 	/* we had better not try to work with this iocb again */
 	iocb->private = NULL;
 
-	if (in_interrupt()) {
-		/* 
-		 * there is very little in the teardown that is interrupt-safe,
-		 * push it to keventd
-		 */
-		ocfs_super *osb = okp->kp_osb;
+	spin_lock_irqsave(&osb->osb_okp_teardown_lock, flags);
 
-		spin_lock_irqsave(&osb->osb_okp_teardown_lock, flags);
-		list_add_tail(&okp->kp_teardown_item,
-			      &osb->osb_okp_teardown_list);
-		list_del_init(&okp->kp_pending_item);
-		if (list_empty(&osb->osb_okp_pending_list))
-			wake_up(&osb->osb_okp_pending_wq);
-		list_del_init(&okp->kp_pending_item);
-		schedule_work(&osb->osb_okp_teardown_work);
-		spin_unlock_irqrestore(&osb->osb_okp_teardown_lock, flags);
-	} else
-		okp_teardown(okp);
+	list_del_init(&okp->kp_pending_item);
+	if (list_empty(&osb->osb_okp_pending_list))
+		wake_up(&osb->osb_okp_pending_wq);
+
+	/* 
+	 * there is very little in the teardown that is interrupt-safe and we
+	 * want to be able to sync with its completion so we unconditionally
+	 * push it to keventd.
+	 */
+	list_add_tail(&okp->kp_teardown_item, &osb->osb_okp_teardown_list);
+	schedule_work(&osb->osb_okp_teardown_work);
+
+	spin_unlock_irqrestore(&osb->osb_okp_teardown_lock, flags);
 }
 
 static int okp_pending_empty(ocfs_super *osb)



More information about the Ocfs2-commits mailing list