linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: cancel COW blocks before swapext
Date: Mon, 8 Oct 2018 11:31:32 -0400	[thread overview]
Message-ID: <20181008153132.GA6377@bfoster> (raw)
In-Reply-To: <20181008101624.28120-1-hch@lst.de>

On Mon, Oct 08, 2018 at 12:16:24PM +0200, Christoph Hellwig wrote:
> We need to make sure we have no outstanding COW blocks before we swap
> extents, as there is nothing preventing us from having preallocated COW
> delalloc on either inode that swapext is called on.  That case can
> easily be reproduced by running generic/324 in always_cow mode:
> 

Ok, I'm a little curious how you end up with delayed allocation
cowblocks in the temporary inode (created by xfs_fsr), but it sounds
like you have a mechanism enabled that utilizes cow in more situations
than purely shared blocks..?

Out of curiosity, what does xfs_fsr do to trigger cow fork reservation
in always_cow mode? Is it limited to overwrites, or do all writes result
in some kind of cow reservation?

> [  620.760572] XFS: Assertion failed: tip->i_delayed_blks == 0, file: fs/xfs/xfs_bmap_util.c, line: 1669
> [  620.761608] ------------[ cut here ]------------
...
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  fs/xfs/xfs_bmap_util.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index 7cfda25f1bb1..97f7543fdfb6 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -1465,6 +1465,12 @@ xfs_swap_extent_flush(
>  		return error;
>  	truncate_pagecache_range(VFS_I(ip), 0, -1);
>  
> +	if (xfs_inode_has_cow_data(ip)) {
> +		error = xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, true);
> +		if (error)
> +			return error;
> +	}
> +

Same comment as before.. we have 20-30 lines of code in
xfs_swap_extents() dedicated to swapping the cowblocks tags and cow
forks when ->if_bytes != 0. This patch appears to nullify that code, so
we should at least be able to reduce some of that to asserts.

Brian

>  	/* Verify O_DIRECT for ftmp */
>  	if (VFS_I(ip)->i_mapping->nrpages)
>  		return -EINVAL;
> -- 
> 2.19.0
> 

  reply	other threads:[~2018-10-08 22:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08 10:16 [PATCH] xfs: cancel COW blocks before swapext Christoph Hellwig
2018-10-08 15:31 ` Brian Foster [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-10-14 18:48 Christoph Hellwig
2018-10-15 12:46 ` Brian Foster

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=20181008153132.GA6377@bfoster \
    --to=bfoster@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-xfs@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;
as well as URLs for NNTP newsgroup(s).