From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424325AbcBQVeb (ORCPT ); Wed, 17 Feb 2016 16:34:31 -0500 Received: from mx2.suse.de ([195.135.220.15]:42065 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965022AbcBQVea (ORCPT ); Wed, 17 Feb 2016 16:34:30 -0500 Date: Wed, 17 Feb 2016 22:34:50 +0100 From: Jan Kara To: Ross Zwisler Cc: linux-kernel@vger.kernel.org, "J. Bruce Fields" , "Theodore Ts'o" , Alexander Viro , Andreas Dilger , Andrew Morton , Dan Williams , Dave Chinner , Jan Kara , Jeff Layton , Jens Axboe , Matthew Wilcox , linux-block@vger.kernel.org, linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-nvdimm@ml01.01.org, xfs@oss.sgi.com Subject: Re: [PATCH v3 3/6] ext4: Online defrag not supported with DAX Message-ID: <20160217213450.GI14140@quack.suse.cz> References: <1455680059-20126-1-git-send-email-ross.zwisler@linux.intel.com> <1455680059-20126-4-git-send-email-ross.zwisler@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1455680059-20126-4-git-send-email-ross.zwisler@linux.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 16-02-16 20:34:16, Ross Zwisler wrote: > 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 We need to handle this eventually but for now we are fine. You can add: Reviewed-by: Jan Kara Honza > --- > 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 > > -- Jan Kara SUSE Labs, CR