diff options
author | pjd <pjd@FreeBSD.org> | 2009-11-10 22:27:33 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2009-11-10 22:27:33 +0000 |
commit | f1f071c4cabc50768c5ae3684ef12bbdfe10b117 (patch) | |
tree | 906e414c850eae656fffbbf430bc02bba5f55ad4 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c | |
parent | 2ddc47c4fb2f99ae402613fc0eae23355bb69ee6 (diff) | |
download | FreeBSD-src-f1f071c4cabc50768c5ae3684ef12bbdfe10b117.zip FreeBSD-src-f1f071c4cabc50768c5ae3684ef12bbdfe10b117.tar.gz |
Be careful which vattr fields are set during setattr replay.
Without this fix strange things can appear after unclean shutdown like
files with mode set to 07777.
Reported by: des
MFC after: 3 days
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c index 573a82c..658e539 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c @@ -60,10 +60,14 @@ zfs_init_vattr(vattr_t *vap, uint64_t mask, uint64_t mode, { VATTR_NULL(vap); vap->va_mask = (uint_t)mask; - vap->va_type = IFTOVT(mode); - vap->va_mode = mode & MODEMASK; - vap->va_uid = (uid_t)(IS_EPHEMERAL(uid)) ? -1 : uid; - vap->va_gid = (gid_t)(IS_EPHEMERAL(gid)) ? -1 : gid; + if (mask & AT_TYPE) + vap->va_type = IFTOVT(mode); + if (mask & AT_MODE) + vap->va_mode = mode & MODEMASK; + if (mask & AT_UID) + vap->va_uid = (uid_t)(IS_EPHEMERAL(uid)) ? -1 : uid; + if (mask & AT_GID) + vap->va_gid = (gid_t)(IS_EPHEMERAL(gid)) ? -1 : gid; vap->va_rdev = zfs_cmpldev(rdev); vap->va_nodeid = nodeid; } |