Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 1996 02:42:16 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, davidg@Root.COM
Cc:        freebsd-current@FreeBSD.ORG, jhay@mikom.csir.co.za
Subject:   Re: fixes for rename panic (round 1)
Message-ID:  <199603061542.CAA27656@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>>***************
>>*** 953,958 ****
>>--- 1005,1012 ----
>>  			panic("ufs_rename: lost to startdir");
>>  		error = relookup(tdvp, &tvp, tcnp);
>>+ 		VREF(tdvp);
>>  		if (error)
>>  			goto out;
>>+ 		vrele(tdvp);
>>  		dp = VTOI(tdvp);
>>  		xp = NULL;

>   It seems like this hunk should be similar to the others - the VREF() should
>be before the call to relookup(). Right?

Right.  The above will probably work because the reference count is > 0
because rename() holds a reference to ni_startdir, so there is no danger
of the reference count going from 0 to -1 in the vput() in relookup().  For
the same reason,  it should work to only add a reference after an error:

	relookup() = ...
	if (error) {
		VREF(tdvp);
		goto out;
	}

but it seems clearer to use a VREF() for each vrele(), at least statically.

My tests only covered the following cases:

- first relookup() called, always succeeded.
- second relookup() never (?) called.
- third relookup() called, sometimes failed.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603061542.CAA27656>