patch-2.3.10 linux/ipc/shm.c

Next file: linux/kernel/Makefile
Previous file: linux/init/main.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.9/linux/ipc/shm.c linux/ipc/shm.c
@@ -381,8 +381,7 @@
 	NULL,			/* advise */
 	shm_nopage,		/* nopage */
 	NULL,			/* wppage */
-	shm_swapout,		/* swapout */
-	NULL			/* swapin */
+	shm_swapout		/* swapout */
 };
 
 /* Insert shmd into the list shp->attaches */
@@ -548,6 +547,7 @@
 	unsigned int id;
 	struct shmid_kernel *shp;
 
+	lock_kernel();
 	id = SWP_OFFSET(shmd->vm_pte) & SHM_ID_MASK;
 	shp = shm_segs[id];
 	if (shp == IPC_UNUSED) {
@@ -558,6 +558,7 @@
 	shp->u.shm_nattch++;
 	shp->u.shm_atime = CURRENT_TIME;
 	shp->u.shm_lpid = current->pid;
+	unlock_kernel();
 }
 
 /*
@@ -571,6 +572,7 @@
 	struct shmid_kernel *shp;
 	int id;
 
+	lock_kernel();
 	/* remove from the list of attaches of the shm segment */
 	id = SWP_OFFSET(shmd->vm_pte) & SHM_ID_MASK;
 	shp = shm_segs[id];
@@ -579,6 +581,7 @@
 	shp->u.shm_dtime = CURRENT_TIME;
 	if (--shp->u.shm_nattch <= 0 && shp->u.shm_perm.mode & SHM_DEST)
 		killseg (id);
+	unlock_kernel();
 }
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)