tools/rados: update advisory lock break usage with --lock-cookie required

Advisory lock break rados command actually needs --lock-cookie arg,
otherwise it can't find correct locker and return ENOENT. So update
its usgae and add some logs for debug.

Signed-off-by: Zhi Zhang <zhangz.david@outlook.com>
This commit is contained in:
Zhi Zhang 2019-11-26 12:49:21 +08:00
parent 398323904f
commit fd3602e4b8
3 changed files with 10 additions and 2 deletions

View File

@ -71,6 +71,12 @@ Options
Set the object size for put/get ops and for write benchmarking
.. option:: --lock-cookie locker-cookie
Will set the lock cookie for acquiring advisory lock (lock get command).
If the cookie is not empty, this option must be passed to lock break command
to find the correct lock when releasing lock.
Global commands
===============

View File

@ -297,6 +297,8 @@ static int remove_lock(cls_method_context_t hctx,
// remove named locker from set
map<locker_id_t, locker_info_t>::iterator iter = lockers.find(id);
if (iter == lockers.end()) { // no such key
CLS_LOG(10, "locker %s [name: %s.%ld, cookie: %s] does not exist", name.c_str(),
locker.type_str(), locker.num(), cookie.c_str());
return -ENOENT;
}
lockers.erase(iter);

View File

@ -142,9 +142,9 @@ void usage(ostream& out)
"ADVISORY LOCKS\n"
" lock list <obj-name>\n"
" List all advisory locks on an object\n"
" lock get <obj-name> <lock-name>\n"
" lock get <obj-name> <lock-name> [--lock-cookie locker-cookie] [--lock-tag locker-tag] [--lock-description locker-desc] [--lock-duration locker-dur] [--lock-type locker-type]\n"
" Try to acquire a lock\n"
" lock break <obj-name> <lock-name> <locker-name>\n"
" lock break <obj-name> <lock-name> <locker-name> [--lock-cookie locker-cookie]\n"
" Try to break a lock acquired by another client\n"
" lock info <obj-name> <lock-name>\n"
" Show lock information\n"