From owner-freebsd-fs@freebsd.org Fri Sep 15 11:00:38 2017 Return-Path: Delivered-To: freebsd-fs@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 E806BE0E2AD; Fri, 15 Sep 2017 11:00:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8EB9E3131; Fri, 15 Sep 2017 11:00:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v8FB0XC3072038 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 15 Sep 2017 14:00:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v8FB0XC3072038 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v8FB0XmQ072037; Fri, 15 Sep 2017 14:00:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 15 Sep 2017 14:00:33 +0300 From: Konstantin Belousov To: Edward Napierala Cc: Kirk McKusick , freebsd-fs , Andriy Gapon , "freebsd-arch@freebsd.org" Subject: Re: mount / unmount and mountcheckdirs() Message-ID: <20170915110033.GO78693@kib.kiev.ua> References: <134c7c6e-f4f1-ef38-cc50-0e56c27c9fb8@FreeBSD.org> <201709150314.v8F3Ea6B085072@chez.mckusick.com> <20170915092001.GK78693@kib.kiev.ua> <20170915103037.GM78693@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.0 (2017-09-02) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 11:00:39 -0000 On Fri, Sep 15, 2017 at 11:49:17AM +0100, Edward Napierala wrote: > 2017-09-15 11:30 GMT+01:00 Konstantin Belousov : > > > On Fri, Sep 15, 2017 at 11:08:31AM +0100, Edward Napierala wrote: > > > 2017-09-15 10:20 GMT+01:00 Konstantin Belousov : > > > > I believe that the current autofs does not allow a process to get into > > > > this situation at all. > > > > > > > > > > It does. For example: > > > > > > [trasz@v2:~]% cd /media/md0 > > > [trasz@v2:/media/md0]% mount > > > /dev/ada0s1a on / (ufs, local, noatime, journaled soft-updates) > > > devfs on /dev (devfs, local, multilabel) > > > map -hosts on /net (autofs) > > > map -media on /media (autofs) > > > [trasz@v2:/media/md0]% ls > > > [trasz@v2:/media/md0]% mount > > > /dev/ada0s1a on / (ufs, local, noatime, journaled soft-updates) > > > devfs on /dev (devfs, local, multilabel) > > > map -hosts on /net (autofs) > > > map -media on /media (autofs) > > > /dev/md0 on /media/md0 (ufs, local, noatime, nosuid, automounted) > > > > > > Getting rid of mountcheckdirs() in the unmount path should be fine, I > > think. > > How the example proves that mountcheckdirs() can be removed ? > > > In the unmount path? It doesn't; I just don't think autofs would be > affected, > since having a current working directory in a mountpoint prevents the > unmount > (unless it's forced). > > In the mount path? See below. > > > > How can > > we see which directory content was printed by ls, the covered or mounted ? > > > > Well, it would be pretty useless if you got the covered directory. This is exactly what is being discussed. > But ok, here's > a better example, one that actually shows that: > > [trasz@v2:/media/md0]% mount > /dev/ada0s1a on / (ufs, local, noatime, journaled soft-updates) > devfs on /dev (devfs, local, multilabel) > map -hosts on /net (autofs) > map -media on /media (autofs) > [trasz@v2:/media/md0]% ls -al > total 9 > drwxr-xr-x 3 root wheel 512 Sep 10 10:16 . > drwxr-xr-x 3 root wheel 512 Sep 8 11:42 .. > drwxrwxr-x 2 root operator 512 Sep 10 10:16 .snap > [trasz@v2:/media/md0]% mount > /dev/ada0s1a on / (ufs, local, noatime, journaled soft-updates) > devfs on /dev (devfs, local, multilabel) > map -hosts on /net (autofs) > map -media on /media (autofs) > /dev/md0 on /media/md0 (ufs, local, noatime, nosuid, automounted) > > Notice the .snap/ directory; it's an empty UFS filesystem. And the .snap is from the /dev/md0 volume, right ? If yes, then this demonstration indeed proves that autofs behaves as intended on mount.