From patchwork Fri Dec 3 08:17:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liubo X-Patchwork-Id: 376921 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB38UXpU024790 for ; Fri, 3 Dec 2010 08:30:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758529Ab0LCIad (ORCPT ); Fri, 3 Dec 2010 03:30:33 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:62236 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S932126Ab0LCIa2 (ORCPT ); Fri, 3 Dec 2010 03:30:28 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 350861706A6; Fri, 3 Dec 2010 16:30:27 +0800 (CST) Received: from mailserver.fnst.cn.fujitus.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id oB38Pgqd014452; Fri, 3 Dec 2010 16:25:48 +0800 Received: from localhost.localdomain ([10.167.225.27]) by mailserver.fnst.cn.fujitus.com (Lotus Domino Release 8.5.1FP4) with ESMTP id 2010120316170216-155296 ; Fri, 3 Dec 2010 16:17:02 +0800 Message-ID: <4CF8A7A4.9020405@cn.fujitsu.com> Date: Fri, 03 Dec 2010 16:17:40 +0800 From: liubo User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: Linux Btrfs CC: Josef Bacik , Tsutomu Itoh , "Yan, Zheng" , Wenyi Liu , Mike Fedyk Subject: [RFC PATCH 5/5 v3] Btrfs: avoid log replay when btrfs is insane X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2010-12-03 16:17:02, Serialize by Router on mailserver/fnst(Release 8.5.1FP4|July 25, 2010) at 2010-12-03 16:30:37, Serialize complete at 2010-12-03 16:30:37 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 03 Dec 2010 08:30:35 +0000 (UTC) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 15d795a..727e156 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1937,9 +1937,14 @@ struct btrfs_root *open_ctree(struct super_block *sb, btrfs_set_opt(fs_info->mount_opt, SSD); } - if (btrfs_super_log_root(disk_super) != 0) { + if (btrfs_super_log_root(disk_super) != 0 && + !(fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR)) { u64 bytenr = btrfs_super_log_root(disk_super); + unsigned int s_flags = sb->s_flags; + if (s_flags & MS_RDONLY) + sb->s_flags &= ~MS_RDONLY; + if (fs_devices->rw_devices == 0) { printk(KERN_WARNING "Btrfs log replay required " "on RO media\n"); @@ -1969,6 +1974,8 @@ struct btrfs_root *open_ctree(struct super_block *sb, ret = btrfs_commit_super(tree_root); BUG_ON(ret); } + + sb->s_flags = s_flags; } ret = btrfs_find_orphan_roots(tree_root);