From patchwork Mon Feb 1 10:34:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= X-Patchwork-Id: 8177821 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E62C99F8AA for ; Mon, 1 Feb 2016 10:35:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0E0B220425 for ; Mon, 1 Feb 2016 10:35:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29448203B6 for ; Mon, 1 Feb 2016 10:35:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753160AbcBAKf3 (ORCPT ); Mon, 1 Feb 2016 05:35:29 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:37145 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753317AbcBAKei (ORCPT ); Mon, 1 Feb 2016 05:34:38 -0500 Received: by mail-wm0-f52.google.com with SMTP id l66so63971475wml.0 for ; Mon, 01 Feb 2016 02:34:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=XN+k6cAVgTr0oNUO/csgFSEZJMsJqArsbwzyVDz9bjs=; b=kMAce568e/5jKOQtVZzzEtoOZd8Qm2H1x/BFkx6FuzocXTv7g/wEJyrVP/Hw/N4mWN UqaCxEzyMS3R0Oc//PyjY4E0V2Q1DDmnroOY+EGlKN54sSCKUkKJH/mobxyecKCh5npn 7KKZxBQWvcbS6dfZTel6YtR4Dtj7+z7yKtWAuOLOuExOXo4La/TJNog+30hjPDNraqdf BAoUkUDLyzZHfURE+gVSGEhY/nfBPg0lvn83NsCJdnEXkVSLlAKb+4sTySFHCnC507wW 9VLt0U+n0PbDzxV0zyvCxYmg9qLxyLaiEzmNiH9hG5MLeIXGmt80VzESpEsiwPX1T/IK dw8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=XN+k6cAVgTr0oNUO/csgFSEZJMsJqArsbwzyVDz9bjs=; b=ezMKZnroZLiWY4racSEQnATvv3axH3B3yQ+QT+Pb+S5x7UQeSvp+mFMwyeHL+c+gAY ct4AJehcRQk5fIwL7l5n31ZCOCBtNr7pUTcdflOaWJMGROX4sldknigCs5xHQiy3EwGg iaSF5Lk6qyv75RUadhiIBuEyXeFjWrZBIW6cfhxO7R2qzCpMkZeqKv60bk3aLn0Rug50 AeHdAEJLynbruHIiCTBaR7SzAMaTK0gKDPSB/ZB7dq+9HH/3ulwVAW4j6ydeO46TnwsP oPUafdjBN15XgfOtx6rVaFECAei+/ro1sgAg3UCwGO/WC6JjajX9Api0BchI/WtjkqVc eaBQ== X-Gm-Message-State: AG10YOSZWYpvu9riZLTEQ2rjVzd3sCKvr4XjURNqkHAyfYQi6efLku9w0Bb9LaDD7T+4Bw== X-Received: by 10.28.130.205 with SMTP id e196mr11376403wmd.34.1454322877289; Mon, 01 Feb 2016 02:34:37 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id lh1sm28216482wjb.20.2016.02.01.02.34.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Feb 2016 02:34:36 -0800 (PST) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH 2/2] lightnvm: fix request intersection locking in rrpc Date: Mon, 1 Feb 2016 11:34:33 +0100 Message-Id: <1454322873-28687-2-git-send-email-javier@javigon.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1454322873-28687-1-git-send-email-javier@javigon.com> References: <1454322873-28687-1-git-send-email-javier@javigon.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 This patch fixes an error on the calculation of intersecting logical addresses; it contemplates the case where a new request including several addresses intersects with a single locked address. This case is typical when multiple pages are sent in a new request, while GC - which at the moment sends one address at the time - is running. Signed-off-by: Javier González --- drivers/lightnvm/rrpc.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/lightnvm/rrpc.h b/drivers/lightnvm/rrpc.h index c27283a..3989d65 100644 --- a/drivers/lightnvm/rrpc.h +++ b/drivers/lightnvm/rrpc.h @@ -174,8 +174,7 @@ static inline sector_t rrpc_get_sector(sector_t laddr) static inline int request_intersects(struct rrpc_inflight_rq *r, sector_t laddr_start, sector_t laddr_end) { - return (laddr_end >= r->l_start && laddr_end <= r->l_end) && - (laddr_start >= r->l_start && laddr_start <= r->l_end); + return (laddr_end >= r->l_start) && (laddr_start <= r->l_end); } static int __rrpc_lock_laddr(struct rrpc *rrpc, sector_t laddr,