Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1195166imm; Wed, 17 Oct 2018 15:15:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV619fOw2dOWXmlSNF3KRwwVnL+o/xhOIvS5DkK73mZWnDCYDkBsmtEYroNLefheWoArnjpnc X-Received: by 2002:a62:4b09:: with SMTP id y9-v6mr28085481pfa.93.1539814501127; Wed, 17 Oct 2018 15:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539814501; cv=none; d=google.com; s=arc-20160816; b=qTWkyJKGw7WG7VSZMNzLcQ8VCcFDIooiWl/YaPFApn6z0y+5fFmu94jn+EcW2aYfKd Vi/3VOccpnEeCAvDyVqcp17c06pmsz/jEri44pe27nFMUvp+yONUJymrlGDnpL77y6lr 8cXaYjiHVIkxG91mawA+3kJ6TFVLMej12EPXWAUqUTLhQka+KcoAgUGyxY1lErNHlXhV kO/iP0m9vC5PKoPkanGAVJ1VWGMJog3NQqF1Xv4rNhAU6nySGxK0MjXPEQQBPzFbXfCL GGUST1SL6M/1kQsS5LTZ1j7sgd6CoN6SxPAAkiPYOVhZPS0FOQNuBzmdLZCe0SXyBnKO Yz0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from:dkim-signature; bh=z1nZgFuSAWF4xak9H7pvf35PBoIZxIEAvPRBU2/+bmg=; b=a1bHXdBn6J0K1BO0qeq384iDL9dQ8Zojj9cYZm5Y1oxR2tSjfQm9g7pZr3zJXCe/E/ 4Gh6pamlqGI+BkCfjo9R0DAyu9Aegs7mqVnedvr54ODW6ixOiSeQdh3I1sIPSUKCStp1 rhJ3wzkembTk0uo9e7iDwCDAG2K+yPeqfjn1lxpMqg7vyeJtewh9ylRRTmzw/oL+F9l/ Ebyoxrhxtp0kWgSBpZU5WqbIoKwoa9Woc9wxWo5Jvf9rXSESL+QGIgJkGHD5U6ThgeDi hh32CldiAcmqW7iXUVSm78MGqp0cZ8tNxl8wJjIcgDEH77Tb8zmozBdB8zPeZyk/2nCk hdyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t3sVszuw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4-v6si16852363pgg.503.2018.10.17.15.14.45; Wed, 17 Oct 2018 15:15:01 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=t3sVszuw; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727439AbeJRGLf (ORCPT + 99 others); Thu, 18 Oct 2018 02:11:35 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40382 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726334AbeJRGLf (ORCPT ); Thu, 18 Oct 2018 02:11:35 -0400 Received: by mail-wm1-f66.google.com with SMTP id z204-v6so3755885wmc.5; Wed, 17 Oct 2018 15:13:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=z1nZgFuSAWF4xak9H7pvf35PBoIZxIEAvPRBU2/+bmg=; b=t3sVszuw3/PkJBe/BCtjH9klhqUCOAjVpQIPDErgDVRS/88mjVVdLgUwhhA3Bgqgii 3v25watMk7PT3bg7CjwMVmMtnMzCJtfByrw5eHxBrtIQkDCfM2fKW4FogvZMGjSOjQXz fLbZN2vDdu4duC3miQP7FbENwlhoP/dVXAJIQTVQ7EDgQVqR4REzCAegu25oi/XkaVa6 +RobBQQE6SkGyoaKtyrT0qTXHu0Mdz3YJQIlQtqECgvE3P1DB6XAy0Xquvw9T6xXc6Uj 9ckulN0jj3lOKHh/90wSOGXlWS/MDLl8tzK1Lj+7hC2Uy+MB8aMKqODcQzRVMGlqanX5 R/8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=z1nZgFuSAWF4xak9H7pvf35PBoIZxIEAvPRBU2/+bmg=; b=fTaLDHN/kMwxohwHlJelwwuyMpkFWPnGQCtlkN3dlA49RSiS+No4RJirJMrwfDCD6M RNFDLvn2AICQN1mwR4YwnC5ljsxb0jEtqlJdPPHJk3iAXVVat+28YJijYiVg9NFwHqM+ /q14LbPyh9qjLD/AqHH7+50Zb4FeX6NzQzoPiAj+OX1szUMBZGmar1phJpxRpWslYkSf E2DBsXJlUUvdtFPSsNiEyTTMPhFB5JrzKbFPpXeZkbzQEi/9lP40ib1tlCddGcHgOAmZ invzjjVD6TDXybdp9meAuBaImSJOiSRsZmCO3HUcnuIWPwTYua6M2Is/R5o+7AnXEEtV 6qTw== X-Gm-Message-State: ABuFfohYVBqyH0ncEkXz3HBcfn4W2uRSQcAMQD2dzH1l5JdifWirttfQ RRvaCxhKm7NxvbReIluAB1g7awmdjso= X-Received: by 2002:a1c:4385:: with SMTP id q127-v6mr4672146wma.111.1539814429367; Wed, 17 Oct 2018 15:13:49 -0700 (PDT) Received: from [172.16.8.139] (host-89-243-172-161.as13285.net. [89.243.172.161]) by smtp.gmail.com with ESMTPSA id 33-v6sm5509982wra.48.2018.10.17.15.13.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 15:13:48 -0700 (PDT) From: Alan Jenkins Subject: Re: [PATCH 31/34] vfs: syscall: Add fspick() to select a superblock for reconfiguration [ver #12] To: David Howells Cc: Al Viro , linux-api@vger.kernel.org, torvalds@linux-foundation.org, ebiederm@xmission.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, mszeredi@redhat.com References: <19866.1539782101@warthog.procyon.org.uk> <68a2107f-bf70-055b-86cf-1ba2ba9422bf@gmail.com> <153754740781.17872.7869536526927736855.stgit@warthog.procyon.org.uk> <153754766004.17872.9829232103614083565.stgit@warthog.procyon.org.uk> <9b8bf436-65de-13b9-0002-0479d11c18ca@gmail.com> <20181013061141.GR32577@ZenIV.linux.org.uk> <28710.1539782412@warthog.procyon.org.uk> <15867.1539791153@warthog.procyon.org.uk> Message-ID: <240b2620-02cd-89de-4c22-293af6c5ac8b@gmail.com> Date: Wed, 17 Oct 2018 23:13:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <15867.1539791153@warthog.procyon.org.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [resent, hopefully with slightly less formatting damage] On 17/10/2018 16:45, David Howells wrote: > Alan Jenkins wrote: > >> I agree. I'm happy to see this is using the same check as do_remount(). >> >> >> * change filesystem flags. dir should be a physical root of filesystem. >> * If you've mounted a non-root directory somewhere and want to do remount >> * on it - tough luck. >> */ > Are you suggesting that it should only work at the ultimate root of a > superblock and not a bind mount somewhere within? > > That's tricky to make work for NFS because s_root is a dummy dentry. > > David Retro-actively: I do not suggest that. I tried to answer this question in my reply to Eric correcting me. Eric was right to correct me.  I now understand the comment above do_remount() is incorrect.  I re-reviewed your diff in light of that.  I re-endorse your diff as a way to solve the problem I raised. (I think it would be useful to remove the misleading comment above do_remount(), to avoid future confusion.) > @@ -186,6 +186,10 @@ SYSCALL_DEFINE3(fspick, int, dfd, const char __user *, path, unsigned int, flags > if (ret < 0) > goto err; > > + ret = -EINVAL; > + if (target.mnt->mnt_root != target.dentry) > + goto err_path; > + > fc = vfs_new_fs_context(target.dentry->d_sb->s_type, target.dentry, > 0, 0, FS_CONTEXT_FOR_RECONFIGURE); > if (IS_ERR(fc)) { ( the "if" statement it adds to fspick() is equivalent to the second "if" statement in do_remount(): ) static int do_remount(struct path *path, int ms_flags, int sb_flags, int mnt_flags, void *data) { int err; struct super_block *sb = path->mnt->mnt_sb; struct mount *mnt = real_mount(path->mnt); if (!check_mnt(mnt)) return -EINVAL; if (path->dentry != path->mnt->mnt_root) return -EINVAL; Thanks Alan