mirror of
https://github.com/ceph/ceph
synced 2025-01-19 09:32:00 +00:00
librbd: Allow get_lock_info to fail
If the lock class isn't present, EOPNOTSUPP is returned for lock calls on newer OSDs, but sadly EIO on older; we need to treat both as acceptable failures for RBD images. rados lock list will still fail. Fixes #3744. Signed-off-by: Dan Mick <dan.mick@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
f83fcf63a9
commit
4483285c9f
@ -99,10 +99,14 @@ namespace librbd {
|
||||
::decode(parent->overlap, iter);
|
||||
|
||||
// get_lock_info
|
||||
ClsLockType lock_type;
|
||||
ClsLockType lock_type = LOCK_NONE;
|
||||
r = rados::cls::lock::get_lock_info_finish(&iter, lockers, &lock_type,
|
||||
lock_tag);
|
||||
if (r < 0)
|
||||
|
||||
// see comment in ictx_refresh(). Ugly conflation of
|
||||
// EOPNOTSUPP and EIO.
|
||||
|
||||
if (r < 0 && ((r != -EOPNOTSUPP) && (r != -EIO)))
|
||||
return r;
|
||||
|
||||
*exclusive_lock = (lock_type == LOCK_EXCLUSIVE);
|
||||
|
@ -1609,11 +1609,19 @@ reprotect_and_return_err:
|
||||
<< dendl;
|
||||
return r;
|
||||
}
|
||||
ClsLockType lock_type;
|
||||
ClsLockType lock_type = LOCK_NONE;
|
||||
r = rados::cls::lock::get_lock_info(&ictx->md_ctx, ictx->header_oid,
|
||||
RBD_LOCK_NAME, &ictx->lockers,
|
||||
&lock_type, &ictx->lock_tag);
|
||||
if (r < 0) {
|
||||
|
||||
// If EOPNOTSUPP, treat image as if there are no locks (we can't
|
||||
// query them).
|
||||
|
||||
// Ugly: OSDs prior to eed28daaf8927339c2ecae1b1b06c1b63678ab03
|
||||
// return EIO when the class isn't present; should be EOPNOTSUPP.
|
||||
// Treat EIO or EOPNOTSUPP the same for now, as LOCK_NONE. Blech.
|
||||
|
||||
if (r < 0 && ((r != -EOPNOTSUPP) && (r != -EIO))) {
|
||||
lderr(cct) << "Error getting lock info: " << cpp_strerror(r)
|
||||
<< dendl;
|
||||
return r;
|
||||
|
Loading…
Reference in New Issue
Block a user