[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110824204533.GA19618@kroah.com>
Date: Wed, 24 Aug 2011 13:45:33 -0700
From: Greg KH <greg@...ah.com>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Hans de Goede <hdegoede@...hat.com>,
USB list <linux-usb@...r.kernel.org>,
Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: RFC: Add USBDEVFS_TRY_DISCONNECT ioctl
On Wed, Aug 24, 2011 at 04:32:31PM -0400, Alan Stern wrote:
> Okay, here's a sample patch. Actually it's three patches, listed one
> after another, but people can apply it like a single patch.
>
> 1. Introduce the USBDEVFS_TRY_DISCONNECT ioctl and the check_busy
> callback it uses. Implement the callback in the usbfs driver;
> this gives a way for programs to unbind kernel drivers without
> unbinding other userspace drivers.
>
> 2. Implement device-file reference tracking in the SCSI layer,
> and the device_open and device_close callbacks it uses.
Does this handle if the filesystem is being created or fscked, as it's
not mounted at that time.
> @@ -1647,9 +1653,16 @@ static int proc_ioctl(struct dev_state *
> else switch (ctl->ioctl_code) {
>
> /* disconnect kernel driver from interface */
> + case USBDEVFS_TRY_DISCONNECT:
> case USBDEVFS_DISCONNECT:
> if (intf->dev.driver) {
> driver = to_usb_driver(intf->dev.driver);
> + if (ctl->ioctl_code == USBDEVFS_TRY_DISCONNECT &&
> + driver->check_busy) {
> + retval = driver->check_busy(intf);
> + if (retval)
> + break;
> + }
I don't like the fact that if a driver doesn't contain check_busy() then
it will automatically fall back to looking like it was a DISCONNECT
call, which could give userspace a false sense of "everything was fine"
when trying this out.
Why not fail if that callback is not present?
I can't comment on the scsi layer, but what about devices that don't use
scsi? Like "raw" block drivers?
thanks,
greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists