From owner-freebsd-stable@FreeBSD.ORG Sun Feb 26 18:48:48 2012 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17E3A106564A for ; Sun, 26 Feb 2012 18:48:48 +0000 (UTC) (envelope-from kob6558@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8C8168FC0A for ; Sun, 26 Feb 2012 18:48:46 +0000 (UTC) Received: by werl4 with SMTP id l4so239008wer.13 for ; Sun, 26 Feb 2012 10:48:45 -0800 (PST) Received-SPF: pass (google.com: domain of kob6558@gmail.com designates 10.180.99.7 as permitted sender) client-ip=10.180.99.7; Authentication-Results: mr.google.com; spf=pass (google.com: domain of kob6558@gmail.com designates 10.180.99.7 as permitted sender) smtp.mail=kob6558@gmail.com; dkim=pass header.i=kob6558@gmail.com Received: from mr.google.com ([10.180.99.7]) by 10.180.99.7 with SMTP id em7mr21665557wib.7.1330282125675 (num_hops = 1); Sun, 26 Feb 2012 10:48:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=0UYRrPNN+iUZbhKq3xi5h0g1ajYK2/yEY4CYKcFvNdA=; b=s0i+m4OW+mAM4uxE1l7qHWYpa064ys1g0cW8J6BxdDcN143OndSlMLt5O2fDksmxfw uzpH8M4PbjC4w9NzCDjMnF6o+z/j3XvYEnvooEvslga191iau3xn0vhr7OIotU1mw1B+ NJmyqaSlTGO08UjVgq7YkxEIHrhpwD9MndJ0U= MIME-Version: 1.0 Received: by 10.180.99.7 with SMTP id em7mr17273693wib.7.1330282125574; Sun, 26 Feb 2012 10:48:45 -0800 (PST) Received: by 10.223.16.82 with HTTP; Sun, 26 Feb 2012 10:48:45 -0800 (PST) In-Reply-To: <20120226203949.H89643@sola.nimnet.asn.au> References: <4F3EE186.4020801@gmail.com> <201202181409.08859.hselasky@c2i.net> <20120226203949.H89643@sola.nimnet.asn.au> Date: Sun, 26 Feb 2012 10:48:45 -0800 Message-ID: From: Kevin Oberman To: Ian Smith Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: vermaden , freebsd-stable@freebsd.org, lars.engels@0x20.net, Hans Petter Selasky Subject: Re: devd based AUTOMOUNTER X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Feb 2012 18:48:48 -0000 On Sun, Feb 26, 2012 at 2:18 AM, Ian Smith wrote: > Ccs mightily trimmed to avoid not-subscribed bounces; readd as desired: > > On Mon, 20 Feb 2012 09:43:59 +0100, vermaden wrote: > =A0> To: freebsd-hackers@freebsd.org > =A0> Cc: matt , gleb.kurtsou@gmail.com, > =A0> =A0 =A0 freebsd-stable@freebsd.org, uffe@uffe.org, joe.culler@gmail.= com, > =A0> =A0 =A0 Hans Petter Selasky , freebsd-current@free= bsd.org, > =A0> =A0 =A0 lars.engels@0x20.net > =A0> > =A0> Hi, > =A0> > =A0> new version with new features (and BUGs ;p) > [..] > > Well, I was busy composing this reply a few days ago when this system > was taken out by a very near lightning strike .. losing the ADSL modem > (blown into 4 pieces scattered about the room :), 2 scorched switches, > the old xe pccard interface feeding the ADSL (its dongle also blown into > several pieces), and a good deal of travelling - I was 80km remote at > the time - but very fortunately not the server box itself .. close call! Wow! Glad you were 80 km away. At least you were not blown into 4 pieces! > =A0> Added 'noatime' as a default mount option when possible. > > Good idea for many use cases, but could that be optional? Please make this optional. I have one volume where I depend on atime for regular operations. Of course, I can deal with this myself, but atime is default for a reason, even though its overhead and frequent lack of use makes me question that, as well. > [..] > =A0> Added config file to be used from /usr/local/etc/automount.conf file= , possible options are (these are defaults): > =A0> =A0 MNTPREFIX=3D"/media" > =A0> =A0 LOG=3D"/var/log/automount.log" > =A0> =A0 STATE=3D"/var/run/automount.state" > =A0> =A0 ENCODING=3D"en_US.ISO8859-1" > =A0> =A0 CODEPAGE=3D"cp437" > =A0> =A0 DATEFMT=3D"%Y-%m-%d %H:%M:%S" > =A0> =A0 USERUMOUNT=3D"NO" > =A0> > =A0> Mine config currently has only these: > =A0> =A0 ENCODING=3D"pl_PL.ISO8859-2" > =A0> =A0 CODEPAGE=3D"cp852" > =A0> =A0 USERUMOUNT=3D"YES" > =A0> > =A0> The USERMOUNT otions if set to YES (default to NO) will 'chmod +s /s= bin/umount', > =A0> so You can click the ^ button on the devices list in NAUTILUS. > > Someone might explain why I needn't feel a bit uncomfortable about that > chmod, even though it is optional, and even though I've been guilty > myself of a 'chown root:nobody /sbin/tc' on a linux firewall box .. policykit does the same sort of thing in gnome, but it is VERY fine grained. It can limit unmounting to certain devices while this give any user the ability to do `umount \usr'. Rather frightening as a default. Of course, most desktop systems are single user. And it is only efective if the system has USERMOUNT enabled. > > =A0> These newly mounted devices appear on NAUTILUS sidebar (only with /m= edia prefix). > > I wonder how it goes with KDE4? (still 3.5 here, which wouldn't count) > > [..] > =A0> /usr/local/sbin/automount.sh > =A0> --------------------------------------------------------------------= ----------- > [..] > =A0> [ "${USERUMOUNT}" =3D "YES" ] && chmod u+s /sbin/umount # /* WHEEL g= roup member */ > =A0> > =A0> __create_mount_point() { # /* 1=3DDEV */ > =A0> =A0 MNT=3D"${MNTPREFIX}/$( basename ${1} )" > =A0> =A0 mkdir -p ${MNT} > =A0> =A0 chown 1000 ${MNT} > =A0> } > > Er, who's user 1000 ? =A0Another config item perhaps? =A0Or should that b= e > the particular user currently invoking the script via devd (if that can > be determined?)? =A0Also, are you using sysctl vfs.usermount=3D1 ? > > =A0> case ${2} in > =A0> =A0 (attach) > =A0> =A0 =A0 for I in /dev/${1}* > =A0> =A0 =A0 do > [..] > =A0> =A0 =A0 =A0 =A0 (*Unix\ Fast\ File*) > =A0> =A0 =A0 =A0 =A0 =A0 __create_mount_point ${I} > =A0> =A0 =A0 =A0 =A0 =A0 fsck_ufs -y ${I} > > Mmm, fsck on every attachment? =A0Maybe running fsck should be optional? > We might be attaching, perhaps, a 2TB backup HD? .. Ouch! I agree. Why not just fsck_ufs -p. (I realize this is done to fix systems that were unplugged rather than umounted, but it's a pretty expensive operation when not needed. > > =A0> =A0 =A0 =A0 =A0 =A0 __check_already_mounted ${MNT} > =A0> =A0 =A0 =A0 =A0 =A0 mount -o noatime ${I} ${MNT} > > Again, I'd rather see that optional in an intended system tool, although > it's an option I'd tend to use myself. > > =A0> =A0 =A0 =A0 =A0 =A0 __log "${I}:mount (ufs)" > =A0> =A0 =A0 =A0 =A0 =A0 ;; > [..] > =A0> =A0 (detach) > =A0> =A0 =A0 MOUNT=3D$( mount ) > =A0> =A0 =A0 __state_lock > =A0> =A0 =A0 grep ${1} ${STATE} \ > =A0> =A0 =A0 =A0 | while read DEV PROVIDER MNT > =A0> =A0 =A0 =A0 =A0 do > =A0> =A0 =A0 =A0 =A0 =A0 TARGET=3D$( echo "${MOUNT}" | grep -E "^${PROVID= ER} " | awk '{print $3}' ) > =A0> =A0 =A0 =A0 =A0 =A0 [ -z ${TARGET} ] && { > =A0> =A0 =A0 =A0 =A0 =A0 =A0 __state_remove ${MNT} ${STATE} ${LINE} > =A0> =A0 =A0 =A0 =A0 =A0 =A0 continue > =A0> =A0 =A0 =A0 =A0 =A0 } > =A0> =A0 =A0 =A0 =A0 =A0 umount -f ${TARGET} & > =A0> =A0 =A0 =A0 =A0 =A0 unset TARGET > =A0> =A0 =A0 =A0 =A0 =A0 __state_remove ${MNT} ${STATE} ${LINE} > =A0> =A0 =A0 =A0 =A0 =A0 __log "${DEV}:umount" > =A0> =A0 =A0 =A0 =A0 done > =A0> =A0 =A0 __state_unlock > =A0> =A0 =A0 __log "/dev/${1}:detach" > =A0> =A0 =A0 find ${MNTPREFIX} -type d -empty -delete > > I don't see the need to remove all empty subdirs of, say, /media - this > tool may not be the only thing wanting to manage that space? =A0Removing > directories that were added by this tool itself makes sense of course. This is an interesting one. Gnome and hald have a problem here that have caused me to add sudo /bin/rmdir /media/* to.xinitrc to work around. It's just too easy for 'junk' directories to live on when the system does not exit everything cleanly and, while hald tries to keep track, it is very hard to do in the real world. I suspect it is really needed. And what else is creating directories in /media? -- R. Kevin Oberman, Network Engineer E-mail: kob6558@gmail.com