summaryrefslogtreecommitdiff
path: root/source3/locking/posix.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-05-05 02:17:39 +0000
committerJeremy Allison <jra@samba.org>2000-05-05 02:17:39 +0000
commit091c9706829ad0a076ee7ae9ffc77b65fd502508 (patch)
tree97b920eeca78d6503274a641c36a65c37589397a /source3/locking/posix.c
parent044b5690066a6673ee78b1fae6bffda9bd6afbc4 (diff)
downloadsamba-091c9706829ad0a076ee7ae9ffc77b65fd502508.tar.gz
samba-091c9706829ad0a076ee7ae9ffc77b65fd502508.tar.bz2
samba-091c9706829ad0a076ee7ae9ffc77b65fd502508.zip
Two fixes. Added missong logic & case in lock split code.
Fixed range split into two, as DLIST_ADD has the wrong semantics... Jeremy. (This used to be commit 82681edda14dcc3d58bb303cfac5452072de67df)
Diffstat (limited to 'source3/locking/posix.c')
-rw-r--r--source3/locking/posix.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index f7468aac4b..0ab46f9ca4 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -1113,7 +1113,8 @@ BECOMES....
ul_curr = ul_curr->next;
} else if ( (ul_curr->start < lock->start) &&
- (ul_curr->start + ul_curr->size > lock->start) ) {
+ (ul_curr->start + ul_curr->size > lock->start) &&
+ (ul_curr->start + ul_curr->size <= lock->start + lock->size) ) {
/*
* This unlock overlaps the existing lock range at the low end.
@@ -1171,9 +1172,6 @@ BECOMES.....
ul_new->start = lock->start + lock->size;
ul_new->size = ul_curr->start + ul_curr->size - ul_new->start;
- /* Add into the dlink list after the ul_curr point - NOT at ulhead. */
- DLIST_ADD(ul_curr, ul_new);
-
/* Truncate the ul_curr. */
ul_curr->size = lock->start - ul_curr->start;
@@ -1181,6 +1179,16 @@ BECOMES.....
new: start=%.0f,size=%.0f\n", (double)ul_curr->start, (double)ul_curr->size,
(double)ul_new->start, (double)ul_new->size ));
+ /*
+ * Add into the dlink list after the ul_curr point - NOT at ulhead.
+ * Note we can't use DLINK_ADD here as this inserts at the head of the given list.
+ */
+
+ ul_new->prev = ul_curr;
+ ul_new->next = ul_curr->next;
+ ul_curr->next = ul_new;
+
+ /* And move after the link we added. */
ul_curr = ul_new->next;
} else {