diff options
-rw-r--r-- | fs/btrfs/file.c | 2 | ||||
-rw-r--r-- | fs/btrfs/tree-log.c | 5 | ||||
-rw-r--r-- | fs/btrfs/tree-log.h | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 3391f2adf0c8..fea31a4a6e36 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -2070,7 +2070,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
2070 | } | 2070 | } |
2071 | trans->sync = true; | 2071 | trans->sync = true; |
2072 | 2072 | ||
2073 | btrfs_init_log_ctx(&ctx); | 2073 | btrfs_init_log_ctx(&ctx, inode); |
2074 | 2074 | ||
2075 | ret = btrfs_log_dentry_safe(trans, root, dentry, start, end, &ctx); | 2075 | ret = btrfs_log_dentry_safe(trans, root, dentry, start, end, &ctx); |
2076 | if (ret < 0) { | 2076 | if (ret < 0) { |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index ffe92da81b8a..e935035ac034 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -2823,7 +2823,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
2823 | */ | 2823 | */ |
2824 | mutex_unlock(&root->log_mutex); | 2824 | mutex_unlock(&root->log_mutex); |
2825 | 2825 | ||
2826 | btrfs_init_log_ctx(&root_log_ctx); | 2826 | btrfs_init_log_ctx(&root_log_ctx, NULL); |
2827 | 2827 | ||
2828 | mutex_lock(&log_root_tree->log_mutex); | 2828 | mutex_lock(&log_root_tree->log_mutex); |
2829 | atomic_inc(&log_root_tree->log_batch); | 2829 | atomic_inc(&log_root_tree->log_batch); |
@@ -4757,7 +4757,8 @@ again: | |||
4757 | if (ret < 0) { | 4757 | if (ret < 0) { |
4758 | err = ret; | 4758 | err = ret; |
4759 | goto out_unlock; | 4759 | goto out_unlock; |
4760 | } else if (ret > 0) { | 4760 | } else if (ret > 0 && ctx && |
4761 | other_ino != btrfs_ino(ctx->inode)) { | ||
4761 | struct btrfs_key inode_key; | 4762 | struct btrfs_key inode_key; |
4762 | struct inode *other_inode; | 4763 | struct inode *other_inode; |
4763 | 4764 | ||
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h index a9f1b75d080d..ab858e31ccbc 100644 --- a/fs/btrfs/tree-log.h +++ b/fs/btrfs/tree-log.h | |||
@@ -30,15 +30,18 @@ struct btrfs_log_ctx { | |||
30 | int log_transid; | 30 | int log_transid; |
31 | int io_err; | 31 | int io_err; |
32 | bool log_new_dentries; | 32 | bool log_new_dentries; |
33 | struct inode *inode; | ||
33 | struct list_head list; | 34 | struct list_head list; |
34 | }; | 35 | }; |
35 | 36 | ||
36 | static inline void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx) | 37 | static inline void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx, |
38 | struct inode *inode) | ||
37 | { | 39 | { |
38 | ctx->log_ret = 0; | 40 | ctx->log_ret = 0; |
39 | ctx->log_transid = 0; | 41 | ctx->log_transid = 0; |
40 | ctx->io_err = 0; | 42 | ctx->io_err = 0; |
41 | ctx->log_new_dentries = false; | 43 | ctx->log_new_dentries = false; |
44 | ctx->inode = inode; | ||
42 | INIT_LIST_HEAD(&ctx->list); | 45 | INIT_LIST_HEAD(&ctx->list); |
43 | } | 46 | } |
44 | 47 | ||