Rev 121: better error handling in ctdb_ltdb_lock_fetch_requeue() in
http://samba.org/~tridge/ctdb
tridge at samba.org
tridge at samba.org
Tue Apr 17 01:20:00 GMT 2007
------------------------------------------------------------
revno: 121
revision-id: tridge at samba.org-20070417012000-dd8a85395a077110
parent: tridge at samba.org-20070416231820-74f66bb640e03880
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Tue 2007-04-17 11:20:00 +1000
message:
better error handling in ctdb_ltdb_lock_fetch_requeue()
modified:
common/ctdb_ltdb.c ctdb_ltdb.c-20061128065342-to93h6eejj5kon81-2
=== modified file 'common/ctdb_ltdb.c'
--- a/common/ctdb_ltdb.c 2007-04-16 23:18:20 +0000
+++ b/common/ctdb_ltdb.c 2007-04-17 01:20:00 +0000
@@ -244,6 +244,12 @@
immediately satisfied until it can get the lock. This means that
the main ctdb daemon will not block waiting for a chainlock held by
a client
+
+ There are 3 possible return values:
+
+ 0: means that it got the lock immediately.
+ -1: means that it failed to get the lock, and won't retry
+ -2: means that it failed to get the lock immediately, but will retry
*/
int ctdb_ltdb_lock_fetch_requeue(struct ctdb_db_context *ctdb_db,
TDB_DATA key, struct ctdb_ltdb_header *header,
@@ -255,6 +261,12 @@
ret = tdb_chainlock_nonblock(tdb, key);
+ if (ret != 0 &&
+ !(errno == EACCES || errno == EAGAIN || errno == EDEADLK)) {
+ /* a hard failure - don't try again */
+ return -1;
+ }
+
/* first the non-contended path */
if (ret == 0) {
ret = ctdb_ltdb_fetch(ctdb_db, key, header, hdr, data);
@@ -273,6 +285,11 @@
/* we get an extra reference to the packet here, to
stop it being freed in the top level packet handler */
- (void)talloc_reference(ctdb_db, hdr);
- return 0;
+ if (talloc_reference(ctdb_db, hdr) == NULL) {
+ talloc_free(h);
+ return -1;
+ }
+
+ /* now tell the caller than we will retry asynchronously */
+ return -2;
}
More information about the samba-cvs
mailing list