Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35742897rwd; Mon, 10 Jul 2023 11:53:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlGXhjHg/Ir9NkXSyd479RZu93IvW8dsQYTqQCiAUwcEf2Fx8o9XsWGfRgZmBinQDqHbwIUL X-Received: by 2002:a17:906:20d8:b0:994:13c3:2f89 with SMTP id c24-20020a17090620d800b0099413c32f89mr1565622ejc.27.1689015210141; Mon, 10 Jul 2023 11:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689015210; cv=none; d=google.com; s=arc-20160816; b=Tbta482EEauwEw4DiuYcInVg5jbDmp9+pd0WX7hLl+F2r/7IIaN/PLoO8ps3GZ7i5t zt3ipWjsyNxbzetPI+W2TBnMQLb9WlZWE0h3ycRByeHpX037H2dyeoPO/8Jbc97PPkZH tpX70GFilR+4MYeQQvOieRNAGjTL85FOWUHKWN9J15SNUa5TPiUbQKoWOSj2cW/LpIm3 jEVXXTKIkt3MDVxJdl2VvrXRFXCLIWihO+nzyovph9PbM8/ayM5NYAEaBMUkjW9Qfti5 jpCjwylq569JX4p6ggngkt5TrxngedMtJbjfRAzAVwxF1MlOE87bQh1v+BPHpuAFLrJd ca3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=TYRuesch5+38l9pcAr9ykkVr7diDWpCsFfENU0WyrxE=; fh=dFsBxU6KM72iFly4lj8s3NkFJbtU70J2pMfHHkj+Ums=; b=FH2qz425cArNlxmhansfsoXs6wV6bDG8zslZqSUAoVdLIYzeZ6bJmxWrpSRjPkAud+ uL65zCjDxaztnYZg4HA2DjowqKxf3FsKAstnjv+vdz/WMczMVfIS+wui/SBFBnFeGS0H xEbOQhGQ0HpnEJ9xfcNpTAa1XLHfyWm3O5HohltBheT7xktyAPh1vRuepbH5y6DHkZyo VhUMRcGmwFXtef7OLM0VSTmPD9AVRHOA2SUocLX91FkjZFEfpVqM+z/GZy8LnCPgtvvJ OjOlWNktNnFnvMSVe+OhGu4Uzn9rSgH4RmXBS1LB/KDDVsIqmmhV0+NJ0aZta4uSmfxV rgWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b="S/q3ZU3I"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xa8-20020a170907b9c800b00992d122db36si179258ejc.245.2023.07.10.11.53.03; Mon, 10 Jul 2023 11:53:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b="S/q3ZU3I"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232619AbjGJSnP (ORCPT + 99 others); Mon, 10 Jul 2023 14:43:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbjGJSnN (ORCPT ); Mon, 10 Jul 2023 14:43:13 -0400 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC163DE for ; Mon, 10 Jul 2023 11:43:12 -0700 (PDT) Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-6b708b97418so4318204a34.3 for ; Mon, 10 Jul 2023 11:43:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; t=1689014592; x=1691606592; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=TYRuesch5+38l9pcAr9ykkVr7diDWpCsFfENU0WyrxE=; b=S/q3ZU3Iydew6W5Z9meqNFt+b36KVi/V6IUz0VW9joILZuKQOnZKUKxuc6/DSRdaCS rgTpNyPWZ6/2lVacY5oQrZdeWSa9vrpXq4jRcP3L5qfmmOrxLAd/49EyYw87VpyEzSJr NA/HWAn0d5BWsQF9Rd+n2P3KPTcwmzYWlFUmY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689014592; x=1691606592; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TYRuesch5+38l9pcAr9ykkVr7diDWpCsFfENU0WyrxE=; b=L6aZDjoiCq8sn04NksB+NMifuyFFrLOZ6T+T0AgxPGlNHXEjTdnRo4rjA1jM0UAn5R miZpkCGXImSOTteThTdswhX+kNNgpMLQhh2XxgENErFd3RisAlGLhOTjpttIzp8ThPdP 9wObHZYAhccm6duoO7enKCBJIidisfAw53DuDXDuqYCWOrKZmjZNoZMKwHeVPMHBXIBr fqj3yHrqprv2NRrxzBKNIq7XEpjYxl6JQfMSxzf1+99J27j98GPjfmHRJqwZ6PTjPOUd MndN37V4seZgzVSPJQUXBhynpcjDDjz5nYejpHeC4Ap1OTCdodRdprTwRz3CCgKdr3ce XUcA== X-Gm-Message-State: ABy/qLbipHF3C0MX9oTUyx8IxOWvJQwIbavVowKDzQVIjbd1S1wJeepp xgiGUjc1HFeK6UFt3hBKIeXdFyXkqsQV+6Chw0XTMA== X-Received: by 2002:a05:6870:f6a2:b0:1b0:89e0:114f with SMTP id el34-20020a056870f6a200b001b089e0114fmr13970388oab.31.1689014592052; Mon, 10 Jul 2023 11:43:12 -0700 (PDT) MIME-Version: 1.0 References: <20230710183338.58531-1-ivan@cloudflare.com> In-Reply-To: <20230710183338.58531-1-ivan@cloudflare.com> From: Ignat Korchagin Date: Mon, 10 Jul 2023 19:43:00 +0100 Message-ID: Subject: Re: [PATCH] kernfs: attach uuid for every kernfs and report it in fsid To: Ivan Babrou Cc: linux-fsdevel@vger.kernel.org, kernel-team@cloudflare.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Greg Kroah-Hartman , Tejun Heo , Hugh Dickins , Andrew Morton , Amir Goldstein , Christoph Hellwig , Jan Kara , Zefan Li , Johannes Weiner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 10, 2023 at 7:33=E2=80=AFPM Ivan Babrou w= rote: > > The following two commits added the same thing for tmpfs: > > * commit 2b4db79618ad ("tmpfs: generate random sb->s_uuid") > * commit 59cda49ecf6c ("shmem: allow reporting fanotify events with file = handles on tmpfs") > > Having fsid allows using fanotify, which is especially handy for cgroups, > where one might be interested in knowing when they are created or removed= . > > Signed-off-by: Ivan Babrou > --- > fs/kernfs/mount.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c > index d49606accb07..930026842359 100644 > --- a/fs/kernfs/mount.c > +++ b/fs/kernfs/mount.c > @@ -16,6 +16,8 @@ > #include > #include > #include > +#include > +#include > > #include "kernfs-internal.h" > > @@ -45,8 +47,15 @@ static int kernfs_sop_show_path(struct seq_file *sf, s= truct dentry *dentry) > return 0; > } > > +int kernfs_statfs(struct dentry *dentry, struct kstatfs *buf) This probably should be declared static > +{ > + simple_statfs(dentry, buf); > + buf->f_fsid =3D uuid_to_fsid(dentry->d_sb->s_uuid.b); > + return 0; > +} > + > const struct super_operations kernfs_sops =3D { > - .statfs =3D simple_statfs, > + .statfs =3D kernfs_statfs, > .drop_inode =3D generic_delete_inode, > .evict_inode =3D kernfs_evict_inode, > > @@ -351,6 +360,8 @@ int kernfs_get_tree(struct fs_context *fc) > } > sb->s_flags |=3D SB_ACTIVE; > > + uuid_gen(&sb->s_uuid); > + > down_write(&root->kernfs_supers_rwsem); > list_add(&info->node, &info->root->supers); > up_write(&root->kernfs_supers_rwsem); > -- > 2.41.0 > Ignat