diff mbox

Btrfs: fix lockdep warning

Message ID 1366215556-8586-1-git-send-email-jbacik@fusionio.com (mailing list archive)
State New, archived
Headers show

Commit Message

Josef Bacik April 17, 2013, 4:19 p.m. UTC
The locking order for stuff is

__sb_start_write
ordered_mutex

but with sync() we don't do __sb_start_write for some strange reason, which
means that our iput in wait_ordered_extents could start a transaction which does
the __sb_start_write while we're holding the ordered_mutex.  Fix this by using
delayed iput in sync.  Thanks,

Reported-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
---
 fs/btrfs/super.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

David Sterba April 17, 2013, 4:57 p.m. UTC | #1
On Wed, Apr 17, 2013 at 12:19:16PM -0400, Josef Bacik wrote:
> The locking order for stuff is
> 
> __sb_start_write
> ordered_mutex
> 
> but with sync() we don't do __sb_start_write for some strange reason, which
> means that our iput in wait_ordered_extents could start a transaction which does
> the __sb_start_write while we're holding the ordered_mutex.  Fix this by using
> delayed iput in sync.  Thanks,

No lockdep warning anymore.

david
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index bb60fe5..2a0bece 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -866,7 +866,7 @@  int btrfs_sync_fs(struct super_block *sb, int wait)
 		return 0;
 	}
 
-	btrfs_wait_ordered_extents(root, 0);
+	btrfs_wait_ordered_extents(root, 1);
 
 	trans = btrfs_attach_transaction_barrier(root);
 	if (IS_ERR(trans)) {