]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] JBD: journal_unmap_buffer race fix
authorAndrew Morton <akpm@digeo.com>
Wed, 18 Jun 2003 01:30:38 +0000 (18:30 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Wed, 18 Jun 2003 01:30:38 +0000 (18:30 -0700)
We need to check that buffer is still journalled _after_ taking the right
locks.

fs/jbd/transaction.c

index 783a6acf1ea60f306a9741cf2a4fabe11a4ef2b5..fad662aea660df33f92b7ea8f2a22937c2782b9c 100644 (file)
@@ -1756,6 +1756,14 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
        spin_lock(&journal->j_state_lock);
        jbd_lock_bh_state(bh);
        spin_lock(&journal->j_list_lock);
+
+       /*
+        * Now we have the locks, check again to see whether kjournald has
+        * taken the buffer off the transaction.
+        */
+       if (!buffer_jbd(bh))
+               goto zap_buffer;
+
        jh = bh2jh(bh);
        transaction = jh->b_transaction;
        if (transaction == NULL) {