From: Christoph Hellwig <hch@lst.de>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: hch@lst.de, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] xfs: reflink should break pnfs leases before sharing blocks
Date: Thu, 18 Jan 2018 15:26:44 +0100 [thread overview]
Message-ID: <20180118142644.GA23196@lst.de> (raw)
In-Reply-To: <151626135332.25794.4917048406130796904.stgit@magnolia>
On Wed, Jan 17, 2018 at 11:42:33PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Before we share blocks between files, we need to break the pnfs leases
> on the layout before we start slicing and dicing the block map.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_reflink.c | 32 +++++++++++++++++++++++++++++++-
> 1 file changed, 31 insertions(+), 1 deletion(-)
>
>
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index da5c490..a701336 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -1249,6 +1249,34 @@ xfs_reflink_remap_blocks(
> }
>
> /*
> + * Grab the exclusive iolock for a data copy from in to out, making sure to
> + * break the pnfs layout leases on out before proceeding.
> + */
> +static int
> +xfs_iolock_two_inodes_and_break_layout(
> + struct inode *inode_in,
> + struct inode *inode_out)
> +{
> + uint iolock = XFS_IOLOCK_EXCL;
> + int error;
> +
> + if (inode_in < inode_out) {
> + inode_lock(inode_in);
> + inode_lock_nested(inode_out, I_MUTEX_NONDIR2);
> + } else {
> + inode_lock(inode_out);
> + }
> + error = xfs_break_layouts(inode_out, &iolock);
> + if (error) {
> + inode_unlock(inode_in);
> + return error;
> + }
> + if (inode_in > inode_out)
> + inode_lock_nested(inode_in, I_MUTEX_NONDIR2);
> + return 0;
So we'll keep the other inode lock while recalling in one of the
cases? In general I suspect we should be dropping all loops and
just restart all checks, similar to what we do for various cases
in the write path.
next prev parent reply other threads:[~2018-01-18 14:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-18 7:42 [PATCH 0/2] xfs: pnfs/reflink fixes Darrick J. Wong
2018-01-18 7:42 ` [PATCH 1/2] xfs: reflink should break pnfs leases before sharing blocks Darrick J. Wong
2018-01-18 14:26 ` Christoph Hellwig [this message]
2018-01-18 7:42 ` [PATCH 2/2] xfs: try to unshare extents before granting pnfs leases Darrick J. Wong
2018-01-18 14:15 ` Christoph Hellwig
2018-01-18 17:02 ` 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=20180118142644.GA23196@lst.de \
--to=hch@lst.de \
--cc=darrick.wong@oracle.com \
--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