Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1570119

Re: [RFC PATCH] scsi, block: fix duplicate bdi name registration crashes

From Dan Williams <dan.j.williams@intel.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH] scsi, block: fix duplicate bdi name registration crashes
Date 2017-01-30 22:00 +0100
Message-ID <t5rdo-bx-13@gated-at.bofh.it> (permalink)
References <t4PUt-2M7-1@gated-at.bofh.it> <t5jfQ-3VK-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jan 30, 2017 at 4:24 AM, Christoph Hellwig <hch@lst.de> wrote:
> Hi Dan,
>
> this looks mostly fine to me.  A few code comments below, but except
> for this there is another issue with it:  We still have drivers
> that share a single request_queue for multiple gendisks, so I wonder
>
> Also I think you probably want one patch for the block framework,
> and one to switch SCSI over to it.
>
>> +struct disk_devt {
>> +     struct kref kref;
>> +     void (*release)(struct kref *);
>> +};
>> +
>> +static inline void put_disk_devt(struct disk_devt *disk_devt)
>> +{
>> +     if (disk_devt)
>> +             kref_put(&disk_devt->kref, disk_devt->release);
>> +}
>> +
>> +static inline void get_disk_devt(struct disk_devt *disk_devt)
>> +{
>> +     if (disk_devt)
>> +             kref_get(&disk_devt->kref);
>> +}
>
> Given that we have a user-supplied release callack I'd much rather get
> rid of the kref here, use a normal atomic_t and pass the disk_devt
> structure to the release callback then a kref.

I'm missing something... kref is just:

struct kref {
        atomic_t refcount;
};

...so what do we gain by open coding kref_get() and kref_put()?

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH] scsi, block: fix duplicate bdi name registration crashes Dan Williams <dan.j.williams@intel.com> - 2017-01-29 06:10 +0100
  Re: [RFC PATCH] scsi, block: fix duplicate bdi name registration  crashes Hannes Reinecke <hare@suse.de> - 2017-01-30 08:10 +0100
    Re: [RFC PATCH] scsi, block: fix duplicate bdi name registration  crashes Omar Sandoval <osandov@osandov.com> - 2017-01-30 08:40 +0100
      Re: [RFC PATCH] scsi, block: fix duplicate bdi name registration crashes Dan Williams <dan.j.williams@intel.com> - 2017-01-30 08:50 +0100
  Re: [RFC PATCH] scsi, block: fix duplicate bdi name registration         crashes Christoph Hellwig <hch@lst.de> - 2017-01-30 13:30 +0100
    Re: [RFC PATCH] scsi, block: fix duplicate bdi name registration crashes Dan Williams <dan.j.williams@intel.com> - 2017-01-30 22:00 +0100
      Re: [RFC PATCH] scsi, block: fix duplicate bdi name registration         crashes Christoph Hellwig <hch@lst.de> - 2017-02-01 09:10 +0100
    Re: [RFC PATCH] scsi, block: fix duplicate bdi name registration crashes Dan Williams <dan.j.williams@intel.com> - 2017-01-30 23:10 +0100
      Re: [RFC PATCH] scsi, block: fix duplicate bdi name registration         crashes Christoph Hellwig <hch@lst.de> - 2017-02-01 09:10 +0100

csiph-web