Quick fix for breakage of ext2fs link counts as reported by stat(2) by

the soft updates changes: only report the link count to be i_effnlink
in ufs_getattr() for file systems that maintain i_effnlink.

Tested by:	Mike Dracopoulos <mdraco@math.uoa.gr>
This commit is contained in:
Bruce Evans 1999-11-03 12:05:39 +00:00
parent fc29213506
commit 5bd5c8b9e5
5 changed files with 6 additions and 1 deletions

View File

@ -95,6 +95,7 @@ struct ufsmount {
struct netexport um_export; /* export information */
int64_t um_savedmaxfilesize; /* XXX - limit maxfilesize */
struct malloc_type *um_malloctype; /* The inodes malloctype */
int um_i_effnlink_valid; /* i_effnlink valid? */
int (*um_blkatoff) __P((struct vnode *, off_t, char **, struct buf **));
int (*um_truncate) __P((struct vnode *, off_t, int, struct ucred *, struct proc *));
int (*um_update) __P((struct vnode *, int));

View File

@ -95,6 +95,7 @@ struct ufsmount {
struct netexport um_export; /* export information */
int64_t um_savedmaxfilesize; /* XXX - limit maxfilesize */
struct malloc_type *um_malloctype; /* The inodes malloctype */
int um_i_effnlink_valid; /* i_effnlink valid? */
int (*um_blkatoff) __P((struct vnode *, off_t, char **, struct buf **));
int (*um_truncate) __P((struct vnode *, off_t, int, struct ucred *, struct proc *));
int (*um_update) __P((struct vnode *, int));

View File

@ -648,6 +648,7 @@ ffs_mountfs(devvp, mp, p, malloctype)
ump = malloc(sizeof *ump, M_UFSMNT, M_WAITOK);
bzero((caddr_t)ump, sizeof *ump);
ump->um_malloctype = malloctype;
ump->um_i_effnlink_valid = 1;
ump->um_fs = malloc((u_long)fs->fs_sbsize, M_UFSMNT,
M_WAITOK);
ump->um_blkatoff = ffs_blkatoff;

View File

@ -388,7 +388,8 @@ ufs_getattr(ap)
vap->va_fsid = dev2udev(ip->i_dev);
vap->va_fileid = ip->i_number;
vap->va_mode = ip->i_mode & ~IFMT;
vap->va_nlink = ip->i_effnlink;
vap->va_nlink = VFSTOUFS(vp->v_mount)->um_i_effnlink_valid ?
ip->i_effnlink : ip->i_nlink;
vap->va_uid = ip->i_uid;
vap->va_gid = ip->i_gid;
vap->va_rdev = ip->i_rdev;

View File

@ -95,6 +95,7 @@ struct ufsmount {
struct netexport um_export; /* export information */
int64_t um_savedmaxfilesize; /* XXX - limit maxfilesize */
struct malloc_type *um_malloctype; /* The inodes malloctype */
int um_i_effnlink_valid; /* i_effnlink valid? */
int (*um_blkatoff) __P((struct vnode *, off_t, char **, struct buf **));
int (*um_truncate) __P((struct vnode *, off_t, int, struct ucred *, struct proc *));
int (*um_update) __P((struct vnode *, int));