From patchwork Thu Feb 4 13:57:06 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: 8221901 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 AEAEA9F37A for ; Thu, 4 Feb 2016 13:59:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D353C20394 for ; Thu, 4 Feb 2016 13:59:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 087492038A for ; Thu, 4 Feb 2016 13:59:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964930AbcBDN6b (ORCPT ); Thu, 4 Feb 2016 08:58:31 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:36752 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933042AbcBDN6a (ORCPT ); Thu, 4 Feb 2016 08:58:30 -0500 Received: by mail-wm0-f47.google.com with SMTP id p63so213047776wmp.1 for ; Thu, 04 Feb 2016 05:58:29 -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=xNLyb6wk6aUJrUqRhQ5lvJD6U1nVgSDy9QSXNENWfmQ=; b=xHYy7Da9fwEaARqzbVrfopMD7Ebam+PL34s9VZrPqspmGtC2gFDIOZXnzgK5bz+Slr 0yQ4JefoxNozWskQ6feOXb2SP7/53Jriq/GU7xyxCueUt5v+8EbGAcC0G0TEG60mp2yB VJXGDFU2TBapI07RRys1tjGlffo/+O70O8snQ= 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=xNLyb6wk6aUJrUqRhQ5lvJD6U1nVgSDy9QSXNENWfmQ=; b=egH0D4LoziqQuRi8nuDuvvwa6hFoawPEFTR4e6fGi3PA4wod46tLjIU+zwYOQ5k1rQ 1HPfb/8pF2kUHFd0UJi8YWU7pdmjmjUcr0rULugFKBenQhl9e2VFibgOpKAZYhgL1Nxc 5ddJJ6jmv8LR966YozMtlBlnRyzcImrIKaUt16F7rCv7aYE3Tm9VCu9VORDtapN2rVYK oCIDDvc8fiJm3MMdbiR8+RV7NjK7UTNpEdUFM70fQX3I4X0oDCHijbgooV9JXLKAXXfh jQ84Dpfjh9bsTdai0p6NvjNNs/ppWadvaIktknpludiCS5u8G29XuYOLzxjIaDarYXx/ ykNw== X-Gm-Message-State: AG10YORndwAwsx7srDMhe2Mj2ngKnPgVntOlq+WyQU2FwEcOfwO9dH9pGEhY+1nPjT2nEA== X-Received: by 10.28.173.208 with SMTP id w199mr9923929wme.45.1454594308842; Thu, 04 Feb 2016 05:58:28 -0800 (PST) Received: from localhost.localdomain (6164198-cl69.boa.fiberby.dk. [193.106.164.198]) by smtp.gmail.com with ESMTPSA id l194sm26656734wmb.14.2016.02.04.05.58.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Feb 2016 05:58:27 -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?= Subject: [PATCH 3/5] lightnvm: fix request intersection locking in rrpc Date: Thu, 4 Feb 2016 14:57:06 +0100 Message-Id: <1454594228-18970-4-git-send-email-m@bjorling.me> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1454594228-18970-1-git-send-email-m@bjorling.me> References: <1454594228-18970-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 --- 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,