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

From: Manfred Spraul
Date: Fri May 14 2010 - 05:09:50 EST


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.

Signed-off-by: Manfred Spraul <manfred@xxxxxxxxxxxxxxxx>
---
ipc/sem.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/ipc/sem.c b/ipc/sem.c
index 58dbbf7..a744eb5 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -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;
}

/**
--
1.6.6.1

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