Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1339840

[PATCH v4 3/5] ext4: Online defrag not supported with DAX

From Ross Zwisler <ross.zwisler@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH v4 3/5] ext4: Online defrag not supported with DAX
Date 2016-02-22 20:10 +0100
Message-ID <r541Q-1YW-33@gated-at.bofh.it> (permalink)
References <r53Sa-1FT-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Online defrag operations for ext4 are hard coded to use the page cache.
See ext4_ioctl() -> ext4_move_extents() -> move_extent_per_page()

When combined with DAX I/O, which circumvents the page cache, this can
result in data corruption.  This was observed with xfstests ext4/307 and
ext4/308.

Fix this by only allowing online defrag for non-DAX files.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/ioctl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index a99b010..eae5917 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -583,6 +583,11 @@ group_extend_out:
 				 "Online defrag not supported with bigalloc");
 			err = -EOPNOTSUPP;
 			goto mext_out;
+		} else if (IS_DAX(inode)) {
+			ext4_msg(sb, KERN_ERR,
+				 "Online defrag not supported with DAX");
+			err = -EOPNOTSUPP;
+			goto mext_out;
 		}
 
 		err = mnt_want_write_file(filp);
-- 
2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 0/5] DAX fixes, move flushing calls to FS Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-02-22 20:00 +0100
  [PATCH v4 5/5] dax: move writeback calls into the filesystems Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-02-22 20:00 +0100
  [PATCH v4 1/5] block: disable block device DAX by default Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-02-22 20:10 +0100
  [PATCH v4 2/5] ext2, ext4: only set S_DAX for regular inodes Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-02-22 20:10 +0100
  [PATCH v4 3/5] ext4: Online defrag not supported with DAX Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-02-22 20:10 +0100
  [PATCH v4 4/5] dax: give DAX clearing code correct bdev Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-02-22 20:10 +0100

csiph-web