]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
rbd: check for watchers before trimming an image on 'rbd rm'
authorIlya Dryomov <ilya.dryomov@inktank.com>
Wed, 29 Jan 2014 14:12:01 +0000 (16:12 +0200)
committerIlya Dryomov <ilya.dryomov@inktank.com>
Thu, 30 Jan 2014 12:47:45 +0000 (14:47 +0200)
commit0a553cfa81b06e75585ab3c39927e307ec0f4cb6
tree7c40a62b278dd270a33aa9da974e6221071d3ad9
parentdcbe872e06a0c5962f380bc038994e0db829d49f
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
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
src/librbd/internal.cc
src/test/pybind/test_rbd.py