From patchwork Tue Apr 30 20:09:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1929848 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTWW52ZBxz1ydT for ; Wed, 1 May 2024 06:09:21 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 178C13858CD1 for ; Tue, 30 Apr 2024 20:09:19 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (sonata.ens-lyon.org [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id AD8CF3858D1E for ; Tue, 30 Apr 2024 20:09:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD8CF3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org AD8CF3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=140.77.166.138 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714507746; cv=none; b=XHtJH+fZXo90lZH8NpwKyof/P7gYL1yJ0WI9M+yqdNNcBQizFcm5RTHZJjZdIIkq5vQttuNHldrHwCiau/NoG2L1o3MYUFdozczejpHOq45GmapOkYUoXQedyCinwO+JJQnzObQTF+8LbNtnpLprZOyCRu6XKsXLFBAqAltzBSM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714507746; c=relaxed/simple; bh=2Sk0RxkhDXmnnuPeIfhHs2D/0F0pA19Mo6t+E+k9jT0=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=rGwBAZU2Rgb9m/33dSB24GOTEYBGuwdTJSn3FI07X1cukqU6oRAHn3gqSS5t/a6145jdOa5a5N6VPYKjsuHULkRnLgRAh8dv7uRE5+M7xgNr7fPTLa2lHM4fBB22/Infh5QeHLP2DVStY3Yu3ucu4LDSHQ9U2Mo44egHHfxWXSo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 23D00A0228; Tue, 30 Apr 2024 22:09:03 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v18fznx1PCTD; Tue, 30 Apr 2024 22:09:03 +0200 (CEST) Received: from begin.home (aamiens-653-1-111-57.w83-192.abo.wanadoo.fr [83.192.234.57]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 00784A021E; Tue, 30 Apr 2024 22:09:03 +0200 (CEST) Received: from samy by begin.home with local (Exim 4.97) (envelope-from ) id 1s1tmg-0000000Eypa-2Le7; Tue, 30 Apr 2024 22:09:02 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Sergey Bugaev , commit-hurd@gnu.org Subject: [hurd,commited] hurd: Stop mapping AT_NO_AUTOMOUNT to O_NOTRANS Date: Tue, 30 Apr 2024 22:09:02 +0200 Message-ID: <20240430200902.3570419-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org From: Sergey Bugaev While AT_NO_AUTOMOUNT is similar in function to the Hurd's O_NOTRANS, there are significant enough differences in semantics: 1. AT_NO_AUTOMOUNT has no effect on already established mounts, whereas O_NOTRANS causes the lookup to ignore both passive and active translators. A better approximation of the AT_NO_AUTOMOUNT behavior would be to honor active translators, but avoid starting passive ones; like what the file_name_lookup_carefully () routine from sutils/clookup.c in the Hurd source tree does. 2. On GNU/Hurd, translators are used much more pervasively than mounts on "traditional" Unix systems: among other things, translators underlie features like symlinks, device nodes, and sockets. And while on a "traditional" Unix system, the mountpoint and the root of the mounted tree may look similar enough for many purposes (they're both directories, for one thing), the Hurd allows for any combination of the two node types, and indeed it is common to have e.g. a device node "mounted" on top of a regular file node on the underlying filesystem. Ignoring the translator and stat'ing the underlying node is therefore likely to return very different results from what you'd get if you stat the translator's root node. In practice, mapping AT_NO_AUTOMOUNT to O_NOTRANS was breaking GNU Coreutils, including stat(1) and ls(1): $ stat /dev/hd0s1 File: /dev/hd0s1 Size: 0 Blocks: 8 IO Block: 8192 regular empty file Device: 0,8 Inode: 32866 Links: 1 This was also breaking GNOME's glib, where a g_local_file_stat () call that is supposed to stat () a file through a symlink uses AT_NO_AUTOMOUNT, which gets mapped to O_NOTRANS, which then causes the stat () call to stat symlink itself like lstat () would, rather then the file it points to, which is what the logic expects to happen. This reverts most of 13710e7e6af6c8965cc9a63a0660cb4ce1966557 "hurd: Add support for AT_NO_AUTOMOUNT". Signed-off-by: Sergey Bugaev --- hurd/hurd/fd.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h index 1616c635d5..7bdb4d0ea9 100644 --- a/hurd/hurd/fd.h +++ b/hurd/hurd/fd.h @@ -300,8 +300,6 @@ __hurd_at_flags (int *at_flags, int *flags) *flags &= ~O_NOLINK; *at_flags &= ~AT_SYMLINK_FOLLOW; - if (*at_flags & AT_NO_AUTOMOUNT) - *flags |= O_NOTRANS; *at_flags &= ~AT_NO_AUTOMOUNT; if (*at_flags != 0)