]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
cxlflash: Simplify attach path error cleanup
authorMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Fri, 4 Mar 2016 21:55:17 +0000 (15:55 -0600)
committerKamal Mostafa <kamal@canonical.com>
Fri, 10 Jun 2016 13:32:25 +0000 (06:32 -0700)
commit40d29e6a7d0208632a76832d5a8bfa625bc10f00
tree7a43ad15b42365a573abf7ef4f648c83a0d00a32
parent0b4ee654bd29a6591158002addc70214d4d4c6c5
cxlflash: Simplify attach path error cleanup

BugLink: http://bugs.launchpad.net/bugs/1588468
The cxlflash_disk_attach() routine currently uses a cascading error
gate strategy for its error cleanup path. While this strategy is
commonly used to handle cleanup scenarios, it is too restrictive when
function callouts need to be restructured. Problems range from
inserting error path bugs in previously 'good' code to the cleanup
path imposing design changes to how the normal path is structured.
A less restrictive approach is needed to support ordering changes
that come about when operating in different environments.

To overcome this restriction, the error cleanup path is modified to
have a single entrypoint and use conditional logic to cleanup where
necessary. Entities that require multiple cleanup steps must be
carefully vetted to ensure their APIs support state. In cases where
they do not (none as of this commit) additional local variables can
be used to maintain state on their behalf.

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 8a96b52af58721caf4f7496d0737e8ec6b63c86e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
drivers/scsi/cxlflash/superpipe.c