Re: [PATCH v2] I/O errors for ALUA state transitions

Martin Wilck
2024-05-07T09:10:55Z

On Mon, 2024-05-06 at 07:54 +0200, Christoph Hellwig wrote:
> > -static enum scsi_disposition alua_check_sense(struct scsi_device
> > *sdev,
> > -       struct
> > scsi_sense_hdr *sense_hdr)
> > +static enum scsi_disposition alua_handle_state_transition(struct
> > scsi_device *sdev)
> >  {
> >   struct alua_dh_data *h = sdev->handler_data;
> >   struct alua_port_group *pg;
> >
> > + /*
> > + * LUN Not Accessible - ALUA state transition
> > + */
> > + rcu_read_lock();
> > + pg = rcu_dereference(h->pg);
> > + if (pg)
> > + pg->state = SCSI_ACCESS_STATE_TRANSITIONING;
> > + rcu_read_unlock();
> > + alua_check(sdev, false);
> > + return NEEDS_RETRY;
>
> This always returns NEEDS_RETRY, so you can drop the return value
> entirely and handle this in the callers.
>

I liked being able to write "return alua_handle_state_transition(...)"
in the caller. But np, I'll change it.

Martin