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 X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F5A4C433B4 for ; Fri, 21 May 2021 08:26:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29B4460FEF for ; Fri, 21 May 2021 08:26:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231532AbhEUI2C (ORCPT ); Fri, 21 May 2021 04:28:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231150AbhEUI2B (ORCPT ); Fri, 21 May 2021 04:28:01 -0400 Received: from mail-vk1-xa35.google.com (mail-vk1-xa35.google.com [IPv6:2607:f8b0:4864:20::a35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E138FC061574 for ; Fri, 21 May 2021 01:26:38 -0700 (PDT) Received: by mail-vk1-xa35.google.com with SMTP id w3so4073774vkb.4 for ; Fri, 21 May 2021 01:26:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dIarhh7kQdoMISCJccKY5DYZHHV1dh+rcFxZJNgKlb4=; b=A9wFJYohjkcV8tugshuuRX02q6IEX2iLWvkXjHmZ+HMZYQ5ZjqsxHKSGZ0NQtW/HO0 /aJ1C6CAxtiLU0C/FihkgYxwvey7608acACMtPrx2wuCh5EiBhdfGfMhSni50J/fl/7M +ukT3crol2UW/Q6v9bF4TfORWQmK0DAQ4OAbU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dIarhh7kQdoMISCJccKY5DYZHHV1dh+rcFxZJNgKlb4=; b=XcSSHnQPYBMIkodFGiTui4gm3Bon7dJaXGgQnjgGrHDpYNs28BYX/NhwKxbFOj9zX3 9WJesh/rWTdKrStojiDxObYhYnp9tl23cuwxDZakNI8HcRwUYlvalaG4r4tMOhIj/eaQ yfEjBS42KijD7C8ZikwbkOOxziq/2abM16mOr77PPDS81UdLgHur1bvPXvZL3NqhnGth il5BIye5n80rka5/gmGRIqgxd/nbWjYeYf/Z3VvQ/Ih12b0rewJoh8aC6SgyWoIurgkB eNCOacoFqLrfLfUfNDcVkKxL2Z04dQf+hmE0q/GOo9MG4G3FmaAYi35aWLF68lRWk9Ao 3ViA== X-Gm-Message-State: AOAM533vkb7zusJmeoKaSuRoFMSrtCGqkr6ddGqxp7VLHTde0NHi50z0 WWRveejRkYIQ1u++ORDsPL+xnpwECX8kM4qT/DTcOQ== X-Google-Smtp-Source: ABdhPJzPh2FreEu9W/lQvvjgADbqrEMI2cf6ldvFFN45zD3cS7pi8UeqXkjozk3x2P1C388OgWGOLzE9we0HREOJwmM= X-Received: by 2002:a1f:a802:: with SMTP id r2mr8911868vke.14.1621585598004; Fri, 21 May 2021 01:26:38 -0700 (PDT) MIME-Version: 1.0 References: <20210520154654.1791183-1-groug@kaod.org> <20210520154654.1791183-5-groug@kaod.org> In-Reply-To: <20210520154654.1791183-5-groug@kaod.org> From: Miklos Szeredi Date: Fri, 21 May 2021 10:26:27 +0200 Message-ID: Subject: Re: [PATCH v4 4/5] virtiofs: Skip submounts in sget_fc() To: Greg Kurz 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Thanks, Miklos From mboxrd@z Thu Jan 1 00:00:00 1970 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dIarhh7kQdoMISCJccKY5DYZHHV1dh+rcFxZJNgKlb4=; b=A9wFJYohjkcV8tugshuuRX02q6IEX2iLWvkXjHmZ+HMZYQ5ZjqsxHKSGZ0NQtW/HO0 /aJ1C6CAxtiLU0C/FihkgYxwvey7608acACMtPrx2wuCh5EiBhdfGfMhSni50J/fl/7M +ukT3crol2UW/Q6v9bF4TfORWQmK0DAQ4OAbU= MIME-Version: 1.0 References: <20210520154654.1791183-1-groug@kaod.org> <20210520154654.1791183-5-groug@kaod.org> In-Reply-To: <20210520154654.1791183-5-groug@kaod.org> From: Miklos Szeredi Date: Fri, 21 May 2021 10:26:27 +0200 Message-ID: Content-Type: text/plain; charset="UTF-8" Subject: Re: [Virtio-fs] [PATCH v4 4/5] virtiofs: Skip submounts in sget_fc() List-Id: Development discussions about virtio-fs List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: linux-kernel@vger.kernel.org, Max Reitz , virtio-fs-list , linux-fsdevel@vger.kernel.org, virtualization@lists.linux-foundation.org, Vivek Goyal 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? Thanks, Miklos