From patchwork Tue Jul 10 13:30:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Behrens X-Patchwork-Id: 1177531 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id E4B6F40B37 for ; Tue, 10 Jul 2012 13:30:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755622Ab2GJNaV (ORCPT ); Tue, 10 Jul 2012 09:30:21 -0400 Received: from xp-ob.rzone.de ([81.169.146.141]:12034 "EHLO xp-ob.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752859Ab2GJNaV (ORCPT ); Tue, 10 Jul 2012 09:30:21 -0400 X-RZG-CLASS-ID: xp Received: from pizpot.store ([192.168.43.236]) by joses.store (joses xp3) (RZmta 29.19 OK) with ESMTP id p0468bo6A3tlvy for ; Tue, 10 Jul 2012 15:30:18 +0200 (CEST) X-Authentication-Warning: pizpot.store: berry set sender to sbehrens@giantdisaster.de using -f From: Stefan Behrens To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: avoid I/O repair BUG() from btree_read_extent_buffer_pages() Date: Tue, 10 Jul 2012 15:30:17 +0200 Message-Id: <1341927017-21824-1-git-send-email-sbehrens@giantdisaster.de> X-Mailer: git-send-email 1.7.11.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From btree_read_extent_buffer_pages(), currently repair_io_failure() can be called with mirror_num being zero when submit_one_bio() returned an error before. This used to cause a BUG_ON(!mirror_num) in repair_io_failure() and indeed this is not a case that needs the I/O repair code to rewrite disk blocks. This commit prevents calling repair_io_failure() in this case and thus avoids the BUG_ON() and malfunction. Signed-off-by: Stefan Behrens --- fs/btrfs/disk-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 8cc4710..0a7a99b 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -407,7 +407,7 @@ static int btree_read_extent_buffer_pages(struct btrfs_root *root, break; } - if (failed && !ret) + if (failed && !ret && failed_mirror) repair_eb_io_failure(root, eb, failed_mirror); return ret;