From patchwork Fri Dec 3 00:16:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 74080 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 184C6B70B0 for ; Fri, 3 Dec 2010 11:17:01 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758159Ab0LCAQ7 (ORCPT ); Thu, 2 Dec 2010 19:16:59 -0500 Received: from e35.co.us.ibm.com ([32.97.110.153]:42418 "EHLO e35.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758144Ab0LCAQ6 (ORCPT ); Thu, 2 Dec 2010 19:16:58 -0500 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e35.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id oB304meh002549; Thu, 2 Dec 2010 17:04:48 -0700 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id oB30GvA1238034; Thu, 2 Dec 2010 17:16:57 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oB30GvDA027343; Thu, 2 Dec 2010 17:16:57 -0700 Received: from tux1.beaverton.ibm.com (elm3b50.beaverton.ibm.com [9.47.67.50]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id oB30Gumb027320; Thu, 2 Dec 2010 17:16:57 -0700 Received: by tux1.beaverton.ibm.com (Postfix, from userid 501) id 8D67013E7B7; Thu, 2 Dec 2010 16:16:56 -0800 (PST) Date: Thu, 2 Dec 2010 16:16:59 -0800 From: "Darrick J. Wong" To: "Theodore Ts'o" Cc: linux-kernel , linux-ext4 Subject: [PATCH] ext4: Set barrier=0 when block device does not advertise flush support Message-ID: <20101203001659.GI18195@tux1.beaverton.ibm.com> Reply-To: djwong@us.ibm.com MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org If the user tries to enable write flushes with "barrier=1" and the underlying block device does not support flushes, print a message and set barrier=0. Signed-off-by: Darrick J. Wong --- fs/ext4/super.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/ext4/super.c b/fs/ext4/super.c index e32195d..098dcf0 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -3124,6 +3124,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) &journal_ioprio, NULL, 0)) goto failed_mount; + /* Catch barrier=1 and no flush support */ + if (test_opt(sb, BARRIER) && + !(sb->s_bdev->bd_disk->queue->flush_flags & REQ_FLUSH)) { + ext4_msg(sb, KERN_WARNING, "flush not supported; disabling."); + clear_opt(sbi->s_mount_opt, BARRIER); + } + sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); @@ -4198,6 +4205,13 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) goto restore_opts; } + /* Catch barrier=1 and no flush support */ + if (test_opt(sb, BARRIER) && + !(sb->s_bdev->bd_disk->queue->flush_flags & REQ_FLUSH)) { + ext4_msg(sb, KERN_WARNING, "flush not supported; disabling."); + clear_opt(sbi->s_mount_opt, BARRIER); + } + if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) ext4_abort(sb, "Abort forced by user");