radosstriper : Fixed locking of truncation in libradosstriper

Last commit did drop the check for existence of the object. It's now back there

Signed-off-by: Sebastien Ponce <sebastien.ponce@cern.ch>
This commit is contained in:
Sebastien Ponce 2016-09-22 09:40:50 +02:00 committed by root
parent 64bb74ab94
commit db2f521956

View File

@ -902,8 +902,12 @@ int libradosstriper::RadosStriperImpl::trunc(const std::string& soid, uint64_t s
{
// lock the object in exclusive mode
std::string firstObjOid = getObjectId(soid, 0);
librados::ObjectWriteOperation op;
op.assert_exists();
std::string lockCookie = RadosStriperImpl::getUUID();
int rc = m_ioCtx.lock_exclusive(firstObjOid, RADOS_LOCK_NAME, lockCookie, "", 0, 0);
utime_t dur = utime_t();
rados::cls::lock::lock(&op, RADOS_LOCK_NAME, LOCK_EXCLUSIVE, lockCookie, "", "", dur, 0);
int rc = m_ioCtx.operate(firstObjOid, &op);
if (rc) return rc;
// load layout and size
ceph_file_layout layout;