Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp88030imm; Thu, 2 Aug 2018 14:31:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe3g6HSocer/ya0a8zacOnAUkpbZPHX7/DAXmhPqqLp3QyE1xmMHhBdi5bNR0gmVrsSXNlg X-Received: by 2002:a62:4255:: with SMTP id p82-v6mr1253225pfa.238.1533245497750; Thu, 02 Aug 2018 14:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533245497; cv=none; d=google.com; s=arc-20160816; b=LHxW5TFJAvuCLrWjKa4l/ODgyGdwEqtz/mECnhQtOvRvr1x5iVtpdNXOBMp9VQ8arf nNJH2XjbsCdbEBQEBQ1OQ2AKndLpVfAR2k+59trDsDXsHQFc8HqMCnp+mmUrHrnI9kyc BOllBxNZ6mAi6pLKnqsfJaFxIZq/QyF1JXZyUPAA6z94N2mlfBwqFbG+u/1Jbq+OPFWF LAQK47FykvRpWFa92A/pyf4fYBBpghjtZ599B2Ua1HGEdyxWTqvvp0IBs0JL63nlNmZq bGnM1YdmRleNIkPiI3LogryByJ458e1rLqyCNUiPAWdY70CwZSNbN5f5inK4BcO/O4Cx wYjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=qYuO4OdnzFDUmgnCligEPIcWsKjW4M+xs2uXqx1SzwM=; b=SSLbgTm3KzsSZb8uYqdoNBsa+IsNyibh17zYFg+7ueFI7mvbO1GwMTo7mWV8DKyJsE FweWKoqvNj4tjxGxlnj2tqeWFTcsglTB+zLSF6TQgXS/VX4ZeK4dzNWHTm9k7uKRuKaw fUoD1zy0+Mb5YfXgW4brtdgihCoCYYqp+trycxboV41lVFUhGvloMfuacyW1qsxhEfWl CM9+TsRt+9C/gn00YE68OsuEwGifP3z16ZFW+fr9w5+mTbOei8Dhnu6SdWI5DJKh+lwi 79rErFMRhjCYehs93qjVEInSHsBhgSIZ/3nYzsvMrWbinWzdDq3gFWc89HeiGQ/P/7KK ao0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c4-v6si2943853pfd.344.2018.08.02.14.31.22; Thu, 02 Aug 2018 14:31:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732397AbeHBXW1 (ORCPT + 99 others); Thu, 2 Aug 2018 19:22:27 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:41672 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727260AbeHBXW0 (ORCPT ); Thu, 2 Aug 2018 19:22:26 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1flL9v-0000bS-Kq; Thu, 02 Aug 2018 21:29:23 +0000 Date: Thu, 2 Aug 2018 22:29:23 +0100 From: Al Viro To: Alan Jenkins Cc: David Howells , linux-api@vger.kernel.org, torvalds@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/33] vfs: syscall: Add open_tree(2) to reference or clone a mount [ver #11] Message-ID: <20180802212923.GA30522@ZenIV.linux.org.uk> References: <153313703562.13253.5766498657900728120.stgit@warthog.procyon.org.uk> <153313705165.13253.4602180607294286849.stgit@warthog.procyon.org.uk> <7a292a44-7e17-572b-2d1e-0085ef400010@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7a292a44-7e17-572b-2d1e-0085ef400010@gmail.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 02, 2018 at 06:31:06PM +0100, Alan Jenkins wrote: > Hi > > I found this interesting, though I don't entirely follow the kernel > mount/unmount code.? I had one puzzle about the code, and two questions > which I was largely able to answer. > > On 01/08/18 16:24, David Howells wrote: > > +void dissolve_on_fput(struct vfsmount *mnt) > > +{ > > + namespace_lock(); > > + lock_mount_hash(); > > + mntget(mnt); > > + umount_tree(real_mount(mnt), UMOUNT_SYNC); > > + unlock_mount_hash(); > > + namespace_unlock(); > > +} > > Can I ask why? UMOUNT_SYNC is used here?? I feel like I must have missed > something, but doesn't it skip the IS_MNT_LOCKED() check in > disconnect_mount() ? > > UMOUNT_SYNC seems used for non-lazy unmounts, and in internal cleanups where > userspace wouldn't be able to see.? But I think userspace can keep watching > in this case, e.g. by `fd2 = openat(fd, ".", O_PATH)` (or `fd2 = > open_tree(fd, ".", 0)` ?).? I would think this function should avoid using > UMOUNT_SYNC, like lazy unmount avoids it. FWIW, I suspect that UMOUNT_CONNECTED might be the right thing here...