diff options
-rw-r--r-- | ipc/sem.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -257,12 +257,20 @@ static void sem_rcu_free(struct rcu_head *head) | |||
257 | * Caller must own sem_perm.lock. | 257 | * Caller must own sem_perm.lock. |
258 | * New simple ops cannot start, because simple ops first check | 258 | * New simple ops cannot start, because simple ops first check |
259 | * that sem_perm.lock is free. | 259 | * that sem_perm.lock is free. |
260 | * that a) sem_perm.lock is free and b) complex_count is 0. | ||
260 | */ | 261 | */ |
261 | static void sem_wait_array(struct sem_array *sma) | 262 | static void sem_wait_array(struct sem_array *sma) |
262 | { | 263 | { |
263 | int i; | 264 | int i; |
264 | struct sem *sem; | 265 | struct sem *sem; |
265 | 266 | ||
267 | if (sma->complex_count) { | ||
268 | /* The thread that increased sma->complex_count waited on | ||
269 | * all sem->lock locks. Thus we don't need to wait again. | ||
270 | */ | ||
271 | return; | ||
272 | } | ||
273 | |||
266 | for (i = 0; i < sma->sem_nsems; i++) { | 274 | for (i = 0; i < sma->sem_nsems; i++) { |
267 | sem = sma->sem_base + i; | 275 | sem = sma->sem_base + i; |
268 | spin_unlock_wait(&sem->lock); | 276 | spin_unlock_wait(&sem->lock); |