Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Aug 1998 15:15:07 -0700 (PDT)
From:      Julian Elischer <julian@whistle.com>
To:        Luoqi Chen <luoqi@watermarkgroup.com>
Cc:        kkennawa@physics.adelaide.edu.au, current@FreeBSD.ORG
Subject:   Re: Softupdates panic
Message-ID:  <Pine.BSF.3.95.980807151030.22126E-100000@current1.whistle.com>
In-Reply-To: <199808071609.MAA22564@lor.watermarkgroup.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On Fri, 7 Aug 1998, Luoqi Chen wrote:

> > Well, here's the problem simplified:
> > 
> > cd /tmp (assuming mounted soft-updates)
> > mkdir d1
> > mkdir d1/d2
> > mkdir d2
> > mv d2 d1
> > rmdir d1/d2
> > rmdir d1
> > [system will panic in 15 seconds at 'sync' of that data.]
> > 
> > fix to follow. (and checked in I guess)
> > 
> > julian
> > 
> I looked at the problem and figured out what went wrong. During the rename
> step (mv d2 d1), the target directory d1/d2 is deleted and a dirrem
> dependency is generated. Normally, a dirrem dependency would decrease
> the parent's link count by 1 and subdirectory's link count by 2. But for
> this particular dirrem, we don't want to decrement the parent's link count,
> otherwise we would the panic above. The solution would be mark this dirrem
> as such, and don't decrement the parent's link count when it's handled.
> Attached is a fix.
> 

Kirk pointed out that this is correct for some cases but not all.
The correct fix it this fix, but conditional upon whether the new_parent
flag is set in the rename system call.

there are two cases...
the move is happenning all within one directory
the move is happenning across different directories..

they must be handled differently. And he is working on that part,
but he will use your fix as part of it..
He says you're on the right track...

thanks..

julian

> -lq
> 
> Index: ffs_softdep.c
> ===================================================================
> RCS file: /fun/cvs/src/contrib/sys/softupdates/ffs_softdep.c,v
> retrieving revision 1.12
> diff -u -r1.12 ffs_softdep.c
> --- ffs_softdep.c	1998/06/12 21:21:26	1.12
> +++ ffs_softdep.c	1998/08/07 15:37:57
> @@ -2436,6 +2436,7 @@
>  	 * Allocate a new dirrem and ACQUIRE_LOCK.
>  	 */
>  	dirrem = newdirrem(bp, dp, ip, isrmdir);
> +	dirrem->dm_state |= DIRCHG;
>  	pagedep = dirrem->dm_pagedep;
>  
>  	/*
> @@ -2546,6 +2547,15 @@
>  	ip->i_flag |= IN_CHANGE;
>  	if ((error = UFS_TRUNCATE(vp, (off_t)0, 0, p->p_ucred, p)) != 0)
>  		softdep_error("handle_workitem_remove: truncate", error);
> +	/*
> +	 * Target directory deletion during a directory rename. The
> +	 * parent directory's link count doesn't need to be decremented.
> +	 */
> +	if (dirrem->dm_state & DIRCHG) {
> +		vput(vp);
> +		WORKITEM_FREE(dirrem, D_DIRREM);
> +		return;
> +	}
>  	ACQUIRE_LOCK(&lk);
>  	(void) inodedep_lookup(ip->i_fs, dirrem->dm_oldinum, DEPALLOC,
>  	    &inodedep);
> 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.980807151030.22126E-100000>