nwshare: preserve synchronization set entries

Keep synchronization set entries linked while handling Lock, Release, and Clear
Set operations.

The Novell SDK documents the set-oriented synchronization calls as operating on
the caller task table: Log File and Log Logical Record add entries, Lock Set
locks the logged entries, Release Set unlocks them while keeping them logged
for future Lock Set calls, and Clear Set unlocks and removes them.

share_handle_lock_sets() already encoded that semantic split with lock_flag -1
for release and -2 for clear, but its iterator unlinked each entry before
checking whether it should be removed. That meant even Lock Set and Release Set
walked the table destructively, and non-matching set types could be lost while
operating on another set family.

Only unlink entries when processing a matching Clear Set operation. Leave
entries in place for Lock Set and Release Set, and advance the list normally
for non-matching entries.

This fixes the shared set iterator used by the documented File Set and Logical
Record Set endpoints; it does not change the low-level locking primitives.
This commit is contained in:
Mario Fetka
2026-05-29 23:09:01 +02:00
parent 4e5573c992
commit cfde1247f0

View File

@@ -778,24 +778,27 @@ int share_handle_lock_sets(int type, int lock_flag, int timeout)
SHARESET **pset = &first_set;
while (*pset) {
SHARESET *ps = *pset;
*pset = (*pset)->next;
if (type & ps->type) {
if (ps->locked && (lock_flag < 0)) {
if (!lock_unlock_pset(ps, -1))
ps->locked = 0;
} else if ((!ps->locked) && lock_flag > -1){
if (lock_unlock_pset(ps, lock_flag)){
/* remove all locks */
/* release locks already acquired for this set operation */
share_handle_lock_sets(type, -1, 0);
return(-1);
} else
ps->locked = 1;
}
if (lock_flag == -2) { /* remove node */
if (lock_flag == -2) { /* remove matching node */
*pset = ps->next;
xfree(ps->data);
xfree(ps);
}
}
continue;
}
}
pset = &ps->next;
}
return(0);
}