From: Greg Kurz <groug@kaod.org>
To: <qemu-devel@nongnu.org>
Cc: virtio-fs@redhat.com,
Sebastian Hasler <sebastian.hasler@stuvus.uni-stuttgart.de>,
Stefan Hajnoczi <stefanha@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Vivek Goyal <vgoyal@redhat.com>
Subject: Re: [PATCH v5 2/3] virtiofsd: Track submounts
Date: Mon, 14 Feb 2022 16:43:14 +0100 [thread overview]
Message-ID: <20220214164314.0898c036@bahia> (raw)
In-Reply-To: <20220214135820.43897-3-groug@kaod.org>
On Mon, 14 Feb 2022 14:58:19 +0100
Greg Kurz <groug@kaod.org> wrote:
> If
> Support for FUSE_SYNCFS requires the server to track submounts
>
> that may exist under the shared directory. lo_do_lookup() already knows
> how to detect them : it is a directory with a different device ID or
> mount ID than its parent. Use the same logic and record the information
> under the lo_inode structure.
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
Oops I obviously did something wrong with the changelog. It should read:
---
If the server doesn't announce submounts to the client, it needs to
track them internally to properly support FUSE_SYNCFS. lo_do_lookup()
already knows how to detect them : it is a directory with a different
device ID or mount ID than its parent. Use the same logic and record
the information under the lo_inode structure.
---
I can send an updated version if needed.
> tools/virtiofsd/passthrough_ll.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
> index 2bf5d40df531..e94c4e6f8635 100644
> --- a/tools/virtiofsd/passthrough_ll.c
> +++ b/tools/virtiofsd/passthrough_ll.c
> @@ -118,6 +118,7 @@ struct lo_inode {
> GHashTable *posix_locks; /* protected by lo_inode->plock_mutex */
>
> mode_t filetype;
> + bool is_submount;
> };
>
> struct lo_cred {
> @@ -1017,6 +1018,7 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
> struct lo_data *lo = lo_data(req);
> struct lo_inode *inode = NULL;
> struct lo_inode *dir = lo_inode(req, parent);
> + bool is_submount;
>
> if (inodep) {
> *inodep = NULL; /* in case there is an error */
> @@ -1051,8 +1053,10 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
> goto out_err;
> }
>
> - if (S_ISDIR(e->attr.st_mode) && lo->announce_submounts &&
> - (e->attr.st_dev != dir->key.dev || mnt_id != dir->key.mnt_id)) {
> + is_submount = S_ISDIR(e->attr.st_mode) &&
> + (e->attr.st_dev != dir->key.dev || mnt_id != dir->key.mnt_id);
> +
> + if (is_submount && lo->announce_submounts) {
> e->attr_flags |= FUSE_ATTR_SUBMOUNT;
> }
>
> @@ -1079,6 +1083,7 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
> inode->key.ino = e->attr.st_ino;
> inode->key.dev = e->attr.st_dev;
> inode->key.mnt_id = mnt_id;
> + inode->is_submount = is_submount;
> if (lo->posix_lock) {
> pthread_mutex_init(&inode->plock_mutex, NULL);
> inode->posix_locks = g_hash_table_new_full(
> @@ -1100,8 +1105,9 @@ static int lo_do_lookup(fuse_req_t req, fuse_ino_t parent, const char *name,
>
> lo_inode_put(lo, &dir);
>
> - fuse_log(FUSE_LOG_DEBUG, " %lli/%s -> %lli\n", (unsigned long long)parent,
> - name, (unsigned long long)e->ino);
> + fuse_log(FUSE_LOG_DEBUG, " %lli/%s -> %lli%s\n",
> + (unsigned long long) parent, name, (unsigned long long) e->ino,
> + is_submount ? " (submount)" : "");
>
> return 0;
>
next prev parent reply other threads:[~2022-02-14 16:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-14 13:58 [PATCH v5 0/3] virtiofsd: Add support for FUSE_SYNCFS request Greg Kurz
2022-02-14 13:58 ` [PATCH v5 1/3] virtiofsd: Add support for FUSE_SYNCFS request with announce_submounts Greg Kurz
2022-02-14 15:43 ` [Virtio-fs] " German Maglione
2022-02-14 16:02 ` Greg Kurz
2022-02-14 13:58 ` [PATCH v5 2/3] virtiofsd: Track submounts Greg Kurz
2022-02-14 15:43 ` Greg Kurz [this message]
2022-02-14 13:58 ` [PATCH v5 3/3] virtiofsd: Add support for FUSE_SYNCFS request without announce_submounts Greg Kurz
2022-02-14 18:27 ` Vivek Goyal
2022-02-14 18:56 ` Vivek Goyal
2022-02-14 19:09 ` Vivek Goyal
2022-02-15 9:18 ` Greg Kurz
2022-02-15 17:27 ` Vivek Goyal
2022-02-15 9:12 ` Greg Kurz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220214164314.0898c036@bahia \
--to=groug@kaod.org \
--cc=dgilbert@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sebastian.hasler@stuvus.uni-stuttgart.de \
--cc=stefanha@redhat.com \
--cc=vgoyal@redhat.com \
--cc=virtio-fs@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).