Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet/dist/uts/common/fs/zfs Fix problem in ZF...



details:   https://anonhg.NetBSD.org/src/rev/b9d47cc5750d
branches:  trunk
changeset: 750662:b9d47cc5750d
user:      haad <haad%NetBSD.org@localhost>
date:      Sun Jan 10 01:35:39 2010 +0000

description:
Fix problem in ZFS ZIL layer where unclean shutdown of filesystem can change
replayed file permissions to 777. Patch from FreeBSD. Original commit message:

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.

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (22 lines):

diff -r 041080240577 -r b9d47cc5750d external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c   Sun Jan 10 01:10:16 2010 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_replay.c   Sun Jan 10 01:35:39 2010 +0000
@@ -60,10 +60,14 @@
 {
        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;
 }



Home | Main Index | Thread Index | Old Index