From patchwork Tue Jun 14 20:30:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benny Halevy X-Patchwork-Id: 880022 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5EKULur004750 for ; Tue, 14 Jun 2011 20:30:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753815Ab1FNUaT (ORCPT ); Tue, 14 Jun 2011 16:30:19 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:35616 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751404Ab1FNUaS (ORCPT ); Tue, 14 Jun 2011 16:30:18 -0400 Received: by iwn34 with SMTP id 34so4970768iwn.19 for ; Tue, 14 Jun 2011 13:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references; bh=f7O4eLOn/KQ4FG8qWStRbftA5UKhoOn6uILy7oc2Sj8=; b=qmRXcD48/HpV1Q2Qy69yUBLvkzkPBDWnUY3Scr7rCF0xeqg+08z+7CRwzcuh9v0Gkb gTPl2QzGEW6+FL3/C6p9pHCAFy2fcWv8wzGKwdAo8CxFaboKMLYPJI/ozlswyuomrLdk /IDUAEanh8vBujrThmndkvYBlUsZpUU6Ue154= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=RQUgvRwZJYkT1Sx/p3K3yUCTim/ywiY0MuTZkhlgcpDlfiwtOf2N8VOwF52AL8kPFq BCzb7+zykXnCTam+SveOxP3cavjvN3p6VTl/qn0YJBZaXJy3JlgvPsLP5Gmhzjgdn7sm 63MhTYnu8FPsfVGwgweVU1WWJfkIYQPO8suMo= Received: by 10.231.207.211 with SMTP id fz19mr7316218ibb.2.1308083418200; Tue, 14 Jun 2011 13:30:18 -0700 (PDT) Received: from localhost.localdomain (tonian-2.citi.umich.edu [141.212.112.251]) by mx.google.com with ESMTPS id x13sm3464614ibh.16.2011.06.14.13.30.17 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Jun 2011 13:30:17 -0700 (PDT) From: Benny Halevy To: Trond.Myklebust@netapp.com Cc: linux-nfs@vger.kernel.org, iisaman@netapp.com, Benny Halevy Subject: [PATCH] NFSv4.1: fix break condition in pnfs_find_lseg Date: Tue, 14 Jun 2011 16:30:16 -0400 Message-Id: <1308083416-22126-1-git-send-email-benny@tonian.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <4DF77254.2090608@gmail.com> References: <4DF77254.2090608@gmail.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 14 Jun 2011 20:30:21 +0000 (UTC) The break condition to skip out of the loop got broken when cmp_layout was change. Essentially, we want to stop looking once we know no layout on the remainder of the list can match the first byte of the looked-up range. Reported-by: Peng Tao Signed-off-by: Benny Halevy --- fs/nfs/pnfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 08c115d..b3994e1 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -895,7 +895,7 @@ pnfs_find_lseg(struct pnfs_layout_hdr *lo, ret = get_lseg(lseg); break; } - if (cmp_layout(range, &lseg->pls_range) > 0) + if (lseg->pls_range.offset > range->offset) break; }