From patchwork Thu Feb 4 14:13:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 8222331 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E4BCFBEEE5 for ; Thu, 4 Feb 2016 14:15:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F8132027D for ; Thu, 4 Feb 2016 14:15:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F0BF12038E for ; Thu, 4 Feb 2016 14:15:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933201AbcBDOOq (ORCPT ); Thu, 4 Feb 2016 09:14:46 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:37821 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965347AbcBDONk (ORCPT ); Thu, 4 Feb 2016 09:13:40 -0500 Received: by mail-wm0-f43.google.com with SMTP id g62so6360778wme.0 for ; Thu, 04 Feb 2016 06:13:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=SHrp9xWBg5KkYDiTHcHhZ/dMJxgIdH0X2PCN4NwgmbM=; b=ejpp9sfzQgWdf7E7/hiPWZBRQiwKSIk0LyyXYrn+s7WraLvjvQFJSBDqhDxs++qddL yZNpTB+9Hv10GQ3Xn3DxOCPyNwBEO1P8IK+ZTwBie7T3H4f3EfWfzDG7rXVvPROHKCro Zv9o3Q9o+qTK538jeVl1hMhsTqjTEx/7LwS54= 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=SHrp9xWBg5KkYDiTHcHhZ/dMJxgIdH0X2PCN4NwgmbM=; b=ZnLuMu2YAWcp+BNOUK9GcXwYmhkY8TrOne4rDvWsSNcIe66wQ6Puu+ixOjLQgEqP5J l/AdktpTmwx9ooNp4k4kmV/dIg5p7KxA24wMtD37JFUlkYRDXoMTjgBgtfXVe7jsN0ks pwg41Vt8Q0/q+dLhD0nKM2DJoBs0PX6kU2NdBCn/Huj2sqjoamBR3JyMnBYgwB+H5wqd 2pZVlC/PReZuHHEcecuUlm07VIjabXk2AC1yaei2b54PrXktUuhFYqy+fPdnZLcv/wFa QrGEp09c4GtOE/BEY6A/tgi3LRqNEai6bzIW7umR02bMfJFEivnyND7RsLYJ5DFqAX6r O+Rw== X-Gm-Message-State: AG10YOTh+MMfmOJ2sfaRPzSRzpNDMl1iZ360oxIf+Ba4tD3tAvymeD5nptfE84wTusCX4Q== X-Received: by 10.194.117.134 with SMTP id ke6mr9560906wjb.94.1454595219115; Thu, 04 Feb 2016 06:13:39 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id u130sm26390332wmg.15.2016.02.04.06.13.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Feb 2016 06:13:38 -0800 (PST) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, axboe@fb.com Cc: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [PATCH 3/5] lightnvm: fix request intersection locking in rrpc Date: Thu, 4 Feb 2016 15:13:25 +0100 Message-Id: <1454595207-22432-4-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1454595207-22432-1-git-send-email-m@bjorling.me> References: <1454595207-22432-1-git-send-email-m@bjorling.me> 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.2 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 From: Javier González 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 Signed-off-by: Matias Bjørling --- 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,