Thread (6 messages) flat view 6 messages, 1 author, 2016-06-15
DORMANTno replies

Revision v2 of 3 in this series.

Revisions (3)
  1. v3 [diff vs current]
  2. v1 [diff vs current]
  3. v2 current

[PATCH v2 2/5] refs.c: return error instead of dying when locking fails during transaction

From: Ronnie Sahlberg <hidden>
Date: 2016-06-15 23:02:05
Subsystem: the rest · Maintainer: Linus Torvalds

Change lock_ref_sha1_basic to return an error instead of dying when
we fail to lock a file during a transaction.
This function is only called from transaction_commit() and it knows how
to handle these failures.

Signed-off-by: Ronnie Sahlberg <redacted>
---
 refs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/refs.c b/refs.c
index 41cb51d..35f6db1 100644
--- a/refs.c
+++ b/refs.c
@@ -2206,6 +2206,7 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname,
 
 	lock->lock_fd = hold_lock_file_for_update(lock->lk, ref_file, lflags);
 	if (lock->lock_fd < 0) {
+		last_errno = errno;
 		if (errno == ENOENT && --attempts_remaining > 0)
 			/*
 			 * Maybe somebody just deleted one of the
@@ -2213,8 +2214,10 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname,
 			 * again:
 			 */
 			goto retry;
-		else
-			unable_to_lock_index_die(ref_file, errno);
+		else {
+			unable_to_lock_error(ref_file, errno);
+			goto error_return;
+		}
 	}
 	if (bad_ref)
 		return lock;
-- 
2.0.1.523.g0041e8a
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help