Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4317595pxv; Tue, 20 Jul 2021 00:18:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtXG28UcjpkpCQ41c3dDSzckn7z9xYJqS7/kmSoK/Ed7MI6U6YNzX1F4IxEYvcC4s6bxKm X-Received: by 2002:a17:906:3fc2:: with SMTP id k2mr15150923ejj.440.1626765491986; Tue, 20 Jul 2021 00:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626765491; cv=none; d=google.com; s=arc-20160816; b=DOU/2DeSKjL8J5Rbu0b0moQpbUTBzC1+ia+arWMwvghlr84p2bkDBm7siNwM/yw6/L v4uV0zKVArV1w3wCFKG73FP/7MmtacMlA0xZ3GySQugrAbk7UK179YlhK9DSGZGTXoBa NPE73iiIzAhFHK5rsgGdsePSpSkWQNMQ3HgF1HDqr6ZoNGocnHGEERWo9LIQHn3qs6uK lWky6QE59O8oXheU2zrnKBpt1lPKrE2dvzY99D1XLFIpa/G/WAKTfTPmHXymBiq5+ePt yzFMbfZBRhjbDydNH0hE9Kafpk9KWDPy70t7/uij1OKN4YRMoKSHG5m4JB4zr+SbRmj0 //fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=iSxL6Y+9oiEXAmxYmiKVE5BTquu8g7wV+aZTyTGOjdc=; b=g5DBN/4B2OUgWazkMgSzD4/oIEYpSfgS/RfSRiEq2QE/ZYX4SVu1dplhdFoSnBSlAK hjDUy2v7AtVcxFfHnFSkyoOlM85gheGjVYNYonh9sWyOE6hzhC/CsTTsUDuqsfKmF6Ux QB8Q9SSqKcSgy/xoUYzucbaEUT43WhQolKnfBkWNvPOD9EIT6yQaMsieOLPw9eR80jWe wRJbfnm02jjkTsgbg4Gpy0RLpUUTqmbHdyjjvsGWchvhJC2zqQxum4YU/WD4NRCNEntB YgX2WROqjdicukURdGkThKqo8+0AprXpqaKnPYXWziRE+E8TA9fOkDk2YshSQVkX7fjP 4QBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="fnTi/F+c"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=OyjTjOMo; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g14si22699470eds.289.2021.07.20.00.17.39; Tue, 20 Jul 2021 00:18:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="fnTi/F+c"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=OyjTjOMo; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229831AbhGTGgt (ORCPT + 99 others); Tue, 20 Jul 2021 02:36:49 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:50086 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbhGTGgo (ORCPT ); Tue, 20 Jul 2021 02:36:44 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5F9BD22363; Tue, 20 Jul 2021 07:17:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1626765442; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iSxL6Y+9oiEXAmxYmiKVE5BTquu8g7wV+aZTyTGOjdc=; b=fnTi/F+cRF31ctXj75etKh5AKCon3zXPQhmE5oY5dvyTYnHtovjZHVBIF2OIza3ZD/aAxO JOqBZGsUUXLR/3qUfC+5Cm3CuglTR2XslZJ3Zvw4ZDuYuNb6P2nBL78xGTyrZQ+URPNtHj 9yPPc3x9fyuhaKkjyZfUw7i/8TFHY6M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1626765442; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iSxL6Y+9oiEXAmxYmiKVE5BTquu8g7wV+aZTyTGOjdc=; b=OyjTjOMonJUuSlglWIu9Dp8FwZZvXpJr1khsXA/6TjkqlmRhhSi4Ya2TLwTbWCaLy7hy6m 9e8IyxB5rYNPTwCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E2A3013D5A; Tue, 20 Jul 2021 07:17:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id lPfmJH549mAHfAAAMHmgww (envelope-from ); Tue, 20 Jul 2021 07:17:18 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Christoph Hellwig" Cc: "Christoph Hellwig" , "Josef Bacik" , "J. Bruce Fields" , "Chuck Lever" , "Chris Mason" , "David Sterba" , linux-nfs@vger.kernel.org, "Wang Yugui" , "Ulli Horlacher" , linux-btrfs@vger.kernel.org Subject: Re: [PATCH/RFC] NFSD: handle BTRFS subvolumes better. In-reply-to: References: <20210613115313.BC59.409509F4@e16-tech.com>, <20210310074620.GA2158@tik.uni-stuttgart.de>, <162632387205.13764.6196748476850020429@noble.neil.brown.name>, , , <28bb883d-8d14-f11a-b37f-d8e71118f87f@toxicpanda.com>, , , , <162673888433.4136.7451392112850411713@noble.neil.brown.name>, Date: Tue, 20 Jul 2021 17:17:12 +1000 Message-id: <162676543271.12554.10226255548215795177@noble.neil.brown.name> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, 20 Jul 2021, Christoph Hellwig wrote: > On Tue, Jul 20, 2021 at 09:54:44AM +1000, NeilBrown wrote: > > Do you have any pointers to other breakage caused by this particular > > behaviour of btrfs? It would to have all requirements clearly on the > > table while designing a solution. >=20 > A quick google find: >=20 > https://lore.kernel.org/linux-btrfs/b5e7e64a-741c-baee-bc4d-cd51ca9b3a38@gm= ail.com/T/ > https://savannah.gnu.org/bugs/?50859 > https://github.com/coreos/bugs/issues/301 > https://bugs.kde.org/show_bug.cgi?id=3D317127 > https://github.com/borgbackup/borg/issues/4009 > https://bugs.python.org/issue37339 > http://mail.openjdk.java.net/pipermail/nio-dev/2017-June/004292.html >=20 > and that is just the first 2 or three pages of trivial search results. >=20 Thanks a lot for these! Very helpful. The details vary, but the core problem seems to be that the device number found in /proc/self/mountinfo is the same for all mounts from a given btrfs filesystem, no matter which subvol happens to be found at or beneath that mountpoint. So it can even be that 'stat' on a mountpoint returns different numbers to what is found for that mountpoint in /proc/self/mountinfo. To address these issues we would need to: 1/ make every btrfs subvol which is not already a mountpoint into an automount point which mounts the subvol (similar to the use of automount in NFS). 2/ either give each subvol a separate 'struct super_block' (which is apparently a bad idea) or change show_mountinfo() to allow an alternate dev_t to be used. e.g. some new s_op which is given mnt->mnt_root and returns a dev_t. If the new s_op is not available, sb->s_dev is used. For nfsd to be able to work with this, those automount points need to have an inode in the parent filesystem with a distinct inode number, and the mount must be marked in some way that nfsd can tell that it is "internal". Possibly a helper function that tests if mnt_parent has the same mnt.mnt_sb would be sufficient, though it might be nice to export this fact to user-space somehow. Also exportfs_decode_fh() needs to be enhanced, probably to return a 'struct path'. Does anything there seem unreasonable to you? Thanks, NeilBrown =20