Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332575
b: refs/heads/master
c: 9811465
h: refs/heads/master
i:
  332573: 92398b4
  332571: 9c61d8b
  332567: b7bb3e1
  332559: cd630e9
  332543: b713f64
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Oct 4, 2012
1 parent 047ad03 commit 4f9474a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6bbe3a9c805fcb8cd8d396dafd32078181a7cdd5
refs/heads/master: 98114659e0d467e2c0ee6f24f2429329328fc312
13 changes: 11 additions & 2 deletions trunk/fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,15 @@ static struct btrfs_trans_handle *start_transaction(struct btrfs_root *root,
if (!h)
return ERR_PTR(-ENOMEM);

if (!__sb_start_write(root->fs_info->sb, SB_FREEZE_FS, false)) {
/*
* If we are JOIN_NOLOCK we're already committing a transaction and
* waiting on this guy, so we don't need to do the sb_start_intwrite
* because we're already holding a ref. We need this because we could
* have raced in and did an fsync() on a file which can kick a commit
* and then we deadlock with somebody doing a freeze.
*/
if (type != TRANS_JOIN_NOLOCK &&
!__sb_start_write(root->fs_info->sb, SB_FREEZE_FS, false)) {
if (type == TRANS_JOIN_FREEZE)
return ERR_PTR(-EPERM);
sb_start_intwrite(root->fs_info->sb);
Expand Down Expand Up @@ -601,7 +609,8 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
}
}

sb_end_intwrite(root->fs_info->sb);
if (lock)
sb_end_intwrite(root->fs_info->sb);

WARN_ON(cur_trans != info->running_transaction);
WARN_ON(atomic_read(&cur_trans->num_writers) < 1);
Expand Down

0 comments on commit 4f9474a

Please sign in to comment.