Re: [PATCH] Btrfs: protect the pending_snapshots list with trans_lock

2011-06-20 Thread David Sterba
On Wed, Jun 15, 2011 at 07:41:37AM -0400, Chris Mason wrote: There is definitely a window where two procs can be inside create_snapshot() at the same time in the same transaction. I trust you on that. I was trying to follow the callgraph from btrfs_strat_transaction called from create_snapshot

Re: [PATCH] Btrfs: protect the pending_snapshots list with trans_lock

2011-06-15 Thread David Sterba
Hi, On Tue, Jun 14, 2011 at 03:17:47PM -0400, Josef Bacik wrote: Currently there is nothing protecting the pending_snapshots list on the transaction. We only hold the directory mutex that we are snapshotting and a read lock on the subvol_sem, so we could race with somebody else creating a

Re: [PATCH] Btrfs: protect the pending_snapshots list with trans_lock

2011-06-15 Thread Chris Mason
Excerpts from David Sterba's message of 2011-06-15 05:53:29 -0400: Hi, On Tue, Jun 14, 2011 at 03:17:47PM -0400, Josef Bacik wrote: Currently there is nothing protecting the pending_snapshots list on the transaction. We only hold the directory mutex that we are snapshotting and a

[PATCH] Btrfs: protect the pending_snapshots list with trans_lock

2011-06-14 Thread Josef Bacik
Currently there is nothing protecting the pending_snapshots list on the transaction. We only hold the directory mutex that we are snapshotting and a read lock on the subvol_sem, so we could race with somebody else creating a snapshot in a different directory and end up with list corruption. So