r3312: in the brlock code, we prevent lock stampedes by attempting to not
authorAndrew Tridgell <tridge@samba.org>
Thu, 28 Oct 2004 06:45:28 +0000 (06:45 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:04:53 +0000 (13:04 -0500)
wakeup all pending locks at once. This change means that we only
trigger this anti-stampede code for write locks, as for pending read
locks the correct behaviour is to stampede (as they will all succeed)

source/ntvfs/common/brlock.c

index d4b152cf42e676919cbf36b4c944dd3567592542..b43f0705a51fce709dc8fd8c8efe6128d9d36ac1 100644 (file)
@@ -338,7 +338,9 @@ static void brl_notify_unlock(struct brl_context *brl,
                        if (last_notice != -1 && brl_overlap(&locks[i], &locks[last_notice])) {
                                continue;
                        }
-                       last_notice = i;
+                       if (locks[i].lock_type == PENDING_WRITE_LOCK) {
+                               last_notice = i;
+                       }
                        data.data = (void *)&locks[i].notify_ptr;
                        data.length = sizeof(void *);
                        messaging_send(brl->messaging_ctx, locks[i].context.server, MSG_BRL_RETRY, &data);