From: Miao Xie <miaox@cn.fujitsu.com>
To: Josef Bacik <jbacik@fb.com>, <linux-btrfs@vger.kernel.org>
Cc: <stable@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: make sure we wait on logged extents when fsycning two subvols
Date: Thu, 20 Nov 2014 18:58:48 +0800 [thread overview]
Message-ID: <546DC968.1020900@cn.fujitsu.com> (raw)
In-Reply-To: <1415287194-1967-1-git-send-email-jbacik@fb.com>
On Thu, 6 Nov 2014 10:19:54 -0500, Josef Bacik wrote:
> If we have two fsync()'s race on different subvols one will do all of its work
> to get into the log_tree, wait on it's outstanding IO, and then allow the
> log_tree to finish it's commit. The problem is we were just free'ing that
> subvols logged extents instead of waiting on them, so whoever lost the race
> wouldn't really have their data on disk. Fix this by waiting properly instead
> of freeing the logged extents. Thanks,
>
> cc: stable@vger.kernel.org
> Signed-off-by: Josef Bacik <jbacik@fb.com>
> ---
> fs/btrfs/tree-log.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 2d0fa43..70f99b1 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -2600,9 +2600,9 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
> if (atomic_read(&log_root_tree->log_commit[index2])) {
> blk_finish_plug(&plug);
> btrfs_wait_marked_extents(log, &log->dirty_log_pages, mark);
> + btrfs_wait_logged_extents(log, log_transid);
Why not add this log root into a list of log root tree, and then the committer
wait all ordered extents in each log root which is added in that list? By this
way, we can let the committer do some work during the data of ordered extents is
being transferred to the disk.
Thanks
Miao
> wait_log_commit(trans, log_root_tree,
> root_log_ctx.log_transid);
> - btrfs_free_logged_extents(log, log_transid);
> mutex_unlock(&log_root_tree->log_mutex);
> ret = root_log_ctx.log_ret;
> goto out;
>
prev parent reply other threads:[~2014-11-20 10:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-06 15:19 [PATCH] Btrfs: make sure we wait on logged extents when fsycning two subvols Josef Bacik
2014-11-20 10:58 ` Miao Xie [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=546DC968.1020900@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=jbacik@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox