aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'ipc')
-rw-r--r--ipc/sem.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/ipc/sem.c b/ipc/sem.c
index a7e40ed8a076..70480a3aa698 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -752,19 +752,29 @@ static void do_smart_update(struct sem_array *sma, struct sembuf *sops, int nsop
752 int otime, struct list_head *pt) 752 int otime, struct list_head *pt)
753{ 753{
754 int i; 754 int i;
755 int progress;
755 756
756 if (sma->complex_count || sops == NULL) { 757 progress = 1;
757 if (update_queue(sma, -1, pt)) 758retry_global:
759 if (sma->complex_count) {
760 if (update_queue(sma, -1, pt)) {
761 progress = 1;
758 otime = 1; 762 otime = 1;
763 sops = NULL;
764 }
759 } 765 }
766 if (!progress)
767 goto done;
760 768
761 if (!sops) { 769 if (!sops) {
762 /* No semops; something special is going on. */ 770 /* No semops; something special is going on. */
763 for (i = 0; i < sma->sem_nsems; i++) { 771 for (i = 0; i < sma->sem_nsems; i++) {
764 if (update_queue(sma, i, pt)) 772 if (update_queue(sma, i, pt)) {
765 otime = 1; 773 otime = 1;
774 progress = 1;
775 }
766 } 776 }
767 goto done; 777 goto done_checkretry;
768 } 778 }
769 779
770 /* Check the semaphores that were modified. */ 780 /* Check the semaphores that were modified. */
@@ -772,8 +782,15 @@ static void do_smart_update(struct sem_array *sma, struct sembuf *sops, int nsop
772 if (sops[i].sem_op > 0 || 782 if (sops[i].sem_op > 0 ||
773 (sops[i].sem_op < 0 && 783 (sops[i].sem_op < 0 &&
774 sma->sem_base[sops[i].sem_num].semval == 0)) 784 sma->sem_base[sops[i].sem_num].semval == 0))
775 if (update_queue(sma, sops[i].sem_num, pt)) 785 if (update_queue(sma, sops[i].sem_num, pt)) {
776 otime = 1; 786 otime = 1;
787 progress = 1;
788 }
789 }
790done_checkretry:
791 if (progress) {
792 progress = 0;
793 goto retry_global;
777 } 794 }
778done: 795done:
779 if (otime) 796 if (otime)