Re: [PATCH 1/3] cdev: Finish the cdev api with queued mode support

From: Logan Gunthorpe
Date: Wed Jan 20 2021 - 15:08:36 EST





On 2021-01-20 12:38 p.m., Dan Williams wrote:
> ...common reference count handling scenarios were addressed, but the
> shutdown-synchronization problem was only mentioned as something driver
> developers need to be aware in the following note:
>
> NOTE: This guarantees that associated sysfs callbacks are not running
> or runnable, however any cdevs already open will remain and their fops
> will still be callable even after this function returns.
>
> Remove that responsibility from driver developers with the concept of a
> 'queued' mode for cdevs.

I find the queued name confusing. What's being queued?

> +static const struct file_operations cdev_queued_fops = {
> + .owner = THIS_MODULE,
> + .open = cdev_queued_open,
> + .unlocked_ioctl = cdev_queued_ioctl,
> + .compat_ioctl = compat_ptr_ioctl,
> + .llseek = noop_llseek,
> +};

Why do we only protect these fops? I'd find it a bit confusing to have
ioctl protected from use after del, but not write/read/etc.

Logan