linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Hannes Reinecke <hare@suse.de>,
	Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>,
	Hillf Danton <hdanton@sina.com>,
	Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>,
	linux-block <linux-block@vger.kernel.org>
Subject: Re: [PATCH v3] block: genhd: don't call probe function with major_names_lock held
Date: Sun, 15 Aug 2021 11:19:24 +0200	[thread overview]
Message-ID: <YRjcHJE0qEIIJ9gA@kroah.com> (raw)
In-Reply-To: <a3f43d54-8d10-3272-1fbb-1193d9f1b6dd@i-love.sakura.ne.jp>

On Sun, Aug 15, 2021 at 04:49:55PM +0900, Tetsuo Handa wrote:
> On 2021/08/15 16:06, Greg KH wrote:
> > On Sun, Aug 15, 2021 at 03:52:45PM +0900, Tetsuo Handa wrote:
> >> --- a/include/linux/genhd.h
> >> +++ b/include/linux/genhd.h
> >> @@ -303,9 +303,9 @@ struct gendisk *__blk_alloc_disk(int node);
> >>  void blk_cleanup_disk(struct gendisk *disk);
> >>  
> >>  int __register_blkdev(unsigned int major, const char *name,
> >> -		void (*probe)(dev_t devt));
> >> +		      void (*probe)(dev_t devt), struct module *owner);
> >>  #define register_blkdev(major, name) \
> >> -	__register_blkdev(major, name, NULL)
> >> +	__register_blkdev(major, name, NULL, NULL)
> >>  void unregister_blkdev(unsigned int major, const char *name);
> > 
> > Do not force modules to put their own THIS_MODULE macro as a parameter,
> > put it in the .h file so that it happens automagically, much like the
> > usb_register() define in include/linux/usb.h is created.
> 
> Sure. We can do like below.
> 
> diff --git a/include/linux/genhd.h b/include/linux/genhd.h
> index 13b34177cc85..70f00641fa11 100644
> --- a/include/linux/genhd.h
> +++ b/include/linux/genhd.h
> @@ -302,10 +302,12 @@ extern void put_disk(struct gendisk *disk);
>  struct gendisk *__blk_alloc_disk(int node);
>  void blk_cleanup_disk(struct gendisk *disk);
>  
> -int __register_blkdev(unsigned int major, const char *name,
> -		void (*probe)(dev_t devt));
> +int ____register_blkdev(unsigned int major, const char *name,
> +			void (*probe)(dev_t devt), struct module *owner);
> +#define __register_blkdev(major, name, probe) \
> +	____register_blkdev(major, name, probe, THIS_MODULE)
>  #define register_blkdev(major, name) \
> -	__register_blkdev(major, name, NULL)
> +	____register_blkdev(major, name, NULL, NULL)

Why stop at 4 _ characters?

{sigh}

I think you need a new naming scheme here...

> > 
> > If you do that, you can probably get rid of the __register_blkdev()
> > direct calls as well...
> 
> I assume "automagically" implies "do not patch individual unregister_blkdev() /
> __register_blkdev() callers". But "removing __register_blkdev() direct calls"
> requires "patching individual __register_blkdev() callers". I didn't catch
> what you suggested here.

Yes, that is a different thing, sorry for the confusion.

> Anyway, since this patch should be backported to 5.11+ kernels, lines changed
> should be kept minimal. We can do whatever remapping after this patch.

Don't worry about backports, fix it properly first.

thanks,

greg k-h

  reply	other threads:[~2021-08-15  9:19 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-19  1:05 [PATCH v2] block: genhd: don't call probe function with major_names_lock held Tetsuo Handa
2021-06-19  3:24 ` kernel test robot
2021-06-19  6:14 ` kernel test robot
2021-06-19  6:44 ` Greg KH
2021-06-19  8:47   ` Tetsuo Handa
     [not found]   ` <20210620024403.820-1-hdanton@sina.com>
2021-06-20 13:54     ` Tetsuo Handa
2021-06-21  8:54       ` Greg KH
2021-06-21  6:18 ` Christoph Hellwig
2021-08-15  6:52 ` [PATCH v3] " Tetsuo Handa
2021-08-15  7:06   ` Greg KH
2021-08-15  7:49     ` Tetsuo Handa
2021-08-15  9:19       ` Greg KH [this message]
2021-08-18 11:07         ` [PATCH v4] " Tetsuo Handa
2021-08-18 13:27           ` Greg KH
2021-08-18 14:44             ` Tetsuo Handa
2021-08-18 15:28               ` Greg KH
2021-08-21  6:12                 ` [PATCH v5] " Tetsuo Handa
2021-08-18 13:47           ` [PATCH v4] " Christoph Hellwig
2021-08-18 14:34             ` Tetsuo Handa
2021-08-18 14:41               ` Greg KH
2021-08-18 14:51                 ` Tetsuo Handa
2021-08-19  9:16                   ` Christoph Hellwig
2021-08-19 14:47                     ` Tetsuo Handa
2021-08-19  9:19               ` Christoph Hellwig
2021-08-19 14:23                 ` Tetsuo Handa
2021-08-19 15:10                   ` Greg KH
2021-08-16  7:33   ` [PATCH v3] " Christoph Hellwig
2021-08-16 14:44     ` Tetsuo Handa
     [not found]     ` <20210817081045.3609-1-hdanton@sina.com>
2021-08-17 10:18       ` Tetsuo Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YRjcHJE0qEIIJ9gA@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=axboe@kernel.dk \
    --cc=chaitanya.kulkarni@wdc.com \
    --cc=desmondcheongzx@gmail.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=hdanton@sina.com \
    --cc=linux-block@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).