|
@@ -111,24 +111,9 @@ void __init shm_init (void)
|
|
IPC_SHM_IDS, sysvipc_shm_proc_show);
|
|
IPC_SHM_IDS, sysvipc_shm_proc_show);
|
|
}
|
|
}
|
|
|
|
|
|
-/*
|
|
|
|
- * shm_lock_(check_)down routines are called in the paths where the rw_mutex
|
|
|
|
- * is held to protect access to the idr tree.
|
|
|
|
- */
|
|
|
|
-static inline struct shmid_kernel *shm_lock_down(struct ipc_namespace *ns,
|
|
|
|
- int id)
|
|
|
|
-{
|
|
|
|
- struct kern_ipc_perm *ipcp = ipc_lock_down(&shm_ids(ns), id);
|
|
|
|
-
|
|
|
|
- if (IS_ERR(ipcp))
|
|
|
|
- return (struct shmid_kernel *)ipcp;
|
|
|
|
-
|
|
|
|
- return container_of(ipcp, struct shmid_kernel, shm_perm);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* shm_lock_(check_) routines are called in the paths where the rw_mutex
|
|
* shm_lock_(check_) routines are called in the paths where the rw_mutex
|
|
- * is not held.
|
|
|
|
|
|
+ * is not necessarily held.
|
|
*/
|
|
*/
|
|
static inline struct shmid_kernel *shm_lock(struct ipc_namespace *ns, int id)
|
|
static inline struct shmid_kernel *shm_lock(struct ipc_namespace *ns, int id)
|
|
{
|
|
{
|
|
@@ -211,7 +196,7 @@ static void shm_close(struct vm_area_struct *vma)
|
|
|
|
|
|
down_write(&shm_ids(ns).rw_mutex);
|
|
down_write(&shm_ids(ns).rw_mutex);
|
|
/* remove from the list of attaches of the shm segment */
|
|
/* remove from the list of attaches of the shm segment */
|
|
- shp = shm_lock_down(ns, sfd->id);
|
|
|
|
|
|
+ shp = shm_lock(ns, sfd->id);
|
|
BUG_ON(IS_ERR(shp));
|
|
BUG_ON(IS_ERR(shp));
|
|
shp->shm_lprid = task_tgid_vnr(current);
|
|
shp->shm_lprid = task_tgid_vnr(current);
|
|
shp->shm_dtim = get_seconds();
|
|
shp->shm_dtim = get_seconds();
|
|
@@ -932,7 +917,7 @@ invalid:
|
|
|
|
|
|
out_nattch:
|
|
out_nattch:
|
|
down_write(&shm_ids(ns).rw_mutex);
|
|
down_write(&shm_ids(ns).rw_mutex);
|
|
- shp = shm_lock_down(ns, shmid);
|
|
|
|
|
|
+ shp = shm_lock(ns, shmid);
|
|
BUG_ON(IS_ERR(shp));
|
|
BUG_ON(IS_ERR(shp));
|
|
shp->shm_nattch--;
|
|
shp->shm_nattch--;
|
|
if(shp->shm_nattch == 0 &&
|
|
if(shp->shm_nattch == 0 &&
|