From patchwork Fri Nov 18 02:52:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Dong X-Patchwork-Id: 126341 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 91A1AB7244 for ; Fri, 18 Nov 2011 13:52:51 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755576Ab1KRCwt (ORCPT ); Thu, 17 Nov 2011 21:52:49 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:45916 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752751Ab1KRCws (ORCPT ); Thu, 17 Nov 2011 21:52:48 -0500 Received: by iage36 with SMTP id e36so3031377iag.19 for ; Thu, 17 Nov 2011 18:52:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=REoYTH9nzm24WOMLmuFoYqo3krB4l7V2/ViRKleIm54=; b=v9w0KGpdasg4oQncJXAio7nSIiFkYA9KQB4o0T6a4JtC1sNWMnIhgU7bmypA2KLBBY lH55SbJt45yX9IOjEDZ2FEkbw3k4zlLlFq+6vIfR3b1Fd//URfh0MvuH2xTKqqcPh4Hu aRFeSUh8PAJd6e002ysgMz4+Dr/RhzBI3Lu9A= Received: by 10.43.53.1 with SMTP id vo1mr815036icb.2.1321584768135; Thu, 17 Nov 2011 18:52:48 -0800 (PST) Received: from localhost.localdomain ([110.75.120.247]) by mx.google.com with ESMTPS id z10sm65389766ibv.9.2011.11.17.18.52.46 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 17 Nov 2011 18:52:47 -0800 (PST) From: Robin Dong To: linux-ext4@vger.kernel.org Cc: Robin Dong Subject: [PATCH] e2fsck: fix "can't find dup_blk" error Date: Fri, 18 Nov 2011 10:52:38 +0800 Message-Id: <1321584758-4259-1-git-send-email-hao.bigrat@gmail.com> X-Mailer: git-send-email 1.7.3.2 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Robin Dong After: 1. mke2fs -O ^has_journal,^resize_inode,^uninit_bg,extent,meta_bg,flex_bg,bigalloc /dev/sda 2. mount -t ext4 /dev/sda /test/ 3. create file (8192K size, extent' e_len is 2) /test/1 ~ /test/10 4. use tool to change the /test/5 extent's e_len to 100, corrupt file 5. e2fsck -f /dev/sda And it will report like: Clone multiply-claimed blocks? yes clone_file_block: internal error: can't find dup_blk for 525345 clone_file_block: internal error: can't find dup_blk for 525346 clone_file_block: internal error: can't find dup_blk for 525347 clone_file_block: internal error: can't find dup_blk for 525348 In bigalloc filesystem, "blockcnt > 0" should change to "blockcnt >= cluster_ratio" Signed-off-by: Robin Dong --- e2fsck/pass1b.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c index d5585dd..a9cdd9e 100644 --- a/e2fsck/pass1b.c +++ b/e2fsck/pass1b.c @@ -703,7 +703,7 @@ static int clone_file_block(ext2_filsys fs, if (check_if_fs_cluster(ctx, EXT2FS_B2C(fs, *block_nr))) is_meta = 1; - if (((blockcnt > 0) && c == cs->dup_cluster) || + if (((blockcnt >= EXT2FS_CLUSTER_RATIO(fs)) && c == cs->dup_cluster) || ext2fs_test_block_bitmap2(ctx->block_dup_map, *block_nr)) { n = dict_lookup(&clstr_dict, INT_TO_VOIDPTR(EXT2FS_B2C(fs, *block_nr)));