From patchwork Thu Apr 18 21:58:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 237750 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7607A2C01D3 for ; Fri, 19 Apr 2013 07:58:21 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936605Ab3DRV6V (ORCPT ); Thu, 18 Apr 2013 17:58:21 -0400 Received: from li9-11.members.linode.com ([67.18.176.11]:42698 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936231Ab3DRV6U (ORCPT ); Thu, 18 Apr 2013 17:58:20 -0400 Received: from root (helo=closure.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.80) (envelope-from ) id 1USwqg-0006wp-Ji; Thu, 18 Apr 2013 21:58:34 +0000 Received: by closure.thunk.org (Postfix, from userid 15806) id EB1DB5823BB; Thu, 18 Apr 2013 17:58:02 -0400 (EDT) From: Theodore Ts'o To: Ext4 Developers List Cc: Theodore Ts'o , "Darrick J. Wong" Subject: [PATCH] ext4: disable defrag for metadata_csum file systems Date: Thu, 18 Apr 2013 17:58:02 -0400 Message-Id: <1366322282-4673-1-git-send-email-tytso@mit.edu> X-Mailer: git-send-email 1.7.12.rc0.22.gcdd159b X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org It looks like there is absolutely no support for metadata checksums in fs/ext4/move_extent.c. So if you try to defrag a file on a metadata_csum, it leaves the file system corrupted. We really, really should get this fixed ASAP, but until we do, let's disable e4defrag on metadata_csum file systems so we avoid corrupting file systems. Cc: "Darrick J. Wong" Signed-off-by: "Theodore Ts'o" Reviewed-By: Zheng Liu --- fs/ext4/ioctl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 9491ac0..2d043da 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -450,6 +450,15 @@ group_extend_out: goto mext_out; } + if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, + EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) { + ext4_msg(sb, KERN_ERR, + "Online defrag not supported with " + "metadata_csum"); + err = -EOPNOTSUPP; + goto mext_out; + } + err = mnt_want_write_file(filp); if (err) goto mext_out;