From: Paulo Alcantara <pc@manguebit.com>
To: David Howells <dhowells@redhat.com>, Steve French <sfrench@samba.org>
Cc: dhowells@redhat.com, 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: Thu, 04 Apr 2024 13:07:24 -0300 [thread overview]
Message-ID: <14e66691a65e3d05d3d8d50e74dfb366@manguebit.com> (raw)
In-Reply-To: <3756406.1712244064@warthog.procyon.org.uk>
Hi Dave,
David Howells <dhowells@redhat.com> writes:
> During mount, cifs_mount_get_tcon() gets a tcon resource connection record
> and then attaches an fscache volume cookie to it. However, it does this
> irrespective of whether or not the tcon returned from cifs_get_tcon() is a
> new record or one that's already in use. This leads to a warning about a
> volume cookie collision and a leaked volume cookie because tcon->fscache
> gets reset.
>
> Fix this be adding a mutex and a "we've already tried this" flag and only
> doing it once for the lifetime of the tcon.
Can't we just move the cookie acquisition to cifs_get_tcon() before it
gets added to list @ses->tcon_list. This way we'll guarantee that the
cookie is set only once for the new tcon.
Besides, do we want to share a tcon with two different superblocks that
have 'fsc' and 'nofsc', respectively? If not, it would be better to fix
match_tcon() as well to handle such case.
> [!] 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.
next prev parent reply other threads:[~2024-04-04 16:07 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 [this message]
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
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=14e66691a65e3d05d3d8d50e74dfb366@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox