X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=ipc%2Fsem.c;fp=ipc%2Fsem.c;h=e20658d76bb5289b30e2c923d72137fd074aef9f;hb=6d07b68ce16ae9535955ba2059dedba5309c3ca1;hp=4a92c0447ad66d4a351a3988dbda69df641573e1;hpb=5e9d527591421ccdb16acb8c23662231135d8686;p=karo-tx-linux.git diff --git a/ipc/sem.c b/ipc/sem.c index 4a92c0447ad6..e20658d76bb5 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -257,12 +257,20 @@ static void sem_rcu_free(struct rcu_head *head) * Caller must own sem_perm.lock. * New simple ops cannot start, because simple ops first check * that sem_perm.lock is free. + * that a) sem_perm.lock is free and b) complex_count is 0. */ static void sem_wait_array(struct sem_array *sma) { int i; struct sem *sem; + if (sma->complex_count) { + /* The thread that increased sma->complex_count waited on + * all sem->lock locks. Thus we don't need to wait again. + */ + return; + } + for (i = 0; i < sma->sem_nsems; i++) { sem = sma->sem_base + i; spin_unlock_wait(&sem->lock);