Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2152305rwd; Sun, 21 May 2023 14:24:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ70GtK3HscwOiLG3eeTYD2T2HPiie4O3W/m6411+aBGg0kHDRMaQ/4rAsnFKR2BIfvGcBAv X-Received: by 2002:a17:903:22c1:b0:1ac:5c53:2c1b with SMTP id y1-20020a17090322c100b001ac5c532c1bmr10539187plg.66.1684704288552; Sun, 21 May 2023 14:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684704288; cv=none; d=google.com; s=arc-20160816; b=Q2sAyMibUiwgjepa7j42YaIM/r0am3etc/S6/aR/ynWqyufVB/wmi+1Ceoq7wZnNLt McA2YFiSDr3wytUYZ1+yg+iJxxRf5u3OM1gFHjDElSSH6LrbZfyLqjR6x5Mr6VW9zDru 0had1GskDsr7uFqClIUSaEZMjiX4hxo906HvsNmGltWVn03OskdbY2fIiiyA+0L3ZeR2 yPklYAdG/Mm5PNphPz8Tau0sdCizSqpMxcO0yAdP/G1Bb+dNuUTSp1dePccvC41qxHot KlMODPDJnPhMFWY6JGQCxax28KC9y0Q8GR2K1XcAgAJ6NzSBs2U9xnBU5l31UeIb6l6E ohKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date; bh=MaCcEPUzFCH1BIaSiowkXp0XobVHT5/ChFHAH49+vyU=; b=0bOoPAUYhDUml3Pid3iA7J2Oc0/fcx9eEZBC34d4Q2Q6e63Gp1KZGQK2uoyPqf4vrt Ul5Qawt0rQ0i33HqFG2on7bk98Pa8Xb3HfGcnZcRF3eiz2jCV0lvIw7mLxPg4StTYtEk NmJillre6oE9RF0T2dkhC9ZM4Pk93DrwdsV7O6Y5tqJgZrJfZi/jbkq43rNzWBbZWetD Gfwoc7aNSxtMfNeYg5yl1zy4gR5ZTsEY7fCY8MNBZ6RsgE3DlyhspQeiAYp545uNEFVK i6Xvh4eGbt0u9btqVLcs8PkNggDnq5vw/Us4YH2NNT1Y0E92hKEGqpYeZLi8LeKBVO4u yoFw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a170902cec700b001afac49e04dsi1359161plg.642.2023.05.21.14.24.37; Sun, 21 May 2023 14:24:48 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229481AbjEUVOJ convert rfc822-to-8bit (ORCPT + 99 others); Sun, 21 May 2023 17:14:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229993AbjEUVOD (ORCPT ); Sun, 21 May 2023 17:14:03 -0400 Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 368E6B4; Sun, 21 May 2023 14:14:00 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 224F8616B2D5; Sun, 21 May 2023 23:13:58 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id rrieuuPGfCQW; Sun, 21 May 2023 23:13:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 5F4AA616B2E1; Sun, 21 May 2023 23:13:57 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id o4O3u6pDXA4P; Sun, 21 May 2023 23:13:57 +0200 (CEST) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 34319616B2D5; Sun, 21 May 2023 23:13:57 +0200 (CEST) Date: Sun, 21 May 2023 23:13:56 +0200 (CEST) From: Richard Weinberger To: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= Cc: anton ivanov , Johannes Berg , Christopher Obbard , Guenter Roeck , =?utf-8?Q?G=C3=BCnther?= Noack , kuba , James Morris , Jeff Xu , Kees Cook , Paul Moore , Ritesh Raj Sarraf , "Serge E. Hallyn" , Shuah Khan , Sjoerd Simons , Willem de Bruijn , linux-fsdevel , linux-kernel , linux-kselftest , LSM , stable Message-ID: <133970354.9328381.1684703636966.JavaMail.zimbra@nod.at> In-Reply-To: <20230309165455.175131-2-mic@digikod.net> References: <20230309165455.175131-1-mic@digikod.net> <20230309165455.175131-2-mic@digikod.net> Subject: Re: [PATCH v1 1/5] hostfs: Fix ephemeral inodes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF97 (Linux)/8.8.12_GA_3809) Thread-Topic: hostfs: Fix ephemeral inodes Thread-Index: tKJAlvYqiwgTPVoEW6hlXkXRgBTN3A== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=ham 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 ----- Ursprüngliche Mail ----- > Von: "Mickaël Salaün" > hostfs creates a new inode for each opened or created file, which created > useless inode allocations and forbade identifying a host file with a kernel > inode. > > Fix this uncommon filesystem behavior by tying kernel inodes to host > file's inode and device IDs. Even if the host filesystem inodes may be > recycled, this cannot happen while a file referencing it is open, which > is the case with hostfs. It should be noted that hostfs inode IDs may > not be unique for the same hostfs superblock because multiple host's > (backed) superblocks may be used. > > Delete inodes when dropping them to force backed host's file descriptors > closing. > > This enables to entirely remove ARCH_EPHEMERAL_INODES, and then makes > Landlock fully supported by UML. This is very useful for testing > (ongoing and backported) changes. Removing ARCH_EPHEMERAL_INODES should be a patch on its own, IMHO. > These changes also factor out and simplify some helpers thanks to the > new hostfs_inode_update() and the hostfs_iget() revamp: read_name(), > hostfs_create(), hostfs_lookup(), hostfs_mknod(), and > hostfs_fill_sb_common(). > > A following commit with new Landlock tests check this new hostfs inode > consistency. > > Cc: Anton Ivanov > Cc: Johannes Berg > Cc: Richard Weinberger > Cc: # 5.15.x: ce72750f04d6: hostfs: Fix writeback of > dirty pages > Cc: # 5.15+ I'm not sure whether this patch qualifies as stable material. While I fully agree that the current behavoir is odd, nothing user visible is really broken so far. > Signed-off-by: Mickaël Salaün > Link: https://lore.kernel.org/r/20230309165455.175131-2-mic@digikod.net Other than that, patch looks good to me. Thanks, //richard