Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3037872imj; Mon, 11 Feb 2019 12:44:00 -0800 (PST) X-Google-Smtp-Source: AHgI3IZtWyA9ImDumr91FxnmI/MiJdIqyLhG9FGt6/WVY4Ottacvk0SlyEsajCwdGOhw6/bvM58t X-Received: by 2002:a63:1ce:: with SMTP id 197mr108413pgb.47.1549917840369; Mon, 11 Feb 2019 12:44:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549917840; cv=none; d=google.com; s=arc-20160816; b=JOSxzXKUCHm2Szguy849ERt0BfrdzAMkD7BUDnKO6y9t/GDzB1z/Y0lxDCHvT1Yths 0KMPDOKBR/9YqelyUeJyE8iABAV80iuIa+YbSJyooWCuHiXDuGxe0Ou/r+jFh5MfnU5O Fdgp8DWRsE52XW4+082HBgY5p9anJUX7skr7zyM1eU/NaNemhXu/o2v5XBKtBwSDgIJf Oq8GTgueBWgGBQR3XUQcrihJZ3LHlENQKaw03hKRxuUdUadFPUT4qfFch0u0Q1OrYXJV eRwRSKBeHXh2hSYFvRTDBk4TrDnzTZ0S5Y1neR49brCqIKE8ouVI6D6dVZ7iqzIXwSJE gRPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :mime-version:dkim-signature; bh=TDeuT6V3lqE2LFcnTCKtegHpdN3WHW/krAayHK4A2hM=; b=pyixd51wzb04Un2YnBXR8wFzt0uMgwB+Z3MMWBG8YH/EZ/7XtUvhz5zkEp64FtirWo Q+QaaajSrYkAEU5PzE0qmrKR4LLzRxggm/NHpXnxwg9l7E4tEDENh5nwCheYEEgRJhjp mAkwUrSGngaYtSlTKwochRK4yw30++pyS2i5v7IYBRI/ZewCmyA1U8F7XDCzXzL6LMl4 iu1zLlCZu9cQ6CUqWnxsQnXHSism8u6E5Av6E0I4TIudkpUuDefzPjhRDEdrYaMCKA0I iKkIq1RZrqK+DOTNhZLjtjdzvmmIzVaVDz6BhYiiCdJkrf8LLwS8WPwXZBo8wyCDrRbv pnzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@tavianator.com header.s=google header.b=yGd5RcUm; 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 t4si1206894pgv.168.2019.02.11.12.43.44; Mon, 11 Feb 2019 12:44:00 -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=pass (test mode) header.i=@tavianator.com header.s=google header.b=yGd5RcUm; 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 S2388167AbfBKT7m (ORCPT + 99 others); Mon, 11 Feb 2019 14:59:42 -0500 Received: from mail-pl1-f173.google.com ([209.85.214.173]:33478 "EHLO mail-pl1-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726170AbfBKT7m (ORCPT ); Mon, 11 Feb 2019 14:59:42 -0500 Received: by mail-pl1-f173.google.com with SMTP id y10so78345plp.0; Mon, 11 Feb 2019 11:59:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tavianator.com; s=google; h=mime-version:from:date:message-id:subject:to; bh=TDeuT6V3lqE2LFcnTCKtegHpdN3WHW/krAayHK4A2hM=; b=yGd5RcUmeo0Fnq03/JiZWesCI74BDTmf60OZtnci5kVO2qTL49wF63EF2qMd/Q1onM B4pl0I7c7hed1+ypuC6BreoKBoODdmsM0na0P1ivRSbddsklvjKmv5m0WxMHeVyVjVvC dLGgepM0u5rFLB/D66sbl6gTCffQQcvyKFfLk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=TDeuT6V3lqE2LFcnTCKtegHpdN3WHW/krAayHK4A2hM=; b=MwksH5wHQnUvaBXjjIQj9BxkBWA1zGk7118ystmhxLgClJM+gG4CeOT6IcmYUQ1yrV CmwMNsGUR+5eisYnIrkSX2z+1QTvN9aCBcr6/RQSoX5tLULRqsAu1O+t1r2zaTbMSCUF kUyel3DI4rxLP6R/UHOh4jX9MLurRGYperyCf4WA6dtx3YaCT/ZUNpRq79+hfT+XjJWt k0Yw4CP4cATt0p5r8rtH++eQI4XagzD6S4OPwHgEqtVonWNWZT8bN7RYSMpXHtfpbnZC 0K8QdFMhrPrW86DSEXYLJwVrFLDo8p9OAQiuCpyQ3CR9NBskYGfcYoYz6fsowb3G9orP KP5w== X-Gm-Message-State: AHQUAuaSw5G8jLcu/xDbj/4OkbIA1qGjjEOM64NXAJX44ptqyVos63ub mybf9DCkpOpQs5pJatM22VohLsF46p5mn32h2MoVSVky X-Received: by 2002:a17:902:e01:: with SMTP id 1mr38250994plw.251.1549915180540; Mon, 11 Feb 2019 11:59:40 -0800 (PST) MIME-Version: 1.0 From: Tavian Barnes Date: Mon, 11 Feb 2019 14:59:29 -0500 Message-ID: Subject: d_type and bind mounts To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It seems that readdir()/getdents() fill d_type from the underlying filesystem, not respecting bind mounts of non-directories: $ touch mount_point $ sudo mount --bind /dev/null mount_point $ find -name mount_point -type c $ find -name mount_point -type f ./mount_point (Requires a fairly recent GNU findutils to reproduce, older ones always call stat().) I've seen similar discussions about d_ino being for the underlying file, not the mount point, which people have said is technically a POSIX violation but also unlikely to be fixed. Is the same true of d_type? And is there some workaround a program could use to get the actual type without the overhead of a whole stat() call? For example, a way to tell whether a directory entry is a mount point? For reference, the relevant findutils bug is https://savannah.gnu.org/bugs/?54913. (Please keep me cc'd, I'm not subscribed to lkml or fsdevel. Thanks!) -- Tavian Barnes