Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp971411pxj; Fri, 21 May 2021 03:31:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfi9OGaKostD87yp72DcUafOPJPyjAsRd2T0G66KMVHI7t+Ybdz3gKOAs6Mi22IvNtNzM/ X-Received: by 2002:a05:6602:1223:: with SMTP id z3mr11304022iot.97.1621593106103; Fri, 21 May 2021 03:31:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621593106; cv=none; d=google.com; s=arc-20160816; b=L+1XZymUoqL1Eye+jckSwDBeMRt30OFkN48A4peFzMETrXvh19Ge64EuQKru2uvGkf zSVebGYSPlwlmyCM0VHBVwgrgRGgKsu3oD7qZRMdCQMOWHiyJyCmerxx/+ng+gG1SNF3 MsCTiOte+t2DDzRlPiUUYhWC3ZWZklNvyyJ0rZ2haNpysAXV9cPsd3wCQ3alDtv7/KGT E1kX0couM6F/1NwpG5NEXk7mN72j/j60VYfJLYPkCRqf0ULlYwnfX77WZjHLXB1jI96I WuQgOowwX4caHb22A20/mr65ouFERUoFSwUYGs4Mup3boKVjZRTcSc9KMgZpE7Tczvhp z4eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=Qc2uI2VejCuE8okP3Jl4rL/98MOoAiE2aGR04JGbSMs=; b=JN1rRfvXTc6JYA1bDowSgJuxhXGf34hmWoXNp6pYRJnyL0JPcKsDjAr40F4r/9+0h6 SuPvJQQ8KQvoWiIYa5KXXfI6Wt6sdc5XbSFKtElUWRSoNfMI9xKGmCsUGuqo4H/XPNaA Wfin71t+nSwkhxMpl6He41DlLLqI5b2LxvcqB+lOySq9FwPgu4iCbvvFJyKqEPZFB2Km lnzEqxi2BFODCMj1uf0Aj6f4otmtpNGvF2FJak0TtCot957JxLTnV5e5EGb8llUgqHoP 3CE8XpVkBjOYXQuHBERLN9ppmoDIIhBVdCPdauH324ttVrE8TiptVlULeFIO4HVFg7H9 fWuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 s4si6466998ilv.29.2021.05.21.03.31.32; Fri, 21 May 2021 03:31:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232927AbhEUIk5 convert rfc822-to-8bit (ORCPT + 99 others); Fri, 21 May 2021 04:40:57 -0400 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:57573 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230379AbhEUIk4 (ORCPT ); Fri, 21 May 2021 04:40:56 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-439-2qxIbDPeMrixVUQP_btX0g-1; Fri, 21 May 2021 04:39:31 -0400 X-MC-Unique: 2qxIbDPeMrixVUQP_btX0g-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87F65106BB24; Fri, 21 May 2021 08:39:30 +0000 (UTC) Received: from bahia.lan (ovpn-112-49.ams2.redhat.com [10.36.112.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 665FA10013D6; Fri, 21 May 2021 08:39:22 +0000 (UTC) Date: Fri, 21 May 2021 10:39:21 +0200 From: Greg Kurz To: Miklos Szeredi Cc: virtualization@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, virtio-fs-list , Stefan Hajnoczi , Max Reitz , Vivek Goyal Subject: Re: [PATCH v4 4/5] virtiofs: Skip submounts in sget_fc() Message-ID: <20210521103921.153a243d@bahia.lan> In-Reply-To: References: <20210520154654.1791183-1-groug@kaod.org> <20210520154654.1791183-5-groug@kaod.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=groug@kaod.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kaod.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 May 2021 10:26:27 +0200 Miklos Szeredi wrote: > On Thu, 20 May 2021 at 17:47, Greg Kurz wrote: > > > > All submounts share the same virtio-fs device instance as the root > > mount. If the same virtiofs filesystem is mounted again, sget_fc() > > is likely to pick up any of these submounts and reuse it instead of > > the root mount. > > > > On the server side: > > > > # mkdir ${some_dir} > > # mkdir ${some_dir}/mnt1 > > # mount -t tmpfs none ${some_dir}/mnt1 > > # touch ${some_dir}/mnt1/THIS_IS_MNT1 > > # mkdir ${some_dir}/mnt2 > > # mount -t tmpfs none ${some_dir}/mnt2 > > # touch ${some_dir}/mnt2/THIS_IS_MNT2 > > > > On the client side: > > > > # mkdir /mnt/virtiofs1 > > # mount -t virtiofs myfs /mnt/virtiofs1 > > # ls /mnt/virtiofs1 > > mnt1 mnt2 > > # grep virtiofs /proc/mounts > > myfs /mnt/virtiofs1 virtiofs rw,seclabel,relatime 0 0 > > none on /mnt/mnt1 type virtiofs (rw,relatime,seclabel) > > none on /mnt/mnt2 type virtiofs (rw,relatime,seclabel) > > > > And now remount it again: > > > > # mount -t virtiofs myfs /mnt/virtiofs2 > > # grep virtiofs /proc/mounts > > myfs /mnt/virtiofs1 virtiofs rw,seclabel,relatime 0 0 > > none on /mnt/mnt1 type virtiofs (rw,relatime,seclabel) > > none on /mnt/mnt2 type virtiofs (rw,relatime,seclabel) > > myfs /mnt/virtiofs2 virtiofs rw,seclabel,relatime 0 0 > > # ls /mnt/virtiofs2 > > THIS_IS_MNT2 > > > > Submount mnt2 was picked-up instead of the root mount. > > Why is this a problem? > It seems very weird to mount the same filesystem again and to end up in one of its submounts. We should have: # ls /mnt/virtiofs2 mnt1 mnt2 > Thanks, > Miklos