• Mike Snitzer's avatar
    dm mpath: add retain_attached_hw_handler feature · a58a935d
    Mike Snitzer authored
    A SCSI device handler might get attached to a device during the
    initial device scan.  We do not necessarily want to override
    this when loading a multipath table, so this patch adds a new
    multipath feature argument "retain_attached_hw_handler".
    
    During SCSI device scan all loaded SCSI device handlers will be
    consulted for a match (via scsi_dh's provided .match).  If a match is
    found that device handler will be attached.  We need a way to have
    userspace multipathd's provided 'hw_handler' not override the already
    attached hardware handler.
    
    When specifying the new feature 'retain_attached_hw_handler' multipath
    will use the currently attached hardware handler instead of trying to
    attach the one specified during table load.  If no hardware handler is
    attached the specified hardware handler will still be used.
    
    Leverages scsi_dh_attach's ability to increment the scsi_dh's reference
    count if the same scsi_dh name is provided when attaching - currently
    attached scsi_dh name is determined with scsi_dh_attached_handler_name.
    
    Depends upon commit 7e8a74b1
    ("[SCSI] scsi_dh: add scsi_dh_attached_handler_name").
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    Tested-by: default avatarBabu Moger <babu.moger@netapp.com>
    Reviewed-by: default avatarChandra Seetharaman <sekharan@us.ibm.com>
    Acked-by: default avatarHannes Reinecke <hare@suse.de>
    Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
    a58a935d
dm-mpath.c 40.7 KB