diff --git a/src/core/xrootiface.py b/src/core/xrootiface.py index e9fbf3ba..07b4e984 100644 --- a/src/core/xrootiface.py +++ b/src/core/xrootiface.py @@ -265,32 +265,32 @@ def rmxattr(endpoint, filepath, userid, key): _xrootcmd(endpoint, 'attr', 'rm', userid, 'mgm.attr.key=user.' + key + '&mgm.path=' + _getfilepath(filepath, encodeamp=True)) -def setlock(endpoint, filepath, userid, value): +def setlock(endpoint, filepath, _userid, value): '''Set a lock as an xattr with the special option "c" (create-if-not-exists) on behalf of the given userid''' try: log.debug('msg="Invoked setlock" filepath="%s"' % filepath) - setxattr(endpoint, filepath, userid, LOCKKEY, str(value) + '&mgm.option=c') + setxattr(endpoint, filepath, '0:0', LOCKKEY, str(value) + '&mgm.option=c') except IOError as e: if EXCL_XATTR_MSG in str(e): raise IOError('File exists and islock flag requested') -def getlock(endpoint, filepath, userid): +def getlock(endpoint, filepath, _userid): '''Get the lock metadata as an xattr on behalf of the given userid''' log.debug('msg="Invoked getlock" filepath="%s"' % filepath) - return getxattr(endpoint, filepath, userid, LOCKKEY) + return getxattr(endpoint, filepath, '0:0', LOCKKEY) -def refreshlock(endpoint, filepath, userid, value): +def refreshlock(endpoint, filepath, _userid, value): '''Refresh the lock value as an xattr on behalf of the given userid''' log.debug('msg="Invoked refreshlock" filepath="%s"' % filepath) - if getxattr(endpoint, filepath, userid, LOCKKEY): - setxattr(endpoint, filepath, userid, LOCKKEY, value) # non-atomic, but the lock was already held + if getxattr(endpoint, filepath, '0:0', LOCKKEY): + setxattr(endpoint, filepath, '0:0', LOCKKEY, value) # non-atomic, but the lock was already held else: raise IOError('File was not locked') -def unlock(endpoint, filepath, userid): +def unlock(endpoint, filepath, _userid): '''Remove a lock as an xattr on behalf of the given userid''' log.debug('msg="Invoked unlock" filepath="%s"' % filepath) rmxattr(endpoint, filepath, userid, LOCKKEY)