• Alexander Viro's avatar
    [PATCH] partition handling locking cleanups · 81d4c00c
    Alexander Viro authored
    Horrors with open/reread_partition exclusion are starting to get fixed.
    
    It's not the final variant, but at least we are getting the logics into
    one place; switch to final variant will happen once we get per-disk
    analog of gendisks.  New fields - ->bd_part_sem and ->bd_part_count.
    
    The latter counts the amount of opened partitions.  The former protects
    said count _and_ is held while we are rereading partition tables.
    Helpers - dev_part_lock()/dev_part_unlock() (currently taking kdev_t; that
    will change pretty soon).  No more ->open() and ->release() for partitions,
    all that logics went to generic code.  Lock hierachy is currently messy:
    
      ->bd_sem for partitions -> ->bd_part_sem -> ->bd_sem for entire disks
    
    Ugly, but that'll go away and to get the final variant of locking right
    now would take _really_ big patch - with a lot of steps glued together.
    The damn thing is large as it is...
    81d4c00c
pd.c 27.1 KB