]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
rbd: remove snapshots on error in rbd_add()
authorAlex Elder <elder@inktank.com>
Fri, 26 Oct 2012 04:34:40 +0000 (23:34 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jan 2013 16:46:49 +0000 (08:46 -0800)
commita35420155f46065b5fded0a7478fff003be4e872
tree3de888a256f1d90120051525291f7b1d908a360a
parentfefc034ae0af85c0b18fe209a1b6803d51880556
rbd: remove snapshots on error in rbd_add()

(cherry picked from commit 41f38c2b2f8b66b176a0e548ef06294343a7bfa2)

If rbd_dev_snaps_update() has ever been called for an rbd device
structure there could be snapshot structures on its snaps list.
In rbd_add(), this function is called but a subsequent error
path neglected to clean up any of these snapshots.

Add a call to rbd_remove_all_snaps() in the appropriate spot to
remedy this.  Change a couple of error labels to be a little
clearer while there.

Drop the leading underscores from the function name; there's nothing
special about that function that they might signify.  As suggested
in review, the leading underscores in __rbd_remove_snap_dev() have
been removed as well.

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/rbd.c