On Tue, Aug 25, 2015 at 01:09:43PM -0400, Josef Bacik wrote:
> If we have an fsync at the same time in two seperate subvolumes we could end 
> up
> with the tree log pointing at invalid blocks.  We need to notice if our 
> writeout

Mind to share more details of the problem?

Thanks,

-liubo
> failed in anyway, if it did then we need to do a full transaction commit and
> return an error on the subvolume that gave us the io error.  Thanks,
> 
> Signed-off-by: Josef Bacik <jba...@fb.com>
> ---
>  fs/btrfs/file.c     | 4 ++++
>  fs/btrfs/tree-log.c | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index b823fac..c8f49f5 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -2054,6 +2054,10 @@ int btrfs_sync_file(struct file *file, loff_t start, 
> loff_t end, int datasync)
>                       if (!ret) {
>                               ret = btrfs_end_transaction(trans, root);
>                               goto out;
> +                     } else if (ctx.io_err) {
> +                             btrfs_end_transaction(trans, root);
> +                             ret = ctx.io_err;
> +                             goto out;
>                       }
>               }
>               if (!full_sync) {
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 1bbaace..b4f15f5 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -2857,6 +2857,10 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
>               ret = btrfs_wait_marked_extents(log, &log->dirty_log_pages,
>                                               mark);
>               btrfs_wait_logged_extents(trans, log, log_transid);
> +             if (ret) {
> +                     btrfs_set_log_full_commit(root->fs_info, trans);
> +                     ctx->io_err = ret;
> +             }
>               wait_log_commit(log_root_tree,
>                               root_log_ctx.log_transid);
>               mutex_unlock(&log_root_tree->log_mutex);
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to