From: Paulo Alcantara <pc@manguebit.com>
To: David Howells <dhowells@redhat.com>
Cc: dhowells@redhat.com, Steve French <sfrench@samba.org>,
Shyam Prasad N <sprasad@microsoft.com>,
linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cifs: Fix reacquisition of volume cookie on still-live connection
Date: Fri, 19 Apr 2024 17:04:11 -0300 [thread overview]
Message-ID: <5d354377e2ba2f8f4ed249bf7633fd71@manguebit.com> (raw)
In-Reply-To: <564520.1713447839@warthog.procyon.org.uk>
David Howells <dhowells@redhat.com> writes:
> Paulo Alcantara <pc@manguebit.com> wrote:
>
>> I don't know why it was designed that way, but the reason we have two
>> different superblocks with ${opts} being the same is because cifs.ko
>> relies on the value of cifs_sb_info::prepath to build paths out of
>> dentries. See build_path_from_dentry(). So, when you access
>> /mnt/2/foo, cifs.ko will build a path like '[optional tree name prefix]
>> + cifs_sb_info::prepath + \foo' and then reuse connections
>> (server+session+tcon) from first superblock to perform I/O on that file.
>
> Yep. You don't *need* prepath. You could always build from the sb->s_root
> without a prepath and have mnt->mnt_root offset the place the VFS thinks you
> are:
>
> [rootdir]/ <--- s_root points here
> |
> v
> foo/
> |
> v
> bar/ <--- mnt_root points here
> |
> v
> a
>
> Without prepath, you build back up the tree { a, bar/, foo/, [rootdir] } with
> prepath you insert the prepath at the end.
>
> Bind mounts just make the VFS think it's starting midway down, but you build
> up back to s_root.
>
> Think of a mount as just referring to a subtree of the tree inside the
> superblock. The prepath is just an optimisation - but possibly one that makes
> sense for cifs if you're having to do pathname fabrication a lot.
Thanks alot Dave! Great explanation. We also need to remember that
those prefix paths can also be changed over reconnect. That is, if
you're currently mounted to a DFS link target '\srv1\share' and client
failovers to next target '\srv2\share\foo\bar', cifs_sb_info::prepath
will be set to '\foo\bar'. And if you mounted the DFS link as
`mount.cifs //dfs/link/some/dir`, cifs_sb_info::prepath would be set to
'\some\dir\foo\bar'. Yeah, a lot of corner cases to handle...
Anyways, don't worry much about all of this as we can handle in
follow-up patches.
FWIW, patch looks good:
Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
next prev parent reply other threads:[~2024-04-19 20:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-04 15:21 [PATCH] cifs: Fix reacquisition of volume cookie on still-live connection David Howells
2024-04-04 16:07 ` Paulo Alcantara
2024-04-16 16:58 ` David Howells
2024-04-17 14:09 ` Paulo Alcantara
2024-04-17 14:38 ` David Howells
2024-04-17 18:59 ` Tom Talpey
2024-04-18 13:32 ` David Howells
2024-04-17 21:25 ` Paulo Alcantara
2024-04-18 13:43 ` David Howells
2024-04-19 20:04 ` Paulo Alcantara [this message]
2024-04-17 13:41 ` David Howells
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=5d354377e2ba2f8f4ed249bf7633fd71@manguebit.com \
--to=pc@manguebit.com \
--cc=dhowells@redhat.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sfrench@samba.org \
--cc=sprasad@microsoft.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.