Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp6089044ybp; Tue, 8 Oct 2019 12:52:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFZsTMCwq5WSeCIeF2pP1MT20k/DaPbQei5wc9wszwfUB+UE/xu2OfkFKoGEAXwuWnjcFD X-Received: by 2002:a05:6402:6c6:: with SMTP id n6mr35061105edy.162.1570564329088; Tue, 08 Oct 2019 12:52:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570564329; cv=none; d=google.com; s=arc-20160816; b=bqjMJldo4A9zq+e0fEQ9y7E1f78u5raTAub30nShlRQH4xidBGbqVfSGADM32wofB3 yBXOdFK0ZfGiFfhrIZOnh3rLswXgpzM20i3w+z60VrdPZzCvugTL17Hj4gzDVr7Aus8X Nne10VTFSpsLZgWnStLHw1hswWcOF7YeusWu3O6qEZMFqoTH5aLvQuMc3kAUks7W+gI1 KEr02uzeQU+GhLjInlyQQMHaW2Fwb94Sy6SPAjIJazcF0+wdSZfpEFqNkwyZiH5MfUVZ vFdLc0fSnbiYkL0T7J3Nrf5V0pVG/AmYq+KhCD53fPRa1m/aWnWmNdO2WYqFQ5Mk+EVW GhzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=tVOdpEM8zYwr6A95fEdbiKaAHkoR1ATc1z7R9NfKBdo=; b=LoFGXXR0gdkD9m+6fYu0RKDfInkykFow16RPgmIjIFyNBjxUYYn4PUoSDMwGhvRxpl nIJsZMDMcFo/YKC5ZxZZHoLuQN75odcD1AgKKUFHueJKILYeljyOpGeKazY4/OXnb/PC oziBx73X+fATkGwryfCSMGFnJ+0CdPY8ho/qpfWFqy4rWg/0yyuHbyfaLA5YZrhHEzf2 hJjDp6n+mukA9JW+ayLSgHLmxSHff52wHeK8ipL6y1kLFOrGGtoITNGEunLcxg8jE5KF EyIu0ORqFopqLczBKQI/61B0B5AYvahcPB0c0V6Vr7Jpcxa6EKgI4Kwt3BTO4X9B2RT/ UaTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sUYZuEYp; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id si30si9465504ejb.92.2019.10.08.12.51.44; Tue, 08 Oct 2019 12:52:09 -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=@google.com header.s=20161025 header.b=sUYZuEYp; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730548AbfJHTv3 (ORCPT + 99 others); Tue, 8 Oct 2019 15:51:29 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:35911 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729854AbfJHTv2 (ORCPT ); Tue, 8 Oct 2019 15:51:28 -0400 Received: by mail-pg1-f194.google.com with SMTP id 23so10869905pgk.3 for ; Tue, 08 Oct 2019 12:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=tVOdpEM8zYwr6A95fEdbiKaAHkoR1ATc1z7R9NfKBdo=; b=sUYZuEYpMdnPU86NNv4TwIXjcaisunOJqKKRXDOVPRzLOM0ZJpMy5SNmT0gSKgUOyj 5ezid2WQ3js3yBhJmf1kh0drLSkVNcKBhuQuQif4BT4PNVvd5yBA41trFJ7CXFA46rLM OmnsWOrSqsJS2puQZPUpkxk8FM1p3Lh9P1KHQXlQ5JRbXyzYAxTV+nPOi9P+r+e+VBhp iBWO5EreivSZJ8KQnnrHb5AGL1wsXBUfzkNVDQo2/iY/+FILPhS44AIm0eAZnuphuFoA ONsS0sC9LlY1eGreXLFO2Y9OP/RImUnNF6o8HXY4XdzYw/wPZ0diFgeHWQrl7fJJJHLu tQXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=tVOdpEM8zYwr6A95fEdbiKaAHkoR1ATc1z7R9NfKBdo=; b=LcuiwnAu2PhQuxkLPF0RSdw2FHbRL1ODtjJbLnErmy0m9t8IS5KGo3pUSPH0pCGqe0 uKiDqlzvrJoLDeULLGsiZC0LhpT1z0jr2POAKDPzafoharaIrkA4Gt3Lxgur9ZLnbw2c jZm2UbarHlbHwEwRj8gHJ2qcyD2H8I8d0RnC3UEHB4Psa3rIB87hPlI3ZdU5fN3r8lZL IADkZpdUq7fXUIx3140wx8zzo3FtBZXWnkmSDwwAF0BTVLJlUBx04NErXWIUTVyarym1 thTS4J6SoeTxEMVqMRj09oO9G97hBvwP5ELagYm/cjFMUhl82ZY/7kys3SgK1CwEMFoe vAwg== X-Gm-Message-State: APjAAAXa5mPbV7PoVIlP04ZLrVgU/03OFXW/NRwu8HE5EVZL4b6tfNlU LYipfW2fq/Bd+GshjiGN0yXGxQ== X-Received: by 2002:aa7:800d:: with SMTP id j13mr41082251pfi.187.1570564287334; Tue, 08 Oct 2019 12:51:27 -0700 (PDT) Received: from [100.112.64.176] ([104.133.9.96]) by smtp.gmail.com with ESMTPSA id t13sm17427284pfh.12.2019.10.08.12.51.26 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Oct 2019 12:51:26 -0700 (PDT) Date: Tue, 8 Oct 2019 12:51:02 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Ian Kent , Karel Zak cc: Hugh Dickins , Laura Abbott , David Howells , Alexander Viro , Linux-MM , Linux Kernel Mailing List , linux-fsdevel@vger.kernel.org Subject: Re: mount on tmpfs failing to parse context option In-Reply-To: <20191008125610.s4fgnnba7yhclb3z@10.255.255.10> Message-ID: References: <59784f8ac4d458a09d40706b554432b283083938.camel@themaw.net> <20191008125610.s4fgnnba7yhclb3z@10.255.255.10> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1683574798-1570564286=:1204" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1683574798-1570564286=:1204 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 8 Oct 2019, Karel Zak wrote: > On Tue, Oct 08, 2019 at 08:38:18PM +0800, Ian Kent wrote: > > > That's because the options in shmem_parse_options() are > > > "size=3D4G,nr_inodes=3D0", which indeed looks like an attempt to > > > retroactively limit size; but the user never asked "size=3D4G" there. > >=20 > > I believe that's mount(8) doing that. > > I don't think it's specific to the new mount api. > >=20 > > AFAIK it's not new but it does mean the that things that come > > through that have been found in mtab by mount(8) need to be > > checked against the current value before failing or ignored if > > changing them is not allowed. > >=20 > > I wonder if the problem has been present for quite a while but > > gone unnoticed perhaps. > >=20 > > IIUC the order should always be command line options last and it > > must be that way to honour the last specified option takes > > precedence convention. > >=20 > > I thought this was well known, but maybe I'm wrong ... and TBH > > I wasn't aware of it until recently myself. >=20 > Yep, the common behavior is "the last option wins". See man mount, > remount option: >=20 > remount functionality follows the standard way the mount command > works with options from fstab. This means that mount does not read > fstab (or mtab) only when both device and dir are specified. >=20 > mount -o remount,rw /dev/foo /dir >=20 > After this call all old mount options are replaced and arbitrary > stuff from fstab (or mtab) is ignored, except the loop=3D option which > is internally generated and maintained by the mount command. >=20 > mount -o remount,rw /dir >=20 > After this call, mount reads fstab and merges these options with > the options from the command line (-o). If no mountpoint is found > in fstab, then a remount with unspeci=E2=80=90 fied source is allowed. >=20 >=20 > If you do not like this classic behavior than recent mount(8) versions > provide --options-mode=3D{ignore,append,prepend,replace} to keep it in > your hands. Ian, Karel, many thanks for your very helpful education. I've not yet digested all of it, but the important thing is... Yes, you're right: my unexpectedly failing remount sequence fails equally on a v5.3 kernel, and I'll hazard a guess that it has failed like that ever since v2.4.8. I just never noticed (and nobody else ever complained) until I tried testing the new mount API: which at least has the courtesy to put an error message reflecting the final decision in dmesg, when the older kernels just silently EINVALed. (And it's not impossible to remount thereafter: one just has to add a "size=3D0" into the options, to allow the other options through.) So, I've no more worries for v5.4 tmpfs mount, and if there's anything that can be improved, that's a background job for me to look into later, once I've spent more time understanding the info you've given me. And Laura has confirmed that Al's security_sb_eat_lsm_opts() patch fixes the "context" issue: thanks. Hugh --0-1683574798-1570564286=:1204--