Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp969807pxj; Fri, 21 May 2021 03:29:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5nmzlFzdklw3bi8lTyKdOTckfVO5TJYQYbfzK7zq0V3Bof3ZhqtwX8KcRUS1tc3JtcvDt X-Received: by 2002:a05:6e02:2188:: with SMTP id j8mr11442717ila.194.1621592973925; Fri, 21 May 2021 03:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621592973; cv=none; d=google.com; s=arc-20160816; b=vH6dHFLsR4mAcC+H7wu/6T+0NsTs9HXK1l38hNwvdn6qIRU9lJLmdrFslRSgDlrGOc QyjRzH41F9d8IHBLFlgNGZhRMONvfvjMxp4S5CxaeM5eA6HKLGBPEcfj76ajynPnNmwt A9NrnHAPRukIHknm7Lr9J13LffM2eLMROIoUlzk8OaeirF3HVSB8r+u7acP4WpOKdVsF pQmfjj/8CylZTOtuWVGaMQOlQH8WsylWJhKW7z7joSNo9nwVZzsObOAjkD+p+kSbDmQX mcfgoxG3UrEJLYcWBObGM7Pj+ScP4hbCkkJwE2o5H8rBHXfEWBPL1zkeam/H+uKx4ndT UIrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=dIarhh7kQdoMISCJccKY5DYZHHV1dh+rcFxZJNgKlb4=; b=METkVxpovts+NUYCI1TCG2S6QKk1VTccnLdLVsIMm0outNWk5KrIjVZUeM3PIhnGj6 WjtfNQRJl/K2YhABfn9z2m0ywkQavy+TEACWHX/y7ctC21UoLottoI2wkF/UU17nIqyi Tzrs8WAk33OKvQlvay02vNjoAnGzJoQOsGZQftPmmBpV8PUW+XYod9gPIgjuMI4lck1c Ha0J8zkkgnwZ0cvipaG+vllOzYScb0RWzSZy7XeYafrS+IbC3AYKzSR5ljGC9xknYAgR XsLvlbbVvgv3NeCM6YJKK+TIP5h3nhGgaqUAvT4BmW+7WMeCGPwJ5R0iWuenv4hKsdEm 8B0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=A9wFJYoh; 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 k6si5042156ion.34.2021.05.21.03.29.21; Fri, 21 May 2021 03:29:33 -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; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=A9wFJYoh; 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 S231403AbhEUI2C (ORCPT + 99 others); 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-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