Re: [PATCH 10/17] scsi_dh_alua: Use separate alua_port_group structure

Christoph Hellwig
2015-05-11T12:32:37Z

On Mon, May 04, 2015 at 02:42:16PM +0200, Hannes Reinecke wrote:
> The port group needs to be a separate structure as several
> LUNs might belong to the same group.

The switch to on-stack sense data in alua_rtpg probably should be
a separate patch.

> -static int realloc_buffer(struct alua_dh_data *h, unsigned len)
> +static int realloc_buffer(struct alua_port_group *pg, unsigned len)
> {

Not directly related to this patch, but what's the reason to have
a buffer hang off the dh_data or now port group? Seems like a local
allocation in alua_rtpg would be more sensible.

> + spin_lock(&port_group_lock);
> + pg = kzalloc(sizeof(struct alua_port_group), GFP_ATOMIC);
> + if (!pg) {
> + sdev_printk(KERN_WARNING, sdev,
> + "%s: kzalloc port group failed\n",
> + ALUA_DH_NAME);
> + /* Temporary failure, bypass */
> + spin_unlock(&port_group_lock);
> + return SCSI_DH_DEV_TEMP_BUSY;
> + }

As bart mentioned it should be simply enough to move the allocation
and initialization outside the spinlock.