Bug #63800
openRBD wrongfully doesn't allow using 'lock rm' on an empty lock ID
0%
Description
root@p4:/# /app/build/bin/rbd --cluster dev lock ls k8s-dev/csi-vol-0a967318-ad72-11ed-b7d2-6e4b79a3d53e
There is 1 exclusive lock on this image.
Locker ID Address
client.182284939 10.10.0.33:0/3222701987
Notice the empty ID.
root@p4:/# /app/build/bin/rbd --cluster dev lock rm k8s-dev/csi-vol-0a967318-ad72-11ed-b7d2-6e4b79a3d53e '' client.182284939
Notice that this command returned successfully.
root@p4:/# /app/build/bin/rbd --cluster dev lock ls k8s-dev/csi-vol-0a967318-ad72-11ed-b7d2-6e4b79a3d53e
There is 1 exclusive lock on this image.
Locker ID Address
client.183376590 auto 18446462598732840961 10.10.28.65:0/2469864326
Another device took the lock, as expected.
This is the fix I had to apply and compile before I could unlock my image.
diff --git a/src/tools/rbd/action/Lock.cc b/src/tools/rbd/action/Lock.cc
index 754cb384c3e..6e2355e1909 100644
--- a/src/tools/rbd/action/Lock.cc
+++ b/src/tools/rbd/action/Lock.cc
@@ -27,12 +27,7 @@ void add_id_option(po::options_description *positional) {
int get_id(const po::variables_map &vm, size_t *arg_index,
std::string *id) {
*id = utils::get_positional_argument(vm, *arg_index);
- if (id->empty()) {
- std::cerr << "rbd: lock id was not specified" << std::endl;
- return -EINVAL;
- } else {
- ++(*arg_index);
- }
+ ++(*arg_index);
return 0;
}
Updated by Ilya Dryomov 5 months ago
- Project changed from Ceph to rbd
- Category deleted (
ceph cli) - Status changed from New to Fix Under Review
- Target version deleted (
v18.2.0)