xfs
[Top] [All Lists]

[PATCH 2/2] xfs: reject swapext ioctl on swapfiles

To: xfs@xxxxxxxxxxx
Subject: [PATCH 2/2] xfs: reject swapext ioctl on swapfiles
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Tue, 10 Feb 2009 14:44:24 -0500
References: <20090210194422.767988000@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.47-1
Swapfiles are magic - I/O is directly initialized by the VM without
involving the filesystem.  Swapping out extents underneath the VM thus
can cause severe problems.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: xfs/fs/xfs/xfs_dfrag.c
===================================================================
--- xfs.orig/fs/xfs/xfs_dfrag.c 2009-02-10 19:19:25.440068967 +0100
+++ xfs/fs/xfs/xfs_dfrag.c      2009-02-10 19:20:35.182944272 +0100
@@ -79,6 +79,12 @@ xfs_swapext(
                goto out_put_target_file;
        }
 
+       if (IS_SWAPFILE(file->f_path.dentry->d_inode) ||
+           IS_SWAPFILE(target_file->f_path.dentry->d_inode)) {
+               error = XFS_ERROR(EINVAL);
+               goto out_put_target_file;
+       }
+
        ip = XFS_I(file->f_path.dentry->d_inode);
        tip = XFS_I(target_file->f_path.dentry->d_inode);
 

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