Re: [PATCH v3 0/5] block: skip media change event handling if unsupported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/27/19 7:51 AM, Martin Wilck wrote:
> The block layer currently can't distinguish between gendisk devices that
> don't support any media change events, and devices that do support them,
> but only for internal purposes. Therefore the check_events() function is
> called e.g. for ordinary non-removable SCSI disks. While these devices
> are not polled under normal conditions, the check_events function is
> called on certain synchronization points, in particular while the device
> is opened, closed, or probed.
> 
> Under unfavorable conditions this can lead to processes being stalled on
> a blocked queue: a close() schedules a work item for check_events()
> which gets blocked in the work queue, and subsequent open() tries to
> flush the workqueue. The flush then stalls too, as long as the the
> blocked work item can't finish.
> 
> In principle, the gendisk->events field would make it very easy for the
> block layer to check only for events actually supported by the device.
> Currently this is impossible, because there are lots of drivers which
> don't set gendisk->events although they implement the check_events()
> method.  This was introduced in commit 7c88a168da80 ("block: don't
> propagate unlisted DISK_EVENTs to userland") and follow-up patches
> because uevent generation by these drivers was found to possibly
> generate infinite event loops between kernel and user space. A side
> effect of these patches was that the distinction between such devices
> and devices supporting no events at all was lost.
> 
> This series implements a slightly different approach to event handling
> and uevent suppression. The drivers are changed to set the events field
> again.  Whether or not uevents should be generated is controlled by a
> separate flag bit, which is only set by the drivers that are known to
> generate proper uevents (sd and sr). Once this is done, devices that
> don't support any media change events can be clearly identified, and the
> whole events checking code path can be skipped. This simplifies handling
> of non-removable SCSI disks.
> 
> I have tested this with removable and non-removable SCSI disks, SCSI
> cdrom, and ide-cd.
> 
> This patch set targets the same problem as Hannes' late submission "sd:
> skip non-removable devices in sd_check_events()".

Applied for 5.2, thanks.

-- 
Jens Axboe




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux