From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7AAFC433F5 for ; Mon, 4 Apr 2022 19:03:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E756C6B0071; Mon, 4 Apr 2022 15:02:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E25396B0073; Mon, 4 Apr 2022 15:02:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D128B6B0074; Mon, 4 Apr 2022 15:02:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id BD81E6B0071 for ; Mon, 4 Apr 2022 15:02:51 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 88DAB6123D for ; Mon, 4 Apr 2022 19:02:41 +0000 (UTC) X-FDA: 79320118122.11.82F0157 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by imf07.hostedemail.com (Postfix) with ESMTP id 9EE8B40022 for ; Mon, 4 Apr 2022 19:02:40 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 110771F43E62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1649098959; bh=pugn5S7VdO0wPmpW5A+fiykzDKMwMJaojdp9rrctdjg=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=V2Mtng0FH8rgFWWh2tF4JhSoJ82sMvzu+bm6UN+TTwa8/krDm95V/KDoX/sqEkfft QCMMAT1Q4yX5U2de/zN7a1yvJIHiuhLFU2tmHhmyLaAdfQnEfo1aaWAvFRyNP91DEN WRohmDSKIJJlDbImVQuLO+ON8QHV/4Q043N2dKqvIPHrcUYpLGGCew20XIoUaKRGpr hXhRZfxH22JPIpPom7UKwwc/4nMe59mEwp1yqPsktf8HKLHEo8WvW9bvpvRCy9FmCO 4urdTe/uKl/M/Szhsr4C3BspCP2djA4H5zxlma7rjlKK5Y44p8BWfWVwvGh3+AjCYu 4A/OXHS8m9UeQ== From: Gabriel Krisman Bertazi To: Al Viro Cc: Hugh Dickins , Andrew Morton , Amir Goldstein , kernel@collabora.com, Khazhismel Kumykov , Linux MM , linux-fsdevel Subject: Re: [PATCH RESEND 2/3] shmem: Introduce /sys/fs/tmpfs support Organization: Collabora References: <20220404134137.26284-1-krisman@collabora.com> <20220404134137.26284-3-krisman@collabora.com> Date: Mon, 04 Apr 2022 15:02:35 -0400 In-Reply-To: (Al Viro's message of "Mon, 4 Apr 2022 14:02:38 +0000") Message-ID: <87zgl0y8ms.fsf@collabora.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Stat-Signature: omnw95y9rzm58k3qj96jcgm8xu9kehhn X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 9EE8B40022 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=V2Mtng0F; dmarc=pass (policy=none) header.from=collabora.com; spf=pass (imf07.hostedemail.com: domain of krisman@collabora.com designates 46.235.227.227 as permitted sender) smtp.mailfrom=krisman@collabora.com X-Rspam-User: X-HE-Tag: 1649098960-931671 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Al Viro writes: > On Mon, Apr 04, 2022 at 09:41:36AM -0400, Gabriel Krisman Bertazi wrote: >> In order to expose tmpfs statistics on sysfs, add the boilerplate code >> to create the /sys/fs/tmpfs structure. As suggested on a previous >> review, this uses the minor as the volume directory in /sys/fs/. >> >> This takes care of not exposing SB_NOUSER mounts. I don't think we have >> a usecase for showing them and, since they don't appear elsewhere, they >> might be confusing to users. >> >> Signed-off-by: Gabriel Krisman Bertazi > >> +static void shmem_unregister_sysfs(struct super_block *sb) >> +{ >> + struct shmem_sb_info *sbinfo = SHMEM_SB(sb); >> + >> + kobject_del(&sbinfo->s_kobj); >> + kobject_put(&sbinfo->s_kobj); >> + wait_for_completion(&sbinfo->s_kobj_unregister); >> +} > > If you embed kobject into something, you basically commit to > having the lifetime rules maintained by that kobject... Hi Viro, The way I'm doing it seems to be a pattern used by at least Ext4, f2fs and Btrfs. Is there a problem with embedding it in the superblock, holding a reference and then waiting for completion when umounting the fs? -- Gabriel Krisman Bertazi