ceph/ceph — pull request #1411 by jdurgin (2014-03-10 06:59:16+00:00)
Title: dumpling backport of watchers check for rbd_remove()

Check for watchers before trimming image data to try to avoid getting into
the following situation:

- user does 'rbd rm' on a mapped image with an fs mounted from it
- 'rbd rm' trims (removes) all image data, only header is left
- 'rbd rm' tries to remove a header and fails because krbd has a
watcher registered on the header
- at this point image cannot be unmapped because of the mounted fs
- fs cannot be unmounted because all its data and metadata is gone

Unfortunately, this fix doesn't make it impossible to happen (the required
atomicity isn't there), but it's a big improvement over the status quo.

Fixes: http://tracker.ceph.com/issues/7076

Reviewed-by: Josh Durgin Signed-off-by: Ilya
Dryomov
(cherry picked from commit 0a553cfa81b06e75585ab3c39927e307ec0f4cb6)