Two recent commits in sys/ufs/ufs interacted badly with ext2fs

because it shares ufs code. In ufs_fhtovp(), the test on i_effnlink
is invalid because ext2fs does not maintain this field. In ufs_close(),
i_effnlink is also tested, to determines whether or not to call
vn_start_write(). The ufs_fhtovp issue breaks NFS exporting of
ext2fs filesystems; I believe the other is harmless.

Fix both cases by checking um_i_effnlink_valid in the ufsmount
struct, and use i_nlink if necessary.

Noticed by:	bde
Reviewed by:	mckusick, bde
This commit is contained in:
Ian Dowse 2001-07-29 22:26:01 +00:00
parent d35bce02ee
commit 9e27954de1
2 changed files with 5 additions and 2 deletions

View File

@ -207,7 +207,8 @@ ufs_fhtovp(mp, ufhp, vpp)
ip = VTOI(nvp);
if (ip->i_mode == 0 ||
ip->i_gen != ufhp->ufid_gen ||
ip->i_effnlink <= 0) {
(VFSTOUFS(mp)->um_i_effnlink_valid ? ip->i_effnlink :
ip->i_nlink) <= 0) {
vput(nvp);
*vpp = NULLVP;
return (ESTALE);

View File

@ -311,7 +311,9 @@ ufs_close(ap)
* XXX - EAGAIN is returned to prevent vn_close from
* repeating the vrele operation.
*/
if (vp->v_type == VREG && VTOI(vp)->i_effnlink == 0) {
if (vp->v_type == VREG &&
(VFSTOUFS(vp->v_mount)->um_i_effnlink_valid ?
VTOI(vp)->i_effnlink : VTOI(vp)->i_nlink) == 0) {
(void) vn_start_write(vp, &mp, V_WAIT);
vrele(vp);
vn_finished_write(mp);