diff options
author | Eric Whitney <enwlinux@gmail.com> | 2016-08-29 15:45:11 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-10-22 12:06:48 +0200 |
commit | e97a8cca79378b94ed2f80b27e91d12a8b989c10 (patch) | |
tree | 24f99f3ba3fed6a7664fd6fe4a83ba066c9ba46c /fs/ext4 | |
parent | fbc7b803831e5c8a42c1f3427a17e55a814d6b3c (diff) | |
download | linux-stable-e97a8cca79378b94ed2f80b27e91d12a8b989c10.tar.gz linux-stable-e97a8cca79378b94ed2f80b27e91d12a8b989c10.tar.bz2 linux-stable-e97a8cca79378b94ed2f80b27e91d12a8b989c10.zip |
ext4: enforce online defrag restriction for encrypted files
commit 14fbd4aa613bd5110556c281799ce36dc6f3ba97 upstream.
Online defragging of encrypted files is not currently implemented.
However, the move extent ioctl can still return successfully when
called. For example, this occurs when xfstest ext4/020 is run on an
encrypted file system, resulting in a corrupted test file and a
corresponding test failure.
Until the proper functionality is implemented, fail the move extent
ioctl if either the original or donor file is encrypted.
Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/move_extent.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index a920c5d29fac..6fc14def0c70 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -598,6 +598,13 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, __u64 orig_blk, return -EOPNOTSUPP; } + if (ext4_encrypted_inode(orig_inode) || + ext4_encrypted_inode(donor_inode)) { + ext4_msg(orig_inode->i_sb, KERN_ERR, + "Online defrag not supported for encrypted files"); + return -EOPNOTSUPP; + } + /* Protect orig and donor inodes against a truncate */ lock_two_nondirectories(orig_inode, donor_inode); |