On 06/13/2011 05:07 PM, Jim Schutt wrote:
Hi, On a system under a heavy write load from multiple ceph OSDs, I'm running into the following hung tasks where btrfs is implicated. I'm running commit 3c25fa740e2 from Linus' tree merged with commit cb9b41c92fa from git://ceph.newdream.net/git/ceph-client.git.
Please try this patch and verify it fixes the problem. If it does I'll make it less crappy and send it along. Thanks,
Josef
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 7a9f517..532139e 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -1236,12 +1236,16 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans, schedule_timeout(1); finish_wait(&cur_trans->writer_wait, &wait); - spin_lock(&root->fs_info->trans_lock); - root->fs_info->trans_no_join = 1; - spin_unlock(&root->fs_info->trans_lock); } while (atomic_read(&cur_trans->num_writers) > 1 || (should_grow && cur_trans->num_joined != joined)); + spin_lock(&root->fs_info->trans_lock); + root->fs_info->trans_no_join = 1; + spin_unlock(&root->fs_info->trans_lock); + + while (atomic_read(&cur_trans->num_writers) > 1) + schedule_timeout(1); + ret = create_pending_snapshots(trans, root->fs_info); BUG_ON(ret);