[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48B6E69B.1090800@kernel.org>
Date: Thu, 28 Aug 2008 19:55:39 +0200
From: Tejun Heo <tj@...nel.org>
To: Greg KH <greg@...ah.com>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RESEND] char_dev: add cdev->release() and convert cdev_alloc()
to use it
Greg KH wrote:
>> The problem is not the device to talk to CUSE (/dev/cuse as in
>> /dev/fuse), for which module refcount and device refcount match fine.
>> But the whole point of CUSE is allowing CUSE clients to create arbitrary
>> character devices, so in addition to /dev/cuse which clients use to talk
>> to CUSE, CUSE hosts character devices for its clients and they come and
>> go dynamically and thus requires proper lifetime management.
>
> That's fine, it's just like a USB device that uses a cdev, right? Or a
> PCI device, or any other type of device that can come and go independant
> of the cdev or module lifespan.
>
> So, you tie the cdev lifespan to the module lifespan with the
> MODULE_OWNER in the file operations. As the cuse.ko module will own the
> cdev, it can handle that reference, and it can not be removed as long as
> userspace has the cdev open, right?
>
> It really isn't any different from any other type of removable device
> (i.e. any type of device...)
Ah.. right, but taking cdev refcount out of the picture requires adding
'severing' operation on cdev f_ops, which certainly is doable but isn't
it just cleaner to make cdev follow the usual lifetime management rules?
An object which is referenced counted requires ->release if it's gonna
be used in any non-simplistic way.
Thanks.
--
tejun
--
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