Manfred Spraul wrote:Actually - no. I wasn't aware of list_first_entry().sem_array.sem_pending is a double linked list, the attached
patch converts it to struct list_head.
Signed-Off-By: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx>
Reviewed-By: Nadia Derbey <Nadia.Derbey@xxxxxxxx>
@@ -438,16 +405,15 @@ static void update_queue (struct sem_array * sma)
int error;
struct sem_queue * q;
- q = sma->sem_pending;
- while(q) {
+ q = list_entry(sma->sem_pending.next, struct sem_queue, list);
+ while(&q->list != &sma->sem_pending) {
I guess here you are not using list_first_entry() because the pending requests might be empty?
The list_del() poisoning is IMHO efficient enough.@@ -1194,7 +1171,6 @@ asmlinkage long sys_semtimedop(int semid, struct sembuf __user *tsops,
sma = sem_lock(ns, semid);
if (IS_ERR(sma)) {
- BUG_ON(queue.prev != NULL);
Instead of removing it why not replacing the bug_ON() by a check on the queue still being linked?