From patchwork Tue Jun 24 08:49:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 4406931 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EE152BEEAA for ; Tue, 24 Jun 2014 08:48:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1FF6E20148 for ; Tue, 24 Jun 2014 08:48:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2FEE720145 for ; Tue, 24 Jun 2014 08:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751774AbaFXIsO (ORCPT ); Tue, 24 Jun 2014 04:48:14 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:46816 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751121AbaFXIsM (ORCPT ); Tue, 24 Jun 2014 04:48:12 -0400 X-IronPort-AV: E=Sophos;i="5.00,767,1396972800"; d="scan'208";a="32344257" Received: from localhost (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 24 Jun 2014 16:45:29 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s5O8m8bV006291 for ; Tue, 24 Jun 2014 16:48:08 +0800 Received: from adam-work.lan (10.167.226.24) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Tue, 24 Jun 2014 16:48:13 +0800 From: Qu Wenruo To: Subject: [PATCH] btrfs: Don't continue mounting when superblock csum mismatches even generation is less than 10. Date: Tue, 24 Jun 2014 16:49:13 +0800 Message-ID: <1403599753-4072-1-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.0.0 MIME-Version: 1.0 X-Originating-IP: [10.167.226.24] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Revert kernel commit 667e7d94a1683661cff5fe9a0fa0d7f8fdd2c007. (Btrfs: allow superblock mismatch from older mkfs by Chris Mason) Above commit will cause disaster if someone try to mount a newly created but later corrupted btrfs filesystem. And before btrfs entered mainline, btrfs-progs has already superblock checksum. See btrfs-progs commit: 5ccd1715fa2eaad0b26037bb53706779c8c93b5f (superblock duplication by Yan Zheng). Before commit 5ccd17, mkfs.btrfs uses 16K as super offset, while current btrfs uses 64K super offset, anyway old btrfs without super csum will not be mountable due to the change of super offset. So backward compatibility is not a problem. Signed-off-by: Qu Wenruo --- fs/btrfs/disk-io.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8bb4aa1..dbfb2a3 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -400,12 +400,6 @@ static int btrfs_check_super_csum(char *raw_disk_sb) if (memcmp(raw_disk_sb, result, csum_size)) ret = 1; - - if (ret && btrfs_super_generation(disk_sb) < 10) { - printk(KERN_WARNING - "BTRFS: super block crcs don't match, older mkfs detected\n"); - ret = 0; - } } if (csum_type >= ARRAY_SIZE(btrfs_csum_sizes)) {