diff --git a/lib/utils.py b/lib/utils.py
index f263637d4adc3dfa4a561ccee53bf789c5cf3484..beee428357d0bffa2c903546a19aa7a50d59dd83 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -1217,10 +1217,11 @@ class FileLock(object):
     try:
       fcntl.flock(self.fd, flag)
     except IOError, err:
-      logging.exception("fcntl.flock failed")
       if err.errno in (errno.EAGAIN, ):
         raise errors.LockError(errmsg)
-      raise
+      else:
+        logging.exception("fcntl.flock failed")
+        raise
 
   def Exclusive(self, blocking=False):
     """Locks the file in exclusive mode.