From nobody Tue Jan 30 09:00:35 2024 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TPJzc6KbMz58QqN for ; Tue, 30 Jan 2024 09:00:44 +0000 (UTC) (envelope-from olce@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TPJzc589nz41KY; Tue, 30 Jan 2024 09:00:44 +0000 (UTC) (envelope-from olce@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706605244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+ZAx7momUPAaRB4eKUIfo6rCyxAs2oICgxt5FBs7B6k=; b=fiRv+N1POQajatko5hs8KvSCyNV6GyyJHVGbZr/Krbb2acD8JghYrJpMqHeYjDP5QT2aFX /zLph6L+IUQjhxsdzYBY4jWSrZD1kq773Yar9LWkfffmpPDbWi0LVil3HRvti86KxobnsY iBPQImhO5WqkUvGbZZIjjhm3B1lo6WFd0fqJ1X3PCbnBjPhy0HVay2M4u4lCVCPcN0pdhN 40MCoohOSE/bJpu5PHhtjb0STD15cqqRsR/wGBJxf0sWTxhHbMHH/AHciyB7IyqB6uPbtB mpRopdUe80a+BfNJ2ZaD+1XqsokIkaSkLOjADzA3wLvEPHwTtc9Jky952Yn3vA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706605244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+ZAx7momUPAaRB4eKUIfo6rCyxAs2oICgxt5FBs7B6k=; b=A58CzKrLdeDHc6jxrU8GISeDY5le+KvZdDZD9UaLG49abPq01szO+O7VuOjeCTdvEwWkjP 5HGwtH9LX59wYrFS/nVvV7PL2gircPxA27WxNk2p8YHe0Eeno8Vz711+wrC+Np2fT32yiO bhABo0OPkLS6y1U0tH8puA3obD0bqEIsqWTkwn9En5bYOz59IwrNU+TQDYH872Q2qBU9Kr 3jhaNyQwtHhcnyR7K/QvD5RRPjsKBjy5dz5+Upyr41wDGLLdm+x+YnLN6CWeFZptkkXBHb WFwzNUfuFaKdeRihyGlZNDnYIrivOhU2wndH2joUztgav8JAvi7fC6kaV0msIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706605244; a=rsa-sha256; cv=none; b=i42o/fs+pQOk6gtHcv/KiQvAHEOGTaCn5SKqRxEWCEAssUK3qm1CjtSuJKdJOjLgJriubK YKeqEuAxTNStYe4O247Bk8U70tWvfetvcmC4fvQUFq2s21RuXn/NZ2gsrsKbWP25ddNJhk kgSpMaPEo/wn/nsJ/c2d6EzPuAj68qAFMNNC6bHTgE5ux2H4phGlVixqwSaFMegwr3Qb5Y OZc0kwqArsi+7dstAuF9fJlBWn64rvSs6fBzo4wUiBXdy2Q7HI/3zuR/K+glzHn98P2VWd 8FUiqwZbf2mjbVrsoouISywXx+0Cg7bkosGSwcU3k6hgdvEt7gdR9qZ5tRCFJA== Received: from ravel.localnet (lfbn-nic-1-525-172.w90-118.abo.wanadoo.fr [90.118.140.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: olce/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4TPJzb6XFVz1ZL1; Tue, 30 Jan 2024 09:00:43 +0000 (UTC) (envelope-from olce@freebsd.org) From: Olivier Certner To: Warner Losh Cc: Mike Karels , freebsd-current@freebsd.org Subject: Re: noatime on ufs2 Date: Tue, 30 Jan 2024 10:00:35 +0100 Message-ID: <1732771.R3xgXyqmLP@ravel> In-Reply-To: References: <3896441.telDhacX5M@ravel> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart4015718.3Q9M2VvjI4"; micalg="pgp-sha384"; protocol="application/pgp-signature" --nextPart4015718.3Q9M2VvjI4 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8"; protected-headers="v1" From: Olivier Certner To: Warner Losh Cc: Mike Karels , freebsd-current@freebsd.org Subject: Re: noatime on ufs2 Date: Tue, 30 Jan 2024 10:00:35 +0100 Message-ID: <1732771.R3xgXyqmLP@ravel> MIME-Version: 1.0 Hi Warner, > I strongly oppose this notion to control this from loader.conf. Root is > mounted read-only, so it doesn't matter. That's why I liked Mike's > suggestion: root isn't special. Then in fact there is nothing to oppose. You've just said yourself that root is mounted first read-only. As Mike already said, it is remounted r/w in userland later in the boot process. I just re-checked the code, because I only had a vague recollection of all this, and can confirm. I mentioned the need to modify '/etc/loader.conf' as a possible consequence, not as a goal. Given what we have established, there is no need to change it at all. The root FS is thus in no way more special in the sysctl proposal than with Mike's (assuming it doesn't rely on sysctl), this is an independent property due to the boot process design. > > > It also seems undesirable to add a sysctl to control a value that the > > > kernel doesn't use. > > > > The kernel has to use it to guarantee some uniform behavior irrespective > > of the mount being performed through mount(8) or by a direct call to > > nmount(2). I think this consistency is important. Perhaps all > > auto-mounters and mount helpers always run mount(8) and never deal with > > nmount(2), I would have to check (I seem to remember that, a long time ago, > > when nmount(2) was introduced as an enhancement over mount(2), the stance > > was that applications should use mount(8) and not nmount(2) directly). > > Even if there were no obvious callers of nmount(2), I would be a bit > > uncomfortable with this discrepancy in behavior. > > > > I disagree. I think Mike's suggestion was better and dealt with POLA and > POLA breaking in a sane way. If the default is applied universally in user > space, then we need not change the kernel at all. I think applying the changes to userland only is really a bad idea. I've already explained why, but going to do it again in case you missed that. If you have counter-arguments, fine, but I would like to see them. Changing userland only causes a discrepancy between mount(8) and nmount(2). Even if the project would take a stance that nmount(2) is not a public API and mount(8) must always be used, the system call will still be there. And if it's not supposed to be used, what's the problem with changing it as well? Second, we can control what is in the base system, but not other applications, so we can't really prevent nmount(2) to be used. Some of the goals of my proposal include to simplifying things, both in terms of administration but also in terms of the amount of code, and to provide reliable behavior. My current evaluation is that changing userland will require more code changes than the sysctl I propose, and it has all the drawbacks I've just mentioned. What I find great in Mike's proposal is to use '/etc/fstab' to control filesystem defaults, because '/etc/fstab' is already the go-to place for filesystems and already holds options to apply to particular mounts. But again, this is independent of where the mechanism is actually implemented. > We lose all the chicken and egg problems and the non-linearness of the sysctl idea. As already said above, there is in the end no such problem, and it wasn't linked at all with the sysctl idea. On the contrary, with the '/etc/fstab' proposal, if there is no kernel backing, the loader must be modified to parse default options, and then pass them to the kernel (via 'vfs.root.mountfrom.options'), or the script remounting r/w be modified to apply the proper options (or 'mount -u' itself changed to do so). > If it's in fstab as default, then it would be read by whatever updates > things in user space. It's very unlikely that applications would not need modifications in this regard. Mike even said that he wouldn't have getfsent() return such entries to avoid confusing existing programs. Needing specific code makes this point moot (if you have to modify a program to read and process the special lines in '/etc/fstab', you can as well modify it to use sysctl(8)). The real advantage is direct modifications in a text file by an administrator, and this is why I like the '/etc/fstab' idea. > It obviates the need for the sysctl entirely. It doesn't obviate the need for a kernel mechanism (sysctl(8) or else), see argument on mount(8) and nmount(2) above. And once you need a kernel mechanism, sysctl(8) is most probably the best candidate for tunables (why re-invent the wheel?). > It gets around the need to update loader.conf as well. You keep repeating that, but it's false as explained above. > It concentrates the change in one place and does so in a way that's not at all atime focused: It could also be > generalized so that the FSTYPE could have different settings for different types of filesystem (maybe unique flags that some file systems don't > understand). You can also have this with a properly designed sysctl(8) hierarchy. > I don't like this, because it is atime focused. atime is a trivial little > optimization that really isn't worth the effort for the vast majority of > things. Others have disagreed, not going to summarize all the previous mails, there are for anyone to read. > However, it would be nice to have some way to specify another layer > of defaults, like we do for rc variables, loader variables, etc. mount is > currently missing that generality. One could also put it in > /etc/defaults/fstab too and not break POLA since that's the pattern we use > elsewhere. I also think having the defaults in '/etc/defaults/fstab' would be better because more in line with what we're doing for rc(8) and loader(8). This would be at the expense of discoverability for adopters, but it seems to be worth it given it applies to other things and has some logic. > I don't think the case for sysctl has been made. It's a big, inelegant > hammer that can be solved more elegantly like Mike suggested. I think it's the exact opposite. As explained above, the change in defaults must be implemented in the kernel. The inelegancy of the pure userland solution will become apparent in terms of the necessary changes' content, its higher number of lines of code and its intrinsic unreliability in the face of external applications using nmount(2). > It follows the 'tools not rules' philosophy the project has had for decades. FreeBSD is far from being the only project having it. Anyway, I've never proposed anything not in these lines. Can you really argue that the sysctl proposal goes against that? > Anyway, I've said my piece. I agree with Mike that there's consensus for > this from the installer, and after that consensus falls away. Mike's idea > is one that I can get behind since it elegantly solves the general problem. In the current situation, I can back using '/etc/fstab', or probably better, '/usr/local/etc/fstab' to hold default mount options, but I'm strongly opposing a pure userland implementation as long as my objections above are not addressed properly. Thanks and regards. -- Olivier Certner --nextPart4015718.3Q9M2VvjI4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQIzBAABCQAdFiEEmNCxHjkosai0LYIujKEwQJceJicFAmW4urMACgkQjKEwQJce JieWAA//TAbWHw8+hvWfRe20E9iCtBESeb0sib8Zf2eyNYMBabEs82+JYB4zh94m 3XBh0KKaD7/pLPkvxF3FpBJFB6Wkgw2FqpzWYAbSHTLM14xTPQ9RqVExruZ91Tbi 7OA/LHXGthsz7aaSmAqcuax1zi8JiNTEZ/83dDVs5dKKS+A/aY9sEKMC46N+0/EU upthTVCBMgLrNn+xRSetpoX4beMTxQD9eJNU8uolFJmOMPAGRJFdy1SLBXMh7Ia3 atIc+gWdI64XD/R0QUe2PQ+uFhKOLlQcEN6/JI3RReIx5Qfax89IIdCeGQIYXH7p s3ztj9WTJ5lKQc6TgKTuHEidvi2I89aeeENL2nJYDf9U/Ox0DyXC/xVUGz/Fe18B WWCKxVTQ3MUsa4qBp8szENvi8xh4KDUv7SQYonZEcSSEfHq8IGYabAgpp3KYaXDx TbSrcK3Kt3AMgwef5MYIppYXuEXuxE91+aKR5C8uRNKY+bZcEiygK0grAoNiyqDA Cju6rxqCcYkAE1tavonwTI+R0YTjT+l4BwNVwilfaCdaWyzQMJ3wYM9VJNLfRv2c AMM8l9XleohAHf09lW3qFqd/IPgP+fPzZgTIXIPb0LyZHNqW72pbKhAtOAC3ImC0 IsUzLEhHANRPSfAlRR7P2LNcN6mEsUA0YpbG7Kd4DpacjCN4GkU= =YC4T -----END PGP SIGNATURE----- --nextPart4015718.3Q9M2VvjI4--