diff options
author | iedowse <iedowse@FreeBSD.org> | 2001-07-29 22:26:01 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2001-07-29 22:26:01 +0000 |
commit | c768482a0f02d74c5397ba0b2e9fc556bd7d289d (patch) | |
tree | 38cb2bcd11268222398b77f5dc0c1c450d40894d /sys/ufs | |
parent | b7e79511f87b41dc8e5c1f8b21568e09e240eeab (diff) | |
download | FreeBSD-src-c768482a0f02d74c5397ba0b2e9fc556bd7d289d.zip FreeBSD-src-c768482a0f02d74c5397ba0b2e9fc556bd7d289d.tar.gz |
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
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_vfsops.c | 3 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c index 6b8905b..1fcd530 100644 --- a/sys/ufs/ufs/ufs_vfsops.c +++ b/sys/ufs/ufs/ufs_vfsops.c @@ -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); diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index ea871b6..a095798 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -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); |