From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Darrick J. Wong" Subject: [PATCH 29/58] xfs: disable XFS_IOC_SWAPEXT when rmap btree is enabled Date: Tue, 06 Oct 2015 21:58:19 -0700 Message-ID: <20151007045819.30457.61857.stgit@birch.djwong.org> References: <20151007045443.30457.47038.stgit@birch.djwong.org> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, xfs@oss.sgi.com, Dave Chinner To: david@fromorbit.com, darrick.wong@oracle.com Return-path: Received: from userp1040.oracle.com ([156.151.31.81]:44530 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751357AbbJGE6Y (ORCPT ); Wed, 7 Oct 2015 00:58:24 -0400 In-Reply-To: <20151007045443.30457.47038.stgit@birch.djwong.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: >>From : Dave Chinner Swapping extents between two inodes requires the owner to be updated in the rmap tree for all the extents that are swapped. This code does not yet exist, so switch off the XFS_IOC_SWAPEXT ioctl until support has been implemented. This will nee dto be done before the rmap btree code can have the experimental tag removed. Signed-off-by: Dave Chinner --- fs/xfs/xfs_bmap_util.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 8b2e505..f41a6f7 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -1685,6 +1685,19 @@ xfs_swap_extents( __uint64_t tmp; int lock_flags; + /* + * We can't swap extents on rmap btree enabled filesystems yet + * as there is no mechanism to update the owner of extents in + * the rmap tree yet. Hence, for the moment, just reject attempts + * to swap extents with EINVAL after emitting a warning once to remind + * us this needs fixing. + */ + if (xfs_sb_version_hasrmapbt(&mp->m_sb)) { + WARN_ONCE(1, + "XFS: XFS_IOC_SWAPEXT not supported on RMAP enabled filesystems\n"); + return -EINVAL; + } + tempifp = kmem_alloc(sizeof(xfs_ifork_t), KM_MAYFAIL); if (!tempifp) { error = -ENOMEM;