Subject: Re: ext2fs_write crashing (build: head snapshot 200601060000Z)
To: None <current-users@NetBSD.org>
From: Aravind Gottipati <aravind@freeshell.org>
List: current-users
Date: 01/14/2006 18:23:58
sometime around Sat, Jan 14, 2006 at 11:51:23PM +0100
Pavel Cahyna wrote:
> Please try the attached patch, to be applied under src/sys. It should
> fix msdosfs too.

Cool, this patch fixes the ext2 fs crashes.  I haven't been able to
crash the fs using mutt (and creating directories).

Thank you,

Aravind.

> Index: arch/x86/x86/bus_dma.c
> ===================================================================
> RCS file: /home/pavel/cvs/src/sys/arch/x86/x86/bus_dma.c,v
> retrieving revision 1.27
> diff -u -u -r1.27 bus_dma.c
> --- arch/x86/x86/bus_dma.c	24 Dec 2005 20:07:42 -0000	1.27
> +++ arch/x86/x86/bus_dma.c	14 Jan 2006 22:27:50 -0000
> @@ -946,7 +946,7 @@
>  	int i;
>  
>  	iov = uio->uio_iov;
> -	p = uio->uio_lwp->l_proc;
> +	p = uio->uio_lwp ? uio->uio_lwp->l_proc : NULL;
>  	cp = buf;
>  	resid = n;
>  
> Index: fs/msdosfs/msdosfs_vnops.c
> ===================================================================
> RCS file: /home/pavel/cvs/src/sys/fs/msdosfs/msdosfs_vnops.c,v
> retrieving revision 1.24
> diff -u -u -r1.24 msdosfs_vnops.c
> --- fs/msdosfs/msdosfs_vnops.c	11 Dec 2005 12:24:25 -0000	1.24
> +++ fs/msdosfs/msdosfs_vnops.c	14 Jan 2006 22:27:50 -0000
> @@ -561,7 +561,7 @@
>  	vsize_t bytelen;
>  	off_t oldoff;
>  	struct uio *uio = ap->a_uio;
> -	struct proc *p = uio->uio_lwp->l_proc;
> +	struct proc *p = uio->uio_lwp ? uio->uio_lwp->l_proc : NULL;
>  	struct vnode *vp = ap->a_vp;
>  	struct denode *dep = VTODE(vp);
>  	struct msdosfsmount *pmp = dep->de_pmp;
> Index: ufs/ext2fs/ext2fs_readwrite.c
> ===================================================================
> RCS file: /home/pavel/cvs/src/sys/ufs/ext2fs/ext2fs_readwrite.c,v
> retrieving revision 1.40
> diff -u -u -r1.40 ext2fs_readwrite.c
> --- ufs/ext2fs/ext2fs_readwrite.c	11 Dec 2005 12:25:25 -0000	1.40
> +++ ufs/ext2fs/ext2fs_readwrite.c	14 Jan 2006 22:29:13 -0000
> @@ -281,7 +281,7 @@
>  	 * Maybe this should be above the vnode op call, but so long as
>  	 * file servers have no limits, I don't think it matters.
>  	 */
> -	p = uio->uio_lwp->l_proc;
> +	p = uio->uio_lwp ? uio->uio_lwp->l_proc : NULL;
>  	if (vp->v_type == VREG && p &&
>  	    uio->uio_offset + uio->uio_resid >
>  	    p->p_rlimit[RLIMIT_FSIZE].rlim_cur) {