xfs
[Top] [All Lists]

Re: [PATCH] xfs: fail ->bmap for reflink inodes

To: Avi Kivity <avi@xxxxxxxxxxxx>
Subject: Re: [PATCH] xfs: fail ->bmap for reflink inodes
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Fri, 27 May 2016 10:40:50 -0700
Cc: Christoph Hellwig <hch@xxxxxx>, linux-mm@xxxxxxxxx, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <71afd256-5dfe-2ff9-ac25-b7519dadd5f9@xxxxxxxxxxxx>
References: <1464267724-31423-1-git-send-email-hch@xxxxxx> <1464267724-31423-2-git-send-email-hch@xxxxxx> <71afd256-5dfe-2ff9-ac25-b7519dadd5f9@xxxxxxxxxxxx>
User-agent: Mutt/1.5.24 (2015-08-30)
On Fri, May 27, 2016 at 08:32:18PM +0300, Avi Kivity wrote:
> On 05/26/2016 04:02 PM, Christoph Hellwig wrote:
> >Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> >---
> >  fs/xfs/xfs_aops.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> >diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
> >index a955552..d053a9e 100644
> >--- a/fs/xfs/xfs_aops.c
> >+++ b/fs/xfs/xfs_aops.c
> >@@ -1829,6 +1829,17 @@ xfs_vm_bmap(
> >     trace_xfs_vm_bmap(XFS_I(inode));
> >     xfs_ilock(ip, XFS_IOLOCK_SHARED);
> >+
> >+    /*
> >+     * The swap code (ab-)uses ->bmap to get a block mapping and then
> >+     * bypasseÑ the file system for actual I/O.  We really can't allow
> >+     * that on reflinks inodes, so we have to skip out here.  And yes,
> >+     * 0 is the magic code for a bmap error..
> >+     */
> >+    if (xfs_is_reflink_inode(ip)) {
> >+            xfs_iunlock(ip, XFS_IOLOCK_SHARED);
> >+            return 0;
> >+    }
> >     filemap_write_and_wait(mapping);
> >     xfs_iunlock(ip, XFS_IOLOCK_SHARED);
> >     return generic_block_bmap(mapping, block, xfs_get_blocks);
> 
> Don't you also have to prevent a swapfile from being reflinked after it's
> bmapped?  Or is that already taken care of?

Already taken care of, at least for XFS.

--D

<Prev in Thread] Current Thread [Next in Thread>