[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20091002154447.62823bfv3qntxrrj@webmail.tau.ac.il>
Date: Fri, 02 Oct 2009 15:44:47 +0200
From: tomerma1@...t.tau.ac.il
To: linux-kernel@...r.kernel.org
Subject: How 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
--
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