Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp892193yba; Thu, 18 Apr 2019 11:18:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpCF5HUZX2KWngXTtQbtz+VTuoY+7hYsdB6I3Q5sDu/4nmRYL6uC7uttH503D3rFbpK4Jc X-Received: by 2002:a63:1003:: with SMTP id f3mr87421494pgl.227.1555611518257; Thu, 18 Apr 2019 11:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611518; cv=none; d=google.com; s=arc-20160816; b=YpjyQ9+drIJ6yLxohbURbTP+VZf62wBKGz5nme/NI4s0eRspIYlcHXaODfZ5w7+8R5 s491/t5wN3XmNZxEW9T3k37iJ2vCQtzzlvEy8cw8Amoi8nYiV4WJr58S2ej+n/lSeY5B vzzpnGcoUms2iKgqZf1SshtsXrVG55fpMtsWVsx9oJWxxoutEfc6o7gop7FV7f7QoShB H6jlW+y0QdsR9ZkSuABWrz1NDZPnVyVcYnDqYVRrWLAdGtiUM5S2l4xxROuN6nzAe7de IPsMHX64t1qtTU2Q9wzryl5Ea5eVMlLVJTovgY+PnbaTPthFkZjvwho893BLJLO6+VxK 4qpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VOMghMnIihg16X1Q3MubHwLAl4j5XNv8sfE1QhnKHvo=; b=FI+fnZMnZjUCeUMlZejgohyPgpNQliK/X0pO6mZeaEe3/9pHTuVS9/FX325eBywjt/ vgdpzSwJlAQJbFea9W649kkTCP+8magAQmrGnJJrYCe62w9eC6JxUDSWV2zK50sZQd+O hx+sfESVqdQzjXJYe1AwQVrX8sqMV+4xQnmcgoaKCKyrlkhX0wN2mDa2FP8p/O13DxVF 0euU43SVtsVTMtRjQagyzfbaw+Ngp7q9rWeTAKlPMRDxLogkOx2cWj6lMvNadzpBbRuw BqpZM3pHErYPpI6zjyjczI3RRIBCDmIfuktsjShT3Sumgife6ExnQdytJeykn7h1qx0M 8pIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bSgMTnVj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k11si2862259pfa.163.2019.04.18.11.18.23; Thu, 18 Apr 2019 11:18:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bSgMTnVj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403981AbfDRSL6 (ORCPT + 99 others); Thu, 18 Apr 2019 14:11:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:44246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403960AbfDRSL4 (ORCPT ); Thu, 18 Apr 2019 14:11:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4D1F5206B6; Thu, 18 Apr 2019 18:11:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555611115; bh=Ncp2/h1kQzdBhWbJQxxcy4It+rI93OTMLtf1GZTw62A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bSgMTnVjz0Y9DCSv61MJEDurnqIDv+GBdyladsngnKwcAwrnut3vUivCTffuCL9SE DyykpKKWuOifIGuJ967mkY4jsliRAE1E6azRZjD1rOUlJZD1s5rJfHhjDp65DghK7z SNhhwhUITHBqJFtIMqNHNmHPHYETfhOPue1uFUtI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Hannes Reinecke , "Ewan D. Milne" , Johannes Thumshirn , Bart Van Assche , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.0 31/93] scsi: core: Also call destroy_rcu_head() for passthrough requests Date: Thu, 18 Apr 2019 19:57:09 +0200 Message-Id: <20190418160440.135727816@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190418160436.781762249@linuxfoundation.org> References: <20190418160436.781762249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit db983f6eef57a9d78af79bc32389b7e60eb3c47d ] cmd->rcu is initialized by scsi_initialize_rq(). For passthrough requests, blk_get_request() calls scsi_initialize_rq(). For filesystem requests, scsi_init_command() calls scsi_initialize_rq(). Make sure that destroy_rcu_head() is called for passthrough requests. Cc: Christoph Hellwig Cc: Hannes Reinecke Cc: Ewan D. Milne Cc: Johannes Thumshirn Reported-by: Ewan D. Milne Signed-off-by: Bart Van Assche Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/scsi_lib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 5a6e8e12701a..655ad26106e4 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -598,9 +598,16 @@ static bool scsi_end_request(struct request *req, blk_status_t error, if (!blk_rq_is_scsi(req)) { WARN_ON_ONCE(!(cmd->flags & SCMD_INITIALIZED)); cmd->flags &= ~SCMD_INITIALIZED; - destroy_rcu_head(&cmd->rcu); } + /* + * Calling rcu_barrier() is not necessary here because the + * SCSI error handler guarantees that the function called by + * call_rcu() has been called before scsi_end_request() is + * called. + */ + destroy_rcu_head(&cmd->rcu); + /* * In the MQ case the command gets freed by __blk_mq_end_request, * so we have to do all cleanup that depends on it earlier. -- 2.19.1