@@ -365,7 +365,7 @@ static inline void sem_unlock(struct sem_array *sma, int locknum)
365365}
366366
367367/*
368- * sem_lock_(check_) routines are called in the paths where the rw_mutex
368+ * sem_lock_(check_) routines are called in the paths where the rwsem
369369 * is not held.
370370 *
371371 * The caller holds the RCU read lock.
@@ -464,7 +464,7 @@ static inline void sem_rmid(struct ipc_namespace *ns, struct sem_array *s)
464464 * @ns: namespace
465465 * @params: ptr to the structure that contains key, semflg and nsems
466466 *
467- * Called with sem_ids.rw_mutex held (as a writer)
467+ * Called with sem_ids.rwsem held (as a writer)
468468 */
469469
470470static int newary (struct ipc_namespace * ns , struct ipc_params * params )
@@ -529,7 +529,7 @@ static int newary(struct ipc_namespace *ns, struct ipc_params *params)
529529
530530
531531/*
532- * Called with sem_ids.rw_mutex and ipcp locked.
532+ * Called with sem_ids.rwsem and ipcp locked.
533533 */
534534static inline int sem_security (struct kern_ipc_perm * ipcp , int semflg )
535535{
@@ -540,7 +540,7 @@ static inline int sem_security(struct kern_ipc_perm *ipcp, int semflg)
540540}
541541
542542/*
543- * Called with sem_ids.rw_mutex and ipcp locked.
543+ * Called with sem_ids.rwsem and ipcp locked.
544544 */
545545static inline int sem_more_checks (struct kern_ipc_perm * ipcp ,
546546 struct ipc_params * params )
@@ -1031,8 +1031,8 @@ static int count_semzcnt (struct sem_array * sma, ushort semnum)
10311031 return semzcnt ;
10321032}
10331033
1034- /* Free a semaphore set. freeary() is called with sem_ids.rw_mutex locked
1035- * as a writer and the spinlock for this semaphore set hold. sem_ids.rw_mutex
1034+ /* Free a semaphore set. freeary() is called with sem_ids.rwsem locked
1035+ * as a writer and the spinlock for this semaphore set hold. sem_ids.rwsem
10361036 * remains locked on exit.
10371037 */
10381038static void freeary (struct ipc_namespace * ns , struct kern_ipc_perm * ipcp )
@@ -1152,7 +1152,7 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
11521152 seminfo .semmnu = SEMMNU ;
11531153 seminfo .semmap = SEMMAP ;
11541154 seminfo .semume = SEMUME ;
1155- down_read (& sem_ids (ns ).rw_mutex );
1155+ down_read (& sem_ids (ns ).rwsem );
11561156 if (cmd == SEM_INFO ) {
11571157 seminfo .semusz = sem_ids (ns ).in_use ;
11581158 seminfo .semaem = ns -> used_sems ;
@@ -1161,7 +1161,7 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
11611161 seminfo .semaem = SEMAEM ;
11621162 }
11631163 max_id = ipc_get_maxid (& sem_ids (ns ));
1164- up_read (& sem_ids (ns ).rw_mutex );
1164+ up_read (& sem_ids (ns ).rwsem );
11651165 if (copy_to_user (p , & seminfo , sizeof (struct seminfo )))
11661166 return - EFAULT ;
11671167 return (max_id < 0 ) ? 0 : max_id ;
@@ -1467,9 +1467,9 @@ copy_semid_from_user(struct semid64_ds *out, void __user *buf, int version)
14671467}
14681468
14691469/*
1470- * This function handles some semctl commands which require the rw_mutex
1470+ * This function handles some semctl commands which require the rwsem
14711471 * to be held in write mode.
1472- * NOTE: no locks must be held, the rw_mutex is taken inside this function.
1472+ * NOTE: no locks must be held, the rwsem is taken inside this function.
14731473 */
14741474static int semctl_down (struct ipc_namespace * ns , int semid ,
14751475 int cmd , int version , void __user * p )
@@ -1484,7 +1484,7 @@ static int semctl_down(struct ipc_namespace *ns, int semid,
14841484 return - EFAULT ;
14851485 }
14861486
1487- down_write (& sem_ids (ns ).rw_mutex );
1487+ down_write (& sem_ids (ns ).rwsem );
14881488 rcu_read_lock ();
14891489
14901490 ipcp = ipcctl_pre_down_nolock (ns , & sem_ids (ns ), semid , cmd ,
@@ -1523,7 +1523,7 @@ static int semctl_down(struct ipc_namespace *ns, int semid,
15231523out_unlock1 :
15241524 rcu_read_unlock ();
15251525out_up :
1526- up_write (& sem_ids (ns ).rw_mutex );
1526+ up_write (& sem_ids (ns ).rwsem );
15271527 return err ;
15281528}
15291529
0 commit comments