Skip to contentSkip to conversation

ipc/sem.c: Bugfix for incorrect setting of sem_otime

PATCH New Manfred Spraul 1 participant 1 message May 14, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipc/sem.c: Bugfix for incorrect setting of sem_otime

The attached patch corrects a bug that I've introduced with the previous patch series:
sem_otime is the time of the last successful semop() call.

Andrew, could you add it into your -mm tree?
It is on top of the path that fixes the missing initialization.

---
 ipc/sem.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
ipc/sem.c +7 -7
index 58dbbf7..a744eb5 100644
@@ -534,7 +534,7 @@ static int check_restart(struct sem_array *sma, struct sem_queue *q)
  * must be set to -1.
  * The tasks that must be woken up are added to @pt. The return code
  * is stored in q->pid.
- * The function return 1 if at least one array variable was modified.
+ * The function return 1 if at least one semop was completed successfully.
  */
 static int update_queue(struct sem_array *sma, int semnum, struct list_head *pt)
 {
@@ -542,7 +542,7 @@ static int update_queue(struct sem_array *sma, int semnum, struct list_head *pt)
 	struct list_head *walk;
 	struct list_head *pending_list;
 	int offset;
-	int retval = 0;
+	int semop_completed = 0;
 
 	/* if there are complex operations around, then knowing the semaphore
 	 * that was modified doesn't help us. Assume that multiple semaphores
@@ -586,19 +586,19 @@ again:
 			continue;
 
 		unlink_queue(sma, q);
-		if (q->alter)
-			retval = 1;
 
-		if (error)
+		if (error) {
 			restart = 0;
-		else
+		} else {
+			semop_completed = 1;
 			restart = check_restart(sma, q);
+		}
 
 		wake_up_sem_queue_prepare(pt, q, error);
 		if (restart)
 			goto again;
 	}
-	return retval;
+	return semop_completed;
 }
 
 /**
Signature · 1 line
1.6.6.1