Merge branch 'mh/ref-lock-entry'
[gitweb.git] / refs / files-backend.c
index 5cca55510b6a0683f16937215f6056d896c622e0..fccbc24ac4ad3631b96a4796f4b1f89913fa0ea3 100644 (file)
@@ -537,7 +537,9 @@ static int lock_raw_ref(struct files_ref_store *refs,
        if (!lock->lk)
                lock->lk = xcalloc(1, sizeof(struct lock_file));
 
-       if (hold_lock_file_for_update(lock->lk, ref_file.buf, LOCK_NO_DEREF) < 0) {
+       if (hold_lock_file_for_update_timeout(
+                           lock->lk, ref_file.buf, LOCK_NO_DEREF,
+                           get_files_ref_lock_timeout_ms()) < 0) {
                if (errno == ENOENT && --attempts_remaining > 0) {
                        /*
                         * Maybe somebody just deleted one of the
@@ -865,7 +867,9 @@ static int create_reflock(const char *path, void *cb)
 {
        struct lock_file *lk = cb;
 
-       return hold_lock_file_for_update(lk, path, LOCK_NO_DEREF) < 0 ? -1 : 0;
+       return hold_lock_file_for_update_timeout(
+                       lk, path, LOCK_NO_DEREF,
+                       get_files_ref_lock_timeout_ms()) < 0 ? -1 : 0;
 }
 
 /*