From patchwork Tue May 10 11:31:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongqiang Yang X-Patchwork-Id: 94970 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 B6F1C1007D5 for ; Tue, 10 May 2011 21:31:49 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754597Ab1EJLbs (ORCPT ); Tue, 10 May 2011 07:31:48 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:49468 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753870Ab1EJLbr (ORCPT ); Tue, 10 May 2011 07:31:47 -0400 Received: by pvg12 with SMTP id 12so2780111pvg.19 for ; Tue, 10 May 2011 04:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=xq5JhT1LJzRtwwlzWvhlvGwH2M73Hff1x/09zIRNxho=; b=uBX1JEH3hr0V7L0lq5XIyWAt8k6x3MXxO/mPKKgpfoiBv45WwUdSsu+SgLPyl+cznF U2guUNQJ4EeBdshN1mhjQ6O5//qsp6hott2uK6O4gM6ruDxBB9wLayXCEcRLsmGvbe9U KMgMkHykhctu8W8pFTPVwDOY5G3VmDPrTBNo0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=M5kgv3cnEvy3dPHteXNpkSG6BWVagSJ44You8rFB1TYLDZrGSTOoQUfJ2SQBZD7EzG y8sGCLtEVT5iiPJs5gr7/1njD5DaOP2Ic47GAt5DfAwojJGSm6rNhFuL4zKVUS6KuMLB ALbCtL8kqFMGs4BSKZphJCm8KcoL4rtYdizlY= Received: by 10.142.212.10 with SMTP id k10mr3925153wfg.4.1305027106993; Tue, 10 May 2011 04:31:46 -0700 (PDT) Received: from localhost.localdomain ([159.226.40.136]) by mx.google.com with ESMTPS id z10sm9384831wfj.15.2011.05.10.04.31.44 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 May 2011 04:31:45 -0700 (PDT) From: Yongqiang Yang To: linux-ext4@vger.kernel.org Cc: tytso@mit.edu, Yongqiang Yang Subject: [PATCH] ext4:Fix a bug in 6d9c85eb. Date: Tue, 10 May 2011 19:31:57 +0800 Message-Id: <1305027117-936-1-git-send-email-xiaoqiangnk@gmail.com> X-Mailer: git-send-email 1.7.5.1 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org In case blocksize < pagesize, ext4_ext_fiemap_cb need to ignore blocks which are not in request range. BUG description: xfstests 225 ended in a endless loop without this patch when blocksize < pagesize. Reported-by: Amir Goldstein Signed-off-by: Yongqiang Yang --- fs/ext4/extents.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index e363f21..ec37109 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -3718,9 +3718,14 @@ out: bh = head; do { + if (end < newex->ec_block) + /* The buffer is not in + * the request range. + */ + continue; if (buffer_mapped(bh)) { /* get the 1st mapped buffer. */ - if (end > newex->ec_block + + if (end >= newex->ec_block + newex->ec_len) /* The buffer is out of * the request range.