From owner-freebsd-current@FreeBSD.ORG Thu Aug 9 17:45:11 2007 Return-Path: Delivered-To: FreeBSD-CURRENT@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D72F516A417 for ; Thu, 9 Aug 2007 17:45:11 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (arm132.internetdsl.tpnet.pl [83.17.198.132]) by mx1.freebsd.org (Postfix) with ESMTP id 6F13813C45A for ; Thu, 9 Aug 2007 17:45:07 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id A020C45B26; Thu, 9 Aug 2007 19:45:04 +0200 (CEST) Received: from localhost (154.81.datacomsa.pl [195.34.81.154]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 94E7945684; Thu, 9 Aug 2007 19:44:56 +0200 (CEST) Date: Thu, 9 Aug 2007 19:44:10 +0200 From: Pawel Jakub Dawidek To: Scot Hetzel Message-ID: <20070809174410.GA9454@garage.freebsd.pl> References: <790a9fff0708091007h48cb5133t16638a24076795f8@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="AhhlLboLdkugWU4S" Content-Disposition: inline In-Reply-To: <790a9fff0708091007h48cb5133t16638a24076795f8@mail.gmail.com> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 7.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00 autolearn=ham version=3.0.4 Cc: FreeBSD-CURRENT@freebsd.org Subject: Re: mount gets into a state where it won't set/unset ZFS properties (atime, exec, setuid) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Aug 2007 17:45:12 -0000 --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 09, 2007 at 12:07:08PM -0500, Scot Hetzel wrote: > While checking out a problem with mount unsetting noatime on a UFS > system, I tested mount with both a UFS and ZFS filesystems. The ZFS > filesystem had several problems: >=20 > hp010# uname -a > FreeBSD hp010.hetzel.org 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Wed Aug > 8 10:38:34 CDT 2007 > root@hp010.hetzel.org:/usr/src/7x/sys/amd64/compile/GENERIC.debug > amd64 >=20 > hp010# umount /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault >=20 > hp010# zfs mount -a > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local) >=20 > hp010# mount -u -o noexec,nosuid /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec off tem= porary > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, > noexec, nosuid) >=20 > Why doesn't the setuid property change to 'temporary' for > rootpool/usr/ports/distfiles? >=20 > hp010# mount -u -o exec,suid /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec off tem= porary > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, > noexec, nosuid) >=20 > mount can't get rid of these options. >=20 > hp010# mount -u -o noatime /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime off tem= porary > rootpool/usr/ports/distfiles exec off tem= porary > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, > noatime, noexec, nosuid) >=20 > hp010# mount -u -o atime /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime off tem= porary > rootpool/usr/ports/distfiles exec off tem= porary > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, > noatime, noexec, nosuid) >=20 > Same problem with getting rid of noatime. I would have expected mount > to be able to be able to change the zfs properties of atime, exec back > to on. >=20 > hp010# zfs inherit -r atime rootpool/usr/ports/distfiles > hp010# zfs inherit -r exec rootpool/usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, nosuid) >=20 >=20 > hp010# zfs set setuid=3Doff rootpool/usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid off loc= al > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, nosuid) >=20 > hp010# zfs inherit -r setuid rootpool/usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local) >=20 > We have now set everything back to the default mount options using 'zfs i= nherit' >=20 > hp010# mount -u -o noatime,noexec,nosuid /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, nosuid) >=20 > Now mount can't set noatime or noexec. >=20 > hp010# zfs inherit -r setuid rootpool/usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local) >=20 > Back to the defaults again. >=20 > This last part gets a bit strange, without umounting > /usr/ports/distfiles, I tried the following: >=20 > hp010# mount -u -o nosuid /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, nosuid) > hp010# zfs set setuid=3Doff rootpool/usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid off loc= al > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, nosuid) > hp010# zfs inherit -r setuid rootpool/usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local) > hp010# mount -u -o noatime,noexec,nosuid /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec off tem= porary > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, > noexec, nosuid) > hp010# zfs inherit -r setuid rootpool/usr/ports/distfiles > hp010# zfs inherit -r exec rootpool/usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local) > hp010# mount -u -o noatime,noexec,nosuid /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec off tem= porary > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, > noexec, nosuid) >=20 > It won't set noatime when noexec and nosuid are specified. >=20 > hp010# mount -u -o noatime /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, nosuid) >=20 > Now it removed noexec, and didn't set noatime. >=20 > hp010# zfs inherit -r setuid rootpool/usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local) >=20 > Lets try setting noatime again: >=20 > hp010# mount -u -o noatime /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, nosuid) >=20 > mount shows nosuid. Lets unset if with zfs inherit: >=20 > hp010# zfs inherit -r setuid rootpool/usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local) >=20 > nosuid is gone, lets see if we can now set noatime: >=20 > hp010# mount -u -o noatime /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, nosuid) >=20 > Again mount is showing nosuid: >=20 > hp010# mount -u -o nonoatime /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, nosuid) > hp010# mount -u -o nonosuid /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, nosuid) >=20 > Try nonoatime and nonosuid, but mount still showing nosuid. Using zfs > inherit gets rid of nosuid: >=20 > hp010# zfs inherit -r setuid rootpool/usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local) >=20 > Give up, and umount the filesystem: >=20 > hp010# umount /usr/ports/distfiles > hp010# zfs mount -a > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local) > hp010# mount -u -o noatime /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime off tem= porary > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, noatime) >=20 > We can now set noatime, try nonoatime to unset it: >=20 > hp010# mount -u -o nonoatime /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime off tem= porary > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, noatime) >=20 > That didn't work, does atime work: >=20 > hp010# mount -u -o atime /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime off tem= porary > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local, noatime) >=20 > Reset atime to defaults with zfs inherit: >=20 > hp010# zfs inherit -r atime rootpool/usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local) >=20 > Does nonoatime have any side efects now: >=20 > hp010# mount -u -o nonoatime /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local) >=20 > No side effect, lets try setting noatime: >=20 > hp010# mount -u -o noatime /usr/ports/distfiles > hp010# zfs get atime,exec,setuid rootpool/usr/ports/distfiles ; mount > | grep distfiles > NAME PROPERTY VALUE SOU= RCE > rootpool/usr/ports/distfiles atime on def= ault > rootpool/usr/ports/distfiles exec on def= ault > rootpool/usr/ports/distfiles setuid on def= ault > rootpool/usr/ports/distfiles on /usr/ports/distfiles (zfs, local) > hp010# >=20 > Now mount can't set noatime. Could you file a PR for this? The code responsible for mount options handling changed recently in ZFS, but I don't think I'll be able to integrate it before 7.0-RELEASE. --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --AhhlLboLdkugWU4S Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFGu1JqForvXbEpPzQRAiefAKDEOsUjfKTp2A08x4HzK8jiJlrGOgCfajNk vL1V4Ly1vzllwUgkfOm/Wiw= =rsjA -----END PGP SIGNATURE----- --AhhlLboLdkugWU4S--