]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
rbd: check for watchers before trimming an image on 'rbd rm' 1411/head
authorIlya Dryomov <ilya.dryomov@inktank.com>
Wed, 29 Jan 2014 14:12:01 +0000 (16:12 +0200)
committerJosh Durgin <josh.durgin@inktank.com>
Mon, 10 Mar 2014 05:53:43 +0000 (22:53 -0700)
commitcd7986caf6baee5f9d6498b113b3382e66dd6f77
treef63551370729a29e24b9beb1cfd6d4e5e41720f8
parenta931aaa6cc104d63b20c0cbe9e3af4006c3abfaf
rbd: check for watchers before trimming an image on 'rbd rm'

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 <josh.durgin@inktank.com>
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
(cherry picked from commit 0a553cfa81b06e75585ab3c39927e307ec0f4cb6)
src/librbd/internal.cc
src/test/pybind/test_rbd.py