| To: | linux-kernel@xxxxxxxxxxxxxxx |
|---|---|
| Subject: | [PATCH v3 3/6] ext4: Online defrag not supported with DAX |
| From: | Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx> |
| Date: | Tue, 16 Feb 2016 20:34:16 -0700 |
| Cc: | Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx>, "J. Bruce Fields" <bfields@xxxxxxxxxxxx>, "Theodore Ts'o" <tytso@xxxxxxx>, Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>, Andreas Dilger <adilger.kernel@xxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Dan Williams <dan.j.williams@xxxxxxxxx>, Dave Chinner <david@xxxxxxxxxxxxx>, Jan Kara <jack@xxxxxxxx>, Jeff Layton <jlayton@xxxxxxxxxxxxxxx>, Jens Axboe <axboe@xxxxxxxxx>, Matthew Wilcox <willy@xxxxxxxxxxxxxxx>, linux-block@xxxxxxxxxxxxxxx, linux-ext4@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, linux-nvdimm@xxxxxxxxxxxx, xfs@xxxxxxxxxxx |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1455680059-20126-1-git-send-email-ross.zwisler@xxxxxxxxxxxxxxx> |
| References: | <1455680059-20126-1-git-send-email-ross.zwisler@xxxxxxxxxxxxxxx> |
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@xxxxxxxxxxxxxxx>
---
fs/ext4/ioctl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 0f6c369..e32c86f 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
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH v3 4/6] dax: give DAX clearing code correct bdev, Ross Zwisler |
|---|---|
| Next by Date: | [PATCH v3 5/6] dax: move writeback calls into the filesystems, Ross Zwisler |
| Previous by Thread: | Re: [PATCH v3 4/6] dax: give DAX clearing code correct bdev, Jan Kara |
| Next by Thread: | Re: [PATCH v3 3/6] ext4: Online defrag not supported with DAX, Jan Kara |
| Indexes: | [Date] [Thread] [Top] [All Lists] |