lkml.org 
[lkml]   [2009]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectHow to tell when a gendisk has been freed?
Hi,

Im writing a block device that does asynchronous mirroring. The user
creates a device by giving a local device and
connecting to a remote device (on the net), mirroring writes to both.

When the user is done with the device i would like to give him the
option of deleting the device. To do that, i first
stop taking requests (i disallow opens by looking at a variable i
allocated for that device (a custom struct)), next
wait until there are no more active make_requests, and finally i free
everything... However, theres a problem
with open - when i free the device, the open dereferences a variable i
allocated for that device, but i have already
freed the device.

The only safe way to free the device is when i know for sure no more
opens or make_requests can be called...
To do that i have to know when the gendisk is gone (even if i
del_gendisk it, and wait until the opener counter drops to
zero, i cant be sure that another open isnt being executed at the moment)...
However, i didnt see any way to do it, so i was wondering what is the
right way to do it?

Thanks,
Tomer



\
 
 \ /
  Last update: 2009-10-02 15:57    [W:0.280 / U:1.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site