Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Nov 2009 22:27:33 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r199157 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <200911102227.nAAMRXTf073603@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Tue Nov 10 22:27:33 2009
New Revision: 199157
URL: http://svn.freebsd.org/changeset/base/199157

Log:
  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

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c	Tue Nov 10 22:25:46 2009	(r199156)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c	Tue Nov 10 22:27:33 2009	(r199157)
@@ -60,10 +60,14 @@ zfs_init_vattr(vattr_t *vap, uint64_t ma
 {
 	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;
 }



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