sys_semop() is wrong to insist that queue.status be -EIDRM when
sem_lock() fails on awakening.  It is quite normal for update_queue()
to have set status 0, removed process from queue and woken it; but
IPC_RMID come in before that process gets to run (or to lock) -
since process already off queue, its status is not set to -EIDRM.
If we want a safety check here, check removed from queue instead.
Return original status or -EIDRM? Checked other OSes, use -EIDRM.

diff -urN linux-2.4.2-pre4/ipc/sem.c linux/ipc/sem.c
--- linux-2.4.2-pre4/ipc/sem.c  Sat Feb 17 11:14:27 2001
+++ linux/ipc/sem.c     Sun Feb 18 08:21:37 2001
@@ -922,7 +922,7 @@
 
                tmp = sem_lock(semid);
                if(tmp==NULL) {
-                       if(queue.status != -EIDRM)
+                       if(queue.prev != NULL)
                                BUG();
                        current->semsleeping = NULL;
                        error = -EIDRM;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to