Btrfs: clear current->journal_info on async transaction commit
authorSage Weil <sage@newdream.net>
Fri, 10 Jun 2011 18:43:13 +0000 (18:43 +0000)
committerChris Mason <chris.mason@oracle.com>
Fri, 10 Jun 2011 20:42:29 +0000 (16:42 -0400)
Normally current->jouranl_info is cleared by commit_transaction.  For an
async snap or subvol creation, though, it runs in a work queue.  Clear
it in btrfs_commit_transaction_async() to avoid leaking a non-NULL
journal_info when we return to userspace.  When the actual commit runs in
the other thread it won't care that it's current->journal_info is already
NULL.

Signed-off-by: Sage Weil <sage@newdream.net>
Tested-by: Jim Schutt <jaschut@sandia.gov>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/transaction.c

index 6b2e4786d189e11a8b596f3313e36d244391b272..2b3590b9fe98a6107efc9a7b13ce053e499c049e 100644 (file)
@@ -1118,8 +1118,11 @@ int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans,
                wait_current_trans_commit_start_and_unblock(root, cur_trans);
        else
                wait_current_trans_commit_start(root, cur_trans);
-       put_transaction(cur_trans);
 
+       if (current->journal_info == trans)
+               current->journal_info = NULL;
+
+       put_transaction(cur_trans);
        return 0;
 }