• Alexander Viro's avatar
    [PATCH] md.c · 62da9e6b
    Alexander Viro authored
    AAAARGH.  OK, I've got it to work with the current tree, but...  I don't
    like the lifetime rules - both old and new ones.  Summary:
    
    	* we create a gendisk upon attempt to open or upon successful
    	  attempt to run (which _can_ happen without open).
    	* we never remove them until the rmmod (or ever).
    	* mddev is held by gendisk.
    
    The source of trouble is our API - ioctls on possibly unconfigured
    devices when no IO is possible, potentially setting up this (or another,
    or many other) devices.  I _think_ we can get the old rules (mddev
    exists when somebody holds it open or when it runs or when somebody is
    looking at it funny), but the way I see will take more messing with
    driverfs objects than I want right now. 
    
    Notice that current API is, was and will be ripe with interesting races
    - it really ought to be replaced with something saner, but that would
    take serious modifications of userland tools.  I'll talk with Neil about
    possible solution, this patch just gets it back to life. 
    62da9e6b
md.c 79.6 KB