From patchwork Mon Mar 18 16:29:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10858013 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A259D14DE for ; Mon, 18 Mar 2019 16:29:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8936C2847E for ; Mon, 18 Mar 2019 16:29:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D0E7284DA; Mon, 18 Mar 2019 16:29:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E53112847E for ; Mon, 18 Mar 2019 16:29:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727111AbfCRQ3f (ORCPT ); Mon, 18 Mar 2019 12:29:35 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:39912 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726922AbfCRQ3f (ORCPT ); Mon, 18 Mar 2019 12:29:35 -0400 Received: by mail-pf1-f193.google.com with SMTP id i17so1841972pfo.6 for ; Mon, 18 Mar 2019 09:29:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vv26ZkR2jeWiGY8jYeelfPBc76E1hcXBxZuhWbSGb6A=; b=NyCLFjvQKqw7Qc5/6c83sB8v8ETcIAgNbm+m79YeuF6IctZYK8cCySFghWVE648JG7 LkhLhczj71oi6Adf2u+9idoysUKk64NUQg1dmsIpRUlDL5EUMI2Y505dWj2R3vgTIMyG zxyzmcr/43YLmiggf12WbHp1sn95ftoJxuREcrHWwMLIplwO7hbMws6FvzkW2HavMWFZ 6Xh2ygf4xE+JQFUto/NoKrkC4MgMUmt0tsGKDbG65G1d3hTpQyqyRTR3kqDMvIYIKMDO VEpTOs9b4kCKswFsEHHtI7iUqTdnbAlDmV2QbE04U5ODOyy3SpHC2MH1gMcIPtKFO+Lu z42w== X-Gm-Message-State: APjAAAWDeZAhFu+rCWX3d2/mIWDpjfKfiEB2s/VKOzXpAKsnQYIH+Iwd Lujvdo6a6lZDeJfYAA2rIqc= X-Google-Smtp-Source: APXvYqwJcUI87gb9HMGcehCzHA82SnR19x5nPezpvn8fKhM2ox31tafINBAm3fpBWrlOeF/sczxQgg== X-Received: by 2002:a63:4815:: with SMTP id v21mr18505464pga.412.1552926574399; Mon, 18 Mar 2019 09:29:34 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:203:5cdc:422c:7b28:ebb5]) by smtp.gmail.com with ESMTPSA id k189sm13875719pgk.21.2019.03.18.09.29.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Mar 2019 09:29:33 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" , "James E . J . Bottomley" Cc: linux-scsi@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Hannes Reinecke , "Ewan D . Milne" , Johannes Thumshirn Subject: [PATCH] Also call destroy_rcu_head() for passthrough requests Date: Mon, 18 Mar 2019 09:29:26 -0700 Message-Id: <20190318162926.50236-1-bvanassche@acm.org> X-Mailer: git-send-email 2.20.GIT MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 33e1a72d47fa..ed4314f8542e 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -585,9 +585,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.