From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752825AbdA3M2f (ORCPT ); Mon, 30 Jan 2017 07:28:35 -0500 Received: from verein.lst.de ([213.95.11.211]:49218 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751621AbdA3M20 (ORCPT ); Mon, 30 Jan 2017 07:28:26 -0500 Date: Mon, 30 Jan 2017 13:24:52 +0100 From: Christoph Hellwig To: Dan Williams Cc: martin.petersen@oracle.com, Jens Axboe , linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, James Bottomley , Bart Van Assche , Omar Sandoval , Christoph Hellwig Subject: Re: [RFC PATCH] scsi, block: fix duplicate bdi name registration crashes Message-ID: <20170130122452.GA9043@lst.de> References: <148566590827.1627.3631056985359212959.stgit@dwillia2-desk3.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <148566590827.1627.3631056985359212959.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.