]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librbd: async version of metadata_set/remove 37121/head
authorsongweibin <song.weibin@zte.com.cn>
Sat, 12 Sep 2020 07:54:44 +0000 (15:54 +0800)
committersongweibin <song.weibin@zte.com.cn>
Mon, 21 Sep 2020 01:42:55 +0000 (09:42 +0800)
commit7bc663dbe379f4168b0eaa68163dd01036846250
treebf58b63109b4443d029035a9b78502a64621a3e8
parent7251caf7e11b52d3778eeb8fc060e86ab34a365a
librbd: async version of metadata_set/remove

In iSCSI scenario (via tcmu-runner), after a client has acquired exclusive
lock on an image, users will no longer be able to set metadata on the image.
This commit try to fix it by forward the request to the lock owner.

Steps to reproduce:

1. Client A:
```
>>> import rbd, rados;client=rados.Rados(conffile='');client.connect();ioctx=client.open_ioctx('rbd');rbd_inst=rbd.RBD();image=rbd.Image(ioctx, 'img1')
>>> from rbd import RBD_LOCK_MODE_EXCLUSIVE
>>> image.lock_acquire(RBD_LOCK_MODE_EXCLUSIVE)
>>>
```

2. Client B:
```
$ rbd image-meta set img1 conf_rbd_qos_iops_limit 10000
2020-09-12T15:19:58.325+0800 7f161affd700 -1 librbd::ManagedLock: 0x7f15f4001d48 handle_acquire_lock: failed to acquire exclusive lock:(30) Read-only file system
failed to set metadata conf_rbd_qos_iops_limit of image : (30) Read-only file system
rbd: setting metadata failed: (30) Read-only file system
$
```

Signed-off-by: songweibin <song.weibin@zte.com.cn>
src/librbd/ImageWatcher.cc
src/librbd/ImageWatcher.h
src/librbd/Operations.cc
src/librbd/WatchNotifyTypes.cc
src/librbd/WatchNotifyTypes.h