Hi, David Sterba * From: David Sterba [mailto:dsterba@xxxxxxx] > Sent: Friday, February 27, 2015 6:29 AM > To: Zhaolei > Cc: linux-btrfs@xxxxxxxxxxxxxxx > Subject: Re: [PATCH 1/1] btrfs: Fix NO_SPACE bug caused by delayed-iput > > On Thu, Feb 26, 2015 at 11:20:23AM +0800, Zhaolei wrote: > > --- a/fs/btrfs/transaction.c > > +++ b/fs/btrfs/transaction.c > > @@ -2068,8 +2068,12 @@ int btrfs_commit_transaction(struct > > btrfs_trans_handle *trans, > > > > kmem_cache_free(btrfs_trans_handle_cachep, trans); > > > > - if (current != root->fs_info->transaction_kthread) > > + if (current != root->fs_info->transaction_kthread) { > > btrfs_run_delayed_iputs(root); > > Using a mutex for this kind of synchronization is not entirely correct though it > works. > rw sem is best way I thought which was choosed from mutex, rw_sem, and wait_queue, although the function name is not self documented... Do you have some suggestion for this kind of synchronization? Thanks Zhaolei > > + /* make sure that all running delayed iput are done */ > > + down_write(&root->fs_info->delayed_iput_sem); > > + up_write(&root->fs_info->delayed_iput_sem); -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
