Received: by 10.192.165.148 with SMTP id m20csp54764imm; Fri, 20 Apr 2018 02:56:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+cujEP/fnwvJMHi7fNRGOS+/G37nAlgLwX9bVBViGB+0okyDoWt+IcwCuCRrobHzp2uSU4 X-Received: by 2002:a17:902:24c:: with SMTP id 70-v6mr9665091plc.384.1524218217848; Fri, 20 Apr 2018 02:56:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524218217; cv=none; d=google.com; s=arc-20160816; b=GPcJCoA871rnh2mEry1mCqB9v8H235ecnICmNjhYe1Xyhdo5+KjtovG2qIBX8kkWgF k/vHnJNQX+mQLbipzQpuSxM3aOTYXlsf8gw1BCaYEUPTgcv9U39PtfwGQw2St58qqom8 IjpJKddutJzVO0IjMoIGt40b4BiJiXkz7aOTKQwWTl+OJDOXoGa8715bpRej/mR77XQb TqFba8P9ufYnBJ2CF31HyOpQWGHsUrvJDDVlO8QP3jLr/7e9xf+5NsIi8ODB0AwsVi49 BLfOJgmL1s0vdxlpINe9Op7RCrbZFMrnJxrFiqC0PgWrzmuu6rf0dnjRLtBb36fQIyUU R5JQ== 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 :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature:arc-authentication-results; bh=V7KxE+7ZnD5aE8yGGvolcIWmz8HmSzsdlLjN1ZOH584=; b=vGKF0U6AwK3pDKJsQ8wUUxD3Eh0nLJ0AGbyUS6e3cEuAtuzPrzqTQy2jwVpXCjIMA6 gIiO/t12DyJZskA4BN1ulKvrQQnssxCbabuxxz2vGvzWRsvbSfKuMtsYAWyWkAbhloP+ kDVWCDd4WE+RWQEb2LEwjy44ttK6Ho7KernS5/GwSE1U48RplT9d1JVYgmihsZoluLf4 6GQCQWsss3aUKMlyCsrjTEwyCz2dSaXCLxlPSypRQO2h9GmG7Lt/ci+QiOaHpC/5O/LD IlybBHrWhzVNtaA/TmzGePiBDWHPijpbsOeaFcsN/0WTC171i73Ys2HFO0EQdr69TgZ8 pBew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@hansenpartnership.com header.s=20151216 header.b=ZsoUJ1SU; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si4916245pfm.198.2018.04.20.02.56.42; Fri, 20 Apr 2018 02:56:57 -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=fail header.i=@hansenpartnership.com header.s=20151216 header.b=ZsoUJ1SU; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hansenpartnership.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754398AbeDTJzd (ORCPT + 99 others); Fri, 20 Apr 2018 05:55:33 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:54726 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754263AbeDTJzc (ORCPT ); Fri, 20 Apr 2018 05:55:32 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 48D188EE293; Fri, 20 Apr 2018 02:55:31 -0700 (PDT) Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5Hzq02QRVEzM; Fri, 20 Apr 2018 02:55:31 -0700 (PDT) Received: from [172.39.101.249] (static-242-42-24-46.ipcom.comunitel.net [46.24.42.242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id CFCEC8EE0DC; Fri, 20 Apr 2018 02:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hansenpartnership.com; s=20151216; t=1524218130; bh=bt6V7gFHQe5OgrJc3ZxuVA0P/tsGxZsT8qZ5keArdRY=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ZsoUJ1SUqJJ0/P15b6kow3s/BczqC8rAc3/aPyZCBKT/gpMvJDPSHgtam0OlclIJW wuQ0DJf5vUQ72ksBVNLZlqzyUPNzq4HBjHJBRd4qLXr1qTDfonYyIuCwOOzo5WriO0 W5+BvfBarz1EB4rBjSPLPrtHejUlUs8YcqWYywNs= Message-ID: <1524218126.3321.6.camel@HansenPartnership.com> Subject: Re: [PATCH] bsg referencing bus driver module From: James Bottomley To: Anatoliy Glagolev , linux-scsi@vger.kernel.org, linux-block@vger.kernel.org Cc: axboe@kernel.dk, fujita.tomonori@lab.ntt.co.jp, martin.petersen@oracle.com, jthumshirn@suse.de, hare@suse.com, bblock@linux.vnet.ibm.com, linux-kernel@vger.kernel.org Date: Fri, 20 Apr 2018 11:55:26 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-04-19 at 15:10 -0700, Anatoliy Glagolev wrote: > Updated: rebased on recent Linux, cc-ed maintainers per instructions > in MAINTAINERS file > > From df939b80d02bf37b21efaaef8ede86cfd39b0cb8 Mon Sep 17 00:00:00 > 2001 > From: Anatoliy Glagolev > Date: Thu, 19 Apr 2018 15:06:06 -0600 > Subject: [PATCH] bsg referencing parent module > > Fixing a bug when bsg layer holds the last reference to device > when the device's module has been unloaded. Upon dropping the > reference the device's release function may touch memory of > the unloaded module. > --- >  block/bsg-lib.c                  | 24 ++++++++++++++++++++++-- >  block/bsg.c                      | 29 ++++++++++++++++++++++++++--- >  drivers/scsi/scsi_transport_fc.c |  8 ++++++-- >  include/linux/bsg-lib.h          |  4 ++++ >  include/linux/bsg.h              |  5 +++++ >  5 files changed, 63 insertions(+), 7 deletions(-) > > diff --git a/block/bsg-lib.c b/block/bsg-lib.c > index fc2e5ff..90c28fd 100644 > --- a/block/bsg-lib.c > +++ b/block/bsg-lib.c > @@ -309,6 +309,25 @@ struct request_queue *bsg_setup_queue(struct > device *dev, const char *name, >   bsg_job_fn *job_fn, int dd_job_size, >   void (*release)(struct device *)) >  { > + return bsg_setup_queue_ex(dev, name, job_fn, dd_job_size, release, > + NULL); > +} > +EXPORT_SYMBOL_GPL(bsg_setup_queue); > + > +/** > + * bsg_setup_queue - Create and add the bsg hooks so we can receive > requests > + * @dev: device to attach bsg device to > + * @name: device to give bsg device > + * @job_fn: bsg job handler > + * @dd_job_size: size of LLD data needed for each job > + * @release: @dev release function > + * @dev_module: @dev's module > + */ > +struct request_queue *bsg_setup_queue_ex(struct device *dev, const > char *name, > + bsg_job_fn *job_fn, int dd_job_size, > + void (*release)(struct device *), > + struct module *dev_module) This patch isn't applyable because your mailer has changed all the tabs to spaces. I also think there's no need to do it this way. I think what we need is for fc_bsg_remove() to wait until the bsg queue is drained. It does look like the author thought this happened otherwise the code wouldn't have the note. If we fix it that way we can do the same thing in all the other transport classes that use bsg (which all have a similar issue). James