Re: PROPOSAL: Fixing the sys5 emulation bugs in shmfs

From: Manfred Spraul (manfreds@colorfullife.com)
Date: Mon Mar 13 2000 - 04:13:48 EST


You added a dead-lock:
* shm_lock() is a spinlock.
* shm_swap() is called from try_to_free_pages(), and that function could
be called with the big kernel lock acquired; shm_swap() calls
shm_lockall().

Alan Cox wrote:
> + shp = shm_lock(shmid);
^^^^^^^^^^^^^^^ spinlock acquired.

> + if(shp==NULL)
> + return -EINVAL;
> + err=-EIDRM;
> + if(shm_checkid(shp,shmid))
> + goto out_unlock;
> + if(shp->nattch==0)
> + shm_remove_name(shmid);
[...]
>
> +static void shm_remove_name(int id)
> +{
> + char *name = shm_getname(id);
> + if (!IS_ERR(name))
> + {
> + struct dentry *saved;
> + lock_kernel();
^^^^^^^^^^^^^^^^^^^^^^^^^^^ and lock_kernel().
> + saved=shm_push_chroot();
> + do_unlink (name);

I documented the spinlock ordering in shm.c, ~ line 190.

--
	Manfred

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Mar 15 2000 - 21:00:23 EST