Received: by 10.223.185.116 with SMTP id b49csp5218753wrg; Wed, 7 Mar 2018 08:10:41 -0800 (PST) X-Google-Smtp-Source: AG47ELu9C3DhZFAdpd5dlGvIpb2KFA1p4yEjXBgwzwOTgLKOyrt0X25UmVSuxjVv0lUJfErS+Ek+ X-Received: by 2002:a17:902:6b4a:: with SMTP id g10-v6mr16377470plt.435.1520439041877; Wed, 07 Mar 2018 08:10:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520439041; cv=none; d=google.com; s=arc-20160816; b=CaJ+RLpqQoEopY9V5GuUgRK4fqszkLrQvEh6LH/0ZRUvUSPvtVjMSD1fRLVT8ZzxTI hXVDoUkEta2a8Qei6p8QapvcIyJRDrbP2qvOba9UMU99UL+/pHYb304n/zd81MLlX8v4 48PuFIPx25G5GHMZQYmH2W2ApJTp7Ehps5Qs5O3+DEuVYMzTAJeF0nD2RxvG/JwYhxLW IJsAkwCGwO9ew0crTajJsW9yIGvCERiSuRbJDSp8C9iHpjs9rgz6GnlnqezqBZmbgUEF 6wN5z9do0gYX8NI8kKS18FaK/j1emszPNG5fspHH8U4cYNqA7DvdGpKb6rz0oNdxrkMY 3xDQ== 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-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=J4V/OXrlugLG0C3dk5kLI4wTW3vh86EqMAjNX7tyvp0=; b=ypjo84/fTiw9WGTQMfZSiyP2nbumiNke36LBdWeyNObCJ546HSUnhklK23PsBB4cDK LF7IQ9eSied27Dusqc1yDsWKL4cO+1q26o5IOJtSx5ia8FAt/LQ/IPzQRiBMzTLrca6e uy8i6FdSRTYLRQGA1eZqr9Pul/zIzIaO4bjaKYb9LJ65TvIYtioWW3st1KXb8EhiIDDA SFmzRpcbfdngoyWejUNiJcY0m/WEPFW+gr0HdJvQAOeZ9iaHcgmWMTdPiwyIT9II88RE /AdLvvdJEGgZa9j7KYYMBpRAgLIVCYjQ0YoaOr2UmuM2lqNWducZ4yN97xxsGX2fes4I K9JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@thunk.org header.s=ef5046eb header.b=SFdCOmx2; 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 e2si11389304pga.394.2018.03.07.08.10.27; Wed, 07 Mar 2018 08:10:41 -0800 (PST) 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=fail header.i=@thunk.org header.s=ef5046eb header.b=SFdCOmx2; 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 S933988AbeCGQJB (ORCPT + 99 others); Wed, 7 Mar 2018 11:09:01 -0500 Received: from imap.thunk.org ([74.207.234.97]:38696 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933409AbeCGQI7 (ORCPT ); Wed, 7 Mar 2018 11:08:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thunk.org; s=ef5046eb; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=J4V/OXrlugLG0C3dk5kLI4wTW3vh86EqMAjNX7tyvp0=; b=SFdCOmx2g9SDKQS0W3/f12RKi/ qjVi1guJ8/wZWoKIqnQX4TnXKa76KCjwfIlmvr3PjEO6f8uAz77ni2U9EMHsz27L9xXhrF7+Ouv+F VSTmuwjZPDULIUtc0O0l/78BBOC1v9T3GNhKdPuUEUxCs9nixsKDUjn0Uv/jsocQzeio=; Received: from root (helo=callcc.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.89) (envelope-from ) id 1etbcf-0005j4-8D; Wed, 07 Mar 2018 16:08:57 +0000 Received: by callcc.thunk.org (Postfix, from userid 15806) id 7BFC07A4327; Wed, 7 Mar 2018 11:08:56 -0500 (EST) Date: Wed, 7 Mar 2018 11:08:56 -0500 From: "Theodore Y. Ts'o" To: Lennart Sorensen Cc: Andreas Dilger , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: ext4 ignoring rootfs default mount options Message-ID: <20180307160856.GD7507@thunk.org> Mail-Followup-To: "Theodore Y. Ts'o" , Lennart Sorensen , Andreas Dilger , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180306190315.puocf5bu3bfz6yct@csclub.uwaterloo.ca> <20180307040608.GA2462@thunk.org> <20180307151427.i6vbeq6kqo55cdgs@csclub.uwaterloo.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180307151427.i6vbeq6kqo55cdgs@csclub.uwaterloo.ca> User-Agent: Mutt/1.9.3 (2018-01-21) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 07, 2018 at 10:14:28AM -0500, Lennart Sorensen wrote: > > But delalloc is the default for ext4, so a filesystem mounted with > nodelalloc ought to show that in /proc/mounts as far as I am concerned. > The comment in the code says anything that is different than the global > defaults and the filesystem defaults will be shown, but in this case it > is not. Maybe the comment is just wrong or unclear and this is actually > the intended behaviour. I don't think I like the behaviour if it is > intended to work this way. The /proc/fs/ext4/ option at least looks > workable. Strangely I found the function that implements it but couldn't > find anything using it for some reason. I must have just missed it > since it obviously is there. This is where it's critcal to understand that the "tune2fs -o" changes the *default* mount options. The key in the comment is the anything different from the *filesystem* defaults (that is, the defaults of the particular ext4 file system, as opposed to the global defaults). The idea is that /proc/mounts, and /etc/mtab shows the options string that if used in /etc/fstab, or in the mount command line, will replicate the current mount option state. Furthermore, that /proc/mounts is the minimal set of mount option strings. You may not like the behavior, but it's been this way forever, and the reasoning behind it is that the low-level file system code doesn't really know what the actual mount option string that would be in /etc/fstab or in the /sbin/mount command line. That's because /sbin/mount command actually parses the mount options, and things like "ro" is actually translated into bitflag passed to the mount option. So for example, it's impossible to know whether "rw" was in the user-specified mount string, since we never see it by the time the string gets sent to ext4_fill_super (in fact the kernel never sees it). So when we try to make /proc/mounts a replacement for /etc/mtab (since some people make /etc/mtab as symlink /proc/mounts), it's actually impossible. Trying to make it be the minimal set of options was at least a consitent thing. That is, if you use "tune2fs -o nodelalloc", it's not necessary to put nodelalloc in /etc/fstab or in the mount command line. And hence, it should not be in /proc/mounts. As far as where ext4_seq_options_show() gets called, it's because we have a fair amount of macro shortcuts in fs/ext4/sysfs.c (which is where we put all of the pseudo file system support for ext4, which means it includes procfs). Search for macros PROC_FILE_SHOW_DEFN and PROC_FILE_LIST. - Ted