Re: rework check_disk_change()

From
Hannes Reinecke <hare@suse.de>
Date
2020-09-04 09:23:20
Also in
linux-block, linux-fsdevel, linux-ide, linux-m68k, linux-scsi, lkml
Reply to
Douglas Gilbert, 2020-09-02
On 9/2/20 5:38 PM, Douglas Gilbert wrote:
On 2020-09-02 10:11 a.m., Christoph Hellwig wrote:
quoted
Hi Jens,

this series replaced the not very nice check_disk_change() function with
a new bdev_media_changed that avoids having the ->revalidate_disk call
at its end.  As a result ->revalidate_disk can be removed from a lot of
drivers.
For over 20 years the sg driver has been carrying this snippet that hangs
off the completion callback:

        if (driver_stat & DRIVER_SENSE) {
                 struct scsi_sense_hdr ssh;

                 if (scsi_normalize_sense(sbp, sense_len, &ssh)) {
                         if (!scsi_sense_is_deferred(&ssh)) {
                                 if (ssh.sense_key == UNIT_ATTENTION) {
                                         if (sdp->device->removable)
                                                 sdp->device->changed = 1;
                                 }
                         }
                 }
         }

Is it needed? The unit attention (UA) may not be associated with the
device changing. Shouldn't the SCSI mid-level monitor UAs if they
impact the state of a scsi_device object?
We do; check scsi_io_completion_action() in drivers/scsi/scsi_lib.c
So I don't think you'd need to keep it in sg.c.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Thread (45 messages) 45 messages, 6 authors, last reply 2020-09-08
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help