Skip to content
  • John Snow's avatar
    e8a40bf7
    blockjob: add .clean property · e8a40bf7
    John Snow authored
    
    
    Cleaning up after we have deferred to the main thread but before the
    transaction has converged can be dangerous and result in deadlocks
    if the job cleanup invokes any BH polling loops.
    
    A job may attempt to begin cleaning up, but may induce another job to
    enter its cleanup routine. The second job, part of our same transaction,
    will block waiting for the first job to finish, so neither job may now
    make progress.
    
    To rectify this, allow jobs to register a cleanup operation that will
    always run regardless of if the job was in a transaction or not, and
    if the transaction job group completed successfully or not.
    
    Move sensitive cleanup to this callback instead which is guaranteed to
    be run only after the transaction has converged, which removes sensitive
    timing constraints from said cleanup.
    
    Furthermore, in future patches these cleanup operations will be performed
    regardless of whether or not we actually started the job. Therefore,
    cleanup callbacks should essentially confine themselves to undoing create
    operations, e.g. setup actions taken in what is now backup_start.
    
    Reported-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
    Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-id: 1478587839-9834-3-git-send-email-jsnow@redhat.com
    Signed-off-by: default avatarJeff Cody <jcody@redhat.com>
    e8a40bf7
    blockjob: add .clean property
    John Snow authored
    
    
    Cleaning up after we have deferred to the main thread but before the
    transaction has converged can be dangerous and result in deadlocks
    if the job cleanup invokes any BH polling loops.
    
    A job may attempt to begin cleaning up, but may induce another job to
    enter its cleanup routine. The second job, part of our same transaction,
    will block waiting for the first job to finish, so neither job may now
    make progress.
    
    To rectify this, allow jobs to register a cleanup operation that will
    always run regardless of if the job was in a transaction or not, and
    if the transaction job group completed successfully or not.
    
    Move sensitive cleanup to this callback instead which is guaranteed to
    be run only after the transaction has converged, which removes sensitive
    timing constraints from said cleanup.
    
    Furthermore, in future patches these cleanup operations will be performed
    regardless of whether or not we actually started the job. Therefore,
    cleanup callbacks should essentially confine themselves to undoing create
    operations, e.g. setup actions taken in what is now backup_start.
    
    Reported-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
    Signed-off-by: default avatarJohn Snow <jsnow@redhat.com>
    Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
    Message-id: 1478587839-9834-3-git-send-email-jsnow@redhat.com
    Signed-off-by: default avatarJeff Cody <jcody@redhat.com>
Loading