linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: yu kuai <yukuai3@huawei.com>
Cc: darrick.wong@oracle.com, bfoster@redhat.com, dchinner@redhat.com,
	sandeen@sandeen.net, cmaiolino@redhat.com, hch@lst.de,
	linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhengbin13@huawei.com, yi.zhang@huawei.com, houtao1@huawei.com
Subject: Re: [PATCH 1/2] xfs: introduce xfs_bmap_split_da_extent
Date: Mon, 6 Jan 2020 08:04:48 +1100	[thread overview]
Message-ID: <20200105210448.GB23128@dread.disaster.area> (raw)
In-Reply-To: <20191226134721.43797-2-yukuai3@huawei.com>

On Thu, Dec 26, 2019 at 09:47:20PM +0800, yu kuai wrote:
> Add a new function xfs_bmap_split_da_extent to split a delalloc extent
> into two delalloc extents.
> 
> Signed-off-by: yu kuai <yukuai3@huawei.com>
> ---
>  fs/xfs/libxfs/xfs_bmap.c | 26 ++++++++++++++++++++++++--
>  fs/xfs/libxfs/xfs_bmap.h |  1 +
>  2 files changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index 4c2e046fbfad..8247054c1e2b 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -6117,7 +6117,7 @@ xfs_bmap_split_extent_at(
>  	/*
>  	 * Convert to a btree if necessary.
>  	 */
> -	if (xfs_bmap_needs_btree(ip, whichfork)) {
> +	if (tp && xfs_bmap_needs_btree(ip, whichfork)) {
>  		int tmp_logflags; /* partial log flag return val */
>  
>  		ASSERT(cur == NULL);

You can't use xfs_bmap_split_extent_at() to split delalloc extents
just by avoiding transactional context.

delalloc extents only exist in the in-core extent list, not in the
on-disk BMBT extent list. xfs_bmap_split_extent_at() is for splitting
on-disk BMBT extents and, as such, it modifies the BMBT directly. It
may not be obvious that the bmbt cursor holds a pointer to the
transaction context, but it does and that's how we log all the
modifications to the BMBT done via the generic btree code.

IOWs, if the inode extent list is in btree format, this code will
not work correctly.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2020-01-05 21:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-26 13:47 [PATCH 0/2] fix stale data exposure problem yu kuai
2019-12-26 13:47 ` [PATCH 1/2] xfs: introduce xfs_bmap_split_da_extent yu kuai
2020-01-05 21:04   ` Dave Chinner [this message]
2019-12-26 13:47 ` [PATCH 2/2] xfs: fix stale data exposure problem when punch hole, collapse range or zero range across a delalloc extent yu kuai
2019-12-27  0:17   ` kbuild test robot
2019-12-27  0:17   ` [RFC PATCH] xfs: try_split_da_extent can be static kbuild test robot
2019-12-27 14:25   ` [xfs] 1c6c6a28e3: Assertion_failed kernel test robot
2020-01-06 21:57   ` [PATCH 2/2] xfs: fix stale data exposure problem when punch hole, collapse range or zero range across a delalloc extent Darrick J. Wong
2020-01-07  2:09     ` yukuai (C)
2020-01-07 18:17       ` Darrick J. Wong

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=20200105210448.GB23128@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=bfoster@redhat.com \
    --cc=cmaiolino@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=dchinner@redhat.com \
    --cc=hch@lst.de \
    --cc=houtao1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    --cc=zhengbin13@huawei.com \
    /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).