diff options
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r-- | fs/btrfs/tree-log.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index f10bf5213ed8..eeffff84f280 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -37,6 +37,7 @@ | |||
37 | */ | 37 | */ |
38 | #define LOG_INODE_ALL 0 | 38 | #define LOG_INODE_ALL 0 |
39 | #define LOG_INODE_EXISTS 1 | 39 | #define LOG_INODE_EXISTS 1 |
40 | #define LOG_OTHER_INODE 2 | ||
40 | 41 | ||
41 | /* | 42 | /* |
42 | * directory trouble cases | 43 | * directory trouble cases |
@@ -4641,7 +4642,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, | |||
4641 | if (S_ISDIR(inode->i_mode) || | 4642 | if (S_ISDIR(inode->i_mode) || |
4642 | (!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, | 4643 | (!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, |
4643 | &BTRFS_I(inode)->runtime_flags) && | 4644 | &BTRFS_I(inode)->runtime_flags) && |
4644 | inode_only == LOG_INODE_EXISTS)) | 4645 | inode_only >= LOG_INODE_EXISTS)) |
4645 | max_key.type = BTRFS_XATTR_ITEM_KEY; | 4646 | max_key.type = BTRFS_XATTR_ITEM_KEY; |
4646 | else | 4647 | else |
4647 | max_key.type = (u8)-1; | 4648 | max_key.type = (u8)-1; |
@@ -4665,7 +4666,13 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, | |||
4665 | return ret; | 4666 | return ret; |
4666 | } | 4667 | } |
4667 | 4668 | ||
4668 | mutex_lock(&BTRFS_I(inode)->log_mutex); | 4669 | if (inode_only == LOG_OTHER_INODE) { |
4670 | inode_only = LOG_INODE_EXISTS; | ||
4671 | mutex_lock_nested(&BTRFS_I(inode)->log_mutex, | ||
4672 | SINGLE_DEPTH_NESTING); | ||
4673 | } else { | ||
4674 | mutex_lock(&BTRFS_I(inode)->log_mutex); | ||
4675 | } | ||
4669 | 4676 | ||
4670 | /* | 4677 | /* |
4671 | * a brute force approach to making sure we get the most uptodate | 4678 | * a brute force approach to making sure we get the most uptodate |
@@ -4817,7 +4824,7 @@ again: | |||
4817 | * unpin it. | 4824 | * unpin it. |
4818 | */ | 4825 | */ |
4819 | err = btrfs_log_inode(trans, root, other_inode, | 4826 | err = btrfs_log_inode(trans, root, other_inode, |
4820 | LOG_INODE_EXISTS, | 4827 | LOG_OTHER_INODE, |
4821 | 0, LLONG_MAX, ctx); | 4828 | 0, LLONG_MAX, ctx); |
4822 | iput(other_inode); | 4829 | iput(other_inode); |
4823 | if (err) | 4830 | if (err) |