lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5d354377e2ba2f8f4ed249bf7633fd71@manguebit.com>
Date: Fri, 19 Apr 2024 17:04:11 -0300
From: Paulo Alcantara <pc@...guebit.com>
To: David Howells <dhowells@...hat.com>
Cc: dhowells@...hat.com, Steve French <sfrench@...ba.org>, Shyam Prasad N
 <sprasad@...rosoft.com>, linux-cifs@...r.kernel.org,
 linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cifs: Fix reacquisition of volume cookie on still-live
 connection

David Howells <dhowells@...hat.com> writes:

> Paulo Alcantara <pc@...guebit.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@...guebit.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ