rbd: fix leak of format 2 snapshot context
When rbd_dev_v2_refresh() is called, the rbd device already has a
snapshot context associated with it. But that never gets freed,
the pointer just gets overwritten.
Fix this by dropping the rbd device's reference to the snapshot
context before overwriting the pointer.
Because ceph_put_snap_context() already handles for a null pointer
we don't need to check for that (for the probe case, where no
context has yet been assigned).
Signed-off-by: Alex Elder <firstname.lastname@example.org>
#2 Updated by Alex Elder almost 7 years ago
The following has been committed to the "testing-next"
branch of the ceph-client git repository. I am holding
off committing it to "testing" until after the Linux 3.10
merge window closes, as requested by Stephen Rothwell
(who does linux-next).
49ece554 rbd: fix leak of format 2 snapshot context
(Technically Josh didn't signal he reviewed this. I
pinged him, and will update this issue if he says
he has any problem with it.)