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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 435BCC4332F for ; Mon, 4 Apr 2022 21:17:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379445AbiDDVTj (ORCPT ); Mon, 4 Apr 2022 17:19:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380149AbiDDTEi (ORCPT ); Mon, 4 Apr 2022 15:04:38 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D1D033E02 for ; Mon, 4 Apr 2022 12:02:41 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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