Skip to content

librbd: async version of metadata_set/remove - #37121

Merged
dillaman merged 1 commit into
ceph:masterfrom
Songweibin:wip-rbd-metadata
Sep 22, 2020
Merged

dillaman merged 1 commit into
ceph:masterfrom
Songweibin:wip-rbd-metadata

Conversation

@Songweibin

Copy link
Copy Markdown
Contributor

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.

Step 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)
>>>
  1. 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 [email protected]

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@Songweibin

Copy link
Copy Markdown
Contributor Author

@dillaman Please help to have a look, thank you.

Comment thread src/librbd/WatchNotifyTypes.h Resolved
@Songweibin

Copy link
Copy Markdown
Contributor Author

@dillaman updated, please have a look. thx.

Comment thread src/librbd/WatchNotifyTypes.h Resolved
Comment thread src/librbd/WatchNotifyTypes.h Resolved
Comment thread src/librbd/WatchNotifyTypes.h Resolved
Comment thread src/librbd/Operations.cc Resolved
Comment thread src/librbd/Operations.cc Resolved
@Songweibin
Songweibin force-pushed the wip-rbd-metadata branch 2 times, most recently from 1c98178 to e2bc58f Compare September 19, 2020 06:33
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 <[email protected]>

@dillaman dillaman left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Songweibin

Copy link
Copy Markdown
Contributor Author

Hi, @dillaman, thanks for your review.
I have another question:
Like rbd qos may need to set multiple options, how about adding an API (ie metadata_set2/remove2) that supports batch setup or remove metadata? Do you have any suggestions or ideas? Thank you.

@dillaman

Copy link
Copy Markdown

Like rbd qos may need to set multiple options, how about adding an API (ie metadata_set2/remove2) that supports batch setup or remove metadata? Do you have any suggestions or ideas? Thank you.

Does it really matter that it takes more than one op? How would you set multiple key/value pairs from the CLI?

@Songweibin
Songweibin deleted the wip-rbd-metadata branch September 24, 2020 12:35
@Songweibin

Copy link
Copy Markdown
Contributor Author

Like rbd qos may need to set multiple options, how about adding an API (ie metadata_set2/remove2) that supports batch setup or remove metadata? Do you have any suggestions or ideas? Thank you.

Does it really matter that it takes more than one op? How would you set multiple key/value pairs from the CLI?

Indeed, setting up multiple key/value pairs from the CLI is a bit complicated, perhaps like this? — rbd image-meta set pool/image k1=val1 k2=val2 k3=val3

Comment thread src/librbd/Operations.cc
}
r = invoke_async_request("metadata_set",
exclusive_lock::OPERATION_REQUEST_TYPE_GENERAL,
true,

@Songweibin Songweibin Sep 24, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dillaman Oops, I think there is a mistake here, it should be false? So the python API could not permit to update metadata via snapshot.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it was restricted before (was it?) since the metadata applies to both snapshots and the image HEAD revision.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dillaman Yeah, it was.
We noticed that if the journaling feature is enabled, the event that update metadata is recorded.
However, the event is not recorded if updated via snapshot. Is this going to be a problem?
Thank you.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok. Can you open a new PR to address this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx.
New PR: #37417

@dillaman

Copy link
Copy Markdown

Indeed, setting up multiple key/value pairs from the CLI is a bit complicated, perhaps like this? — rbd image-meta set pool/image k1=val1 k2=val2 k3=val3

I personally don't see the value of adding a new API to support multiple key/value metadata pairs when you can continue to just set them individually. If there is a bug in QoS where it acts badly for the short period of time when you change the QoS settings, that should be fixed regardless.

Songweibin added a commit to Songweibin/ceph that referenced this pull request Sep 26, 2020
jschmid1 pushed a commit to ceph/ceph-ci that referenced this pull request Sep 29, 2020
jschmid1 pushed a commit to ceph/ceph-ci that referenced this pull request Sep 29, 2020
Songweibin added a commit to ceph/ceph-ci that referenced this pull request Nov 28, 2020
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 <[email protected]>
(cherry picked from commit 7bc663d)
(cherry picked from commit ceph/ceph#37121
                       and ceph/ceph#37417)
Signed-off-by: songweibin <[email protected]>

Change-Id: I82c615cb65c3a604f7ef955d83a011717fc02413
Songweibin added a commit to ceph/ceph-ci that referenced this pull request Apr 22, 2021
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 <[email protected]>
(cherry picked from commit 7bc663d)
(cherry picked from commit ceph/ceph#37121
                       and ceph/ceph#37417)
Signed-off-by: songweibin <[email protected]>

Change-Id: I82c615cb65c3a604f7ef955d83a011717fc02413
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants