[Top] [All Lists]

[PATCH 19/20] xfs: disable XFS_IOC_SWAPEXT when rmap btree is enabled

To: xfs@xxxxxxxxxxx
Subject: [PATCH 19/20] xfs: disable XFS_IOC_SWAPEXT when rmap btree is enabled
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Wed, 3 Jun 2015 16:04:56 +1000
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1433311497-10245-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1433311497-10245-1-git-send-email-david@xxxxxxxxxxxxx>
From: Dave Chinner <dchinner@xxxxxxxxxx>

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 <dchinner@xxxxxxxxxx>
 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 5ed272b..b080cea 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -1696,6 +1696,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;

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