Update of /cvsroot/ssic-linux/openssi/kernel/ipc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8401/ipc
Modified Files:
Tag: OPENSSI-RH
shm.c
Log Message:
ipc/shm.c
cluster/ssi/vproc/as_xscribe.c
- Fix bug in error handling code where shm client structure was not
getting cleaned up properly.
- Modified as_do_vma() to return error when creating remote shm
client structure.
- Fix compile warning.
Index: shm.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/ipc/Attic/shm.c,v
retrieving revision 1.2.2.11
retrieving revision 1.2.2.12
diff -C2 -d -r1.2.2.11 -r1.2.2.12
*** shm.c 19 Feb 2004 08:43:02 -0000 1.2.2.11
--- shm.c 27 Feb 2004 03:11:14 -0000 1.2.2.12
***************
*** 41,45 ****
extern int cli_ipcname_rmid(int, global_id_t);
extern int ssi_shmctl(clusternode_t, int, int, struct shmid_ds *);
! extern int ssi_shm_get_shmid_kernel(clusternode_t, int, int **, int *, int *);
extern int ipc_grow_ary(struct ipc_ids *, int);
long ssi_shmget(key_t, size_t, int);
--- 41,45 ----
extern int cli_ipcname_rmid(int, global_id_t);
extern int ssi_shmctl(clusternode_t, int, int, struct shmid_ds *);
! extern int ssi_shm_get_shmid_kernel(clusternode_t, int, char **, int *, int
*);
extern int ipc_grow_ary(struct ipc_ids *, int);
long ssi_shmget(key_t, size_t, int);
***************
*** 206,211 ****
int sz = 0;
! if ((ssi_shm_cleanup(svrnode, shp->id, this_node) < 0) ||
! (svrnode != this_node)) {
shm_unlock(shp->id);
return;
--- 206,212 ----
int sz = 0;
!
! if (svrnode && ((ssi_shm_cleanup(svrnode, shp->id, this_node) < 0) ||
! (svrnode != this_node))) {
shm_unlock(shp->id);
return;
***************
*** 919,923 ****
if (ssi_changeid(shp, id, shmid) < 0) {
printk("Unable to add newid %d to shm_ids\n",shmid);
! shp->shm_node = this_node;
shm_destroy(shp);
up(&shm_ids.sem);
--- 920,924 ----
if (ssi_changeid(shp, id, shmid) < 0) {
printk("Unable to add newid %d to shm_ids\n",shmid);
! shp->shm_node = 0;
shm_destroy(shp);
up(&shm_ids.sem);
***************
*** 927,932 ****
shm_unlock(shp->id);
up(&shm_ids.sem);
- dput(shp->shm_file->f_dentry);
- mntput(shp->shm_file->f_vfsmnt);
shp = shm_lock(shmid);
}
--- 928,931 ----
***************
*** 937,946 ****
--- 936,954 ----
err = shm_checkid(shp,shmid);
if (err) {
+ #ifdef CONFIG_SSI
+ goto ssi_err;
+ #else
shm_unlock(shmid);
return err;
+ #endif
}
if (ipcperms(&shp->shm_perm, acc_mode)) {
+ #ifdef CONFIG_SSI
+ err = -EACCES;
+ goto ssi_err;
+ #else
shm_unlock(shmid);
return -EACCES;
+ #endif
}
#ifdef CONFIG_SSI
***************
*** 958,961 ****
--- 966,971 ----
if (de) {
/* switch file to cfs and cleanup */
+ dput(shp->shm_file->f_dentry);
+ mntput(shp->shm_file->f_vfsmnt);
new_mnt = (struct vfsmount *)
cfs_shm_node_mnts[shp->shm_node];
***************
*** 965,969 ****
}
else {
! shp->shm_node = this_node;
shm_destroy(shp);
up (&shm_ids.sem);
--- 975,979 ----
}
else {
! shp->shm_node = 0;
shm_destroy(shp);
up (&shm_ids.sem);
***************
*** 1014,1017 ****
--- 1024,1038 ----
err = PTR_ERR(user_addr);
return err;
+ ssi_err:
+ #ifdef CONFIG_SSI
+ if (shp->shm_node != this_node && this_node != name_server_node &&
+ shp->shm_file->f_op != &cfs_shm_file_operations) {
+ shp->shm_node = 0;
+ shm_destroy(shp);
+ }
+ else
+ shm_unlock(shmid);
+ return err;
+ #endif
}
***************
*** 1153,1162 ****
down(&shm_ids.sem);
id = newseg(key, flags, sz, file, view);
!
shp = shm_lock(id);
if (ssi_changeid(shp, id, shmid) < 0) {
printk("Unable to add newid %d to shm_ids\n",shmid);
get_file(file);
! shp->shm_node = this_node;
shm_destroy(shp);
up(&shm_ids.sem);
--- 1174,1186 ----
down(&shm_ids.sem);
id = newseg(key, flags, sz, file, view);
! if (id < 0) {
! up(&shm_ids.sem);
! return id;
! }
shp = shm_lock(id);
if (ssi_changeid(shp, id, shmid) < 0) {
printk("Unable to add newid %d to shm_ids\n",shmid);
get_file(file);
! shp->shm_node = 0;
shm_destroy(shp);
up(&shm_ids.sem);
***************
*** 1171,1178 ****
}
}
! if (shp->shm_file != file){
! old_file = file;
! file = shp->shm_file;
! *filepp = file;
}
get_file(file);
--- 1195,1210 ----
}
}
! if (shmid != shp->id) {
! printk("Failed to create new cli entry, failing migrate\n");
! shm_unlock(shp->id);
! up(&shm_ids.sem);
! return -EINVAL;
! }
! else {
! if (shp->shm_file != file) {
! old_file = file;
! file = shp->shm_file;
! *filepp = file;
! }
}
get_file(file);
***************
*** 1208,1212 ****
if (ssi_changeid(shp, id, shmid) < 0) {
printk("Unable to add newid %d to shm_ids\n",shmid);
! shp->shm_node = this_node;
shm_destroy(shp);
up(&shm_ids.sem);
--- 1240,1244 ----
if (ssi_changeid(shp, id, shmid) < 0) {
printk("Unable to add newid %d to shm_ids\n",shmid);
! shp->shm_node = 0;
shm_destroy(shp);
up(&shm_ids.sem);
***************
*** 1406,1410 ****
if (ssi_changeid(shp, id, newid) < 0) {
printk("Unable to add newid %lu to
shm_ids\n",newid);
! shp->shm_node = this_node;
shm_destroy(shp);
cli_ipcname_rmid(NAME_SERVICE_SHM,
newid);
--- 1438,1442 ----
if (ssi_changeid(shp, id, newid) < 0) {
printk("Unable to add newid %lu to
shm_ids\n",newid);
! shp->shm_node = 0;
shm_destroy(shp);
cli_ipcname_rmid(NAME_SERVICE_SHM,
newid);
***************
*** 1419,1422 ****
--- 1451,1455 ----
cli_ipcname_rmid(NAME_SERVICE_SHM, newid);
shm_lock(newid);
+ shp->shm_node = 0;
shm_destroy(shp);
retval = -EINVAL;
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
|