Date: Wed, 28 Nov 2007 21:59:29 GMT From: "mark thompson <"<info-gentoo@mark.thompson.bz> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/118320: [patch] NFS SETATTR sometimes fails to set file mode on ZFS partition Message-ID: <200711282159.lASLxTbZ008201@www.freebsd.org> Resent-Message-ID: <200711282200.lASM077v010870@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 118320 >Category: kern >Synopsis: [patch] NFS SETATTR sometimes fails to set file mode on ZFS partition >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Nov 28 22:00:07 UTC 2007 >Closed-Date: >Last-Modified: >Originator: mark thompson >Release: 7.0 BETA 3 >Organization: tgsoft.com >Environment: FreeBSD moose.tgsoft.com 7.0-BETA3 FreeBSD 7.0-BETA3 #6: Wed Nov 28 13:24:23 PST 2007 mark@moose.tgsoft.com:/usr/obj/usr/src/sys/ASUS amd64 >Description: ZFS partition exported with NFS, using a MacOS X (Tiger) client. Finder has problems creating files (they are created, but have a mode of zero, so cannot be opened). Trace shows that an NFS SETATTR call that should set uid, gid, and mode fails to set the mode. Similar trace on a UFS partition works as expected. Examination shows that secpolicy_vnode_setattr is smashing the mode argument. Attached patch to zfs_setattr saves and restores the argument in this one case. >How-To-Repeat: NFS export ZFS partition, import on MacOS X. Try to drag a file into the folder on the imported drive using the Finder. In some cases, it will fail. >Fix: In /usr/src/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c: *** zfs_vnops.c-orig Wed Nov 28 09:20:23 2007 --- zfs_vnops.c Wed Nov 28 13:39:07 2007 *************** *** 2080,2085 **** --- 2080,2086 ---- vattr_t oldva; uint_t mask = vap->va_mask; uint_t saved_mask; + uint64_t saved_mode; int trim_mask = 0; uint64_t new_mode; znode_t *attrzp; *************** *** 2214,2219 **** --- 2215,2221 ---- if (trim_mask) { saved_mask = vap->va_mask; + saved_mode = vap->va_mode; /* secpolicy.. smashes */ vap->va_mask &= ~trim_mask; } *************** *** 2224,2231 **** return (err); } ! if (trim_mask) vap->va_mask |= saved_mask; } /* --- 2226,2236 ---- return (err); } ! if (trim_mask) { vap->va_mask |= saved_mask; + if (trim_mask & AT_MODE) + vap->va_mode = saved_mode; + } } /* >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711282159.lASLxTbZ008201>