From owner-freebsd-hackers@freebsd.org Tue Feb 16 10:01:14 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5004AA9FF6 for ; Tue, 16 Feb 2016 10:01:14 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id A997315E3 for ; Tue, 16 Feb 2016 10:01:14 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: by mailman.ysv.freebsd.org (Postfix) id A9119AA9FF5; Tue, 16 Feb 2016 10:01:14 +0000 (UTC) Delivered-To: hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A89ADAA9FF4 for ; Tue, 16 Feb 2016 10:01:14 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.116.210]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1EEE815E1; Tue, 16 Feb 2016 10:01:14 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from chamsa.cs.huji.ac.il ([132.65.80.19]) by kabab.cs.huji.ac.il with esmtp id 1aVcRH-000DqX-HB; Tue, 16 Feb 2016 12:00:59 +0200 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: autofs problem From: Daniel Braniss In-Reply-To: <20160215214159.GA6160@brick.home> Date: Tue, 16 Feb 2016 12:00:59 +0200 Cc: "hackers@freebsd.org" Message-Id: <6FFA90F6-7870-40B6-8BDE-281B899B62D7@cs.huji.ac.il> References: <39973B1A-BBB9-4CB7-B352-A42C14B61E0F@cs.huji.ac.il> <20160215214159.GA6160@brick.home> To: =?utf-8?Q?Edward_Tomasz_Napiera=C5=82a?= X-Mailer: Apple Mail (2.2104) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Feb 2016 10:01:15 -0000 > On 15 Feb 2016, at 23:41, Edward Tomasz Napiera=C5=82a = wrote: >=20 > On 0214T1655, Daniel Braniss wrote: >> Hi, >> I=E2=80=99m converting our (very) old am-utils maps to use the new = autofs, >> so I wrote a python script that queries the am-utils map, and = =E2=80=98generates=E2=80=99 >> one that autofs likes. >> so autofs_master has: >> =E2=80=A6 >> /cs auto_cs >>=20 >> auto_cs is a python script and is executable. >>=20 >> at the moment I=E2=80=99m stuck with what am-utils type=3Dlink >> so I=E2=80=99m using -fstype=3Dnullfs :/cs/some-path, but before this = can work I need >> to trigger autofs with the /cs/some-path, so before the script = returns I do a >> os.stat('/cs/some-path') >> but this returns an error, mainly because it is not caught by autofs! >> doing the same in the command line works, and later the nullfs too, = (i=E2=80=99m afraid >> of what the auto unmount will do later, but that=E2=80=99s another = issue) >>=20 >> is this by design? or is there some better way? >=20 > It's by design - basically, autofs(4) has code to explicitly disable = triggering > by anything running with the same SID (session id) as the = automountd(8). This > is to prevent some obvious (and some less than obvious and quite hard = to debug) > deadlocks. Thus, any script ran by automountd(8) works as if the = autofs mounts > "weren't there". >=20 > You might be able to work around this by somehow calling setsid() from > the Python script before triggering. bingo!, that did it thanks, danny