Re: [PATCH] cifs: Fix reacquisition of volume cookie on still-live connection
From: David Howells
Date: Wed Apr 17 2024 - 09:42:11 EST
Paulo Alcantara <pc@xxxxxxxxxxxxx> wrote:
> > [!] Note: Looking at cifs_mount_get_tcon(), a more general solution may
> > actually be required. Reacquiring the volume cookie isn't the only thing
> > that function does: it also partially reinitialises the tcon record without
> > any locking - which may cause live filesystem ops already using the tcon
> > through a previous mount to malfunction.
>
> Agreed.
Looking over the code again, I'm not sure whether is actually necessary - or
whether it is necessary and will be a bit nasty to implement as it will
require read locking also.
Firstly, reset_cifs_unix_caps() seems to re-set tcon->fsUnixInfo.Capability
and tcon->unix_ext, which it would presumably set to the same things - which
is probably fine.
However, cifs_qfs_tcon() makes RPC operations that reloads tcon->fsDevInfo and
tcon->fsAttrInfo - both of which may be being accessed without locks.
smb2_qfs_tcon() and smb3_qfs_tcon() alters everything cifs_qfs_tcon() does,
plus a bunch of extra tcon members. Can this locally cached information
change over time on the server whilst we have a connection to it?
David