From: Stefan Metzmacher <metze@samba.org>
To: Shyam Prasad N <nspmangalore@gmail.com>, Tom Talpey <tom@talpey.com>
Cc: Paulo Alcantara <pc@manguebit.com>,
Meetakshi Setiya <meetakshisetiyaoss@gmail.com>,
sprasad@microsoft.com, linux-cifs@vger.kernel.org,
samba-technical@lists.samba.org, sfrench@samba.org,
Meetakshi Setiya <msetiya@microsoft.com>,
bharathsm.hsk@gmail.com
Subject: Re: [PATCH 2/2] smb: client: retry compound request without reusing lease
Date: Fri, 5 Jan 2024 11:00:13 +0100 [thread overview]
Message-ID: <242e196c-dc38-49d2-a213-e703c3b4e647@samba.org> (raw)
In-Reply-To: <CANT5p=qqUbqbedW+ccdSQz2q1N-NNA-kqw4y8xSrfdOdbjAyjg@mail.gmail.com>
Am 05.01.24 um 10:39 schrieb Shyam Prasad N via samba-technical:
> On Fri, Jan 5, 2024 at 2:39 AM Tom Talpey <tom@talpey.com> wrote:
>>
>> On 1/3/2024 9:37 AM, Paulo Alcantara wrote:
>>> Meetakshi Setiya <meetakshisetiyaoss@gmail.com> writes:
>>>
>>>> As per the discussion with Tom on the previous version of the changes, I
>>>> conferred with Shyam and Steve about possible workarounds and this seemed like a
>>>> choice which did the job without much perf drawbacks and code changes. One
>>>> highlighted difference between the two could be that in the previous
>>>> version, lease
>>>> would not be reused for any file with hardlinks at all, even though the inode
>>>> may hold the correct lease for that particular file. The current changes
>>>> would take care of this by sending the lease at least once, irrespective of the
>>>> number of hardlinks.
>>>
>>> Thanks for the explanation. However, the code change size is no excuse
>>> for providing workarounds rather than the actual fix.
>>
>> I have to agree. And it really isn't much of a workaround either.
>>
>
> The original problem, i.e. compound operations like
> unlink/rename/setsize not sending a lease key is very prevalent on the
> field.
> Unfortunately, fixing that exposed this problem with hard links.
> So Steve suggested getting this fix to a shape where it's fixing the
> original problem, even if it means that it does not fix it for the
> case of where there are open handles to multiple hard links to the
> same file.
> Only thing we need to be careful of is that it does not make things
> worse for other workloads.
>
>>> A possible way to handle such case would be keeping a list of
>>> pathname:lease_key pairs inside the inode, so in smb2_compound_op() you
>>> could look up the lease key by using @dentry. I'm not sure if there's a
>>> better way to handle it as I haven't looked into it further.
>>
>
> This seems like a reasonable change to make. That will make sure that
> we stick to what the protocol recommends.
> I'm not sure that this change will be a simple one. There could be
> several places where we make an assumption that the lease is
> associated with an inode, and not a link.
>
> And I'm not yet fully convinced that the spec itself is doing the
> right thing by tying the lease with the link, rather than the file.
> Shouldn't the lease protect the data of the file, and not the link
> itself? If opening two links to the same file with two different lease
> keys end up breaking each other's leases, what's the point?
I guess the reason for making the lease key per path on
the client is that the client can't know about possible hardlinks
before opening the file, but that open wants to use a leasekey...
Or a "stat" open that won't any lease needs to be done first,
which doubles the roundtrip for every open.
And hard links are not that common...
Maybe choosing und using a new leasekey would be the
way to start with and when a hardlink is detected
the open on the hardlink is closed again and retried
with the former lease key, which would also upgrade it again.
But sharing the handle lease for two pathnames seems wrong,
as the idea of the handle lease is to cache the patchname on the client.
While sharing the RW lease between two hardlinks would be desired.
metze
next prev parent reply other threads:[~2024-01-05 10:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-29 14:35 [PATCH 1/2] smb: client: reuse file lease key in compound operations meetakshisetiyaoss
2023-12-29 14:35 ` [PATCH 2/2] smb: client: retry compound request without reusing lease meetakshisetiyaoss
2023-12-29 15:43 ` Paulo Alcantara
2024-01-03 4:35 ` Meetakshi Setiya
2024-01-03 14:37 ` Paulo Alcantara
2024-01-04 21:09 ` Tom Talpey
2024-01-04 23:09 ` Paulo Alcantara
2024-01-05 9:18 ` Shyam Prasad N
2024-01-05 9:39 ` Shyam Prasad N
2024-01-05 10:00 ` Stefan Metzmacher [this message]
2024-01-05 10:23 ` Shyam Prasad N
2024-01-05 10:38 ` Stefan Metzmacher
2024-01-05 10:58 ` Shyam Prasad N
2024-01-05 18:42 ` Steve French
2024-01-17 14:15 ` Meetakshi Setiya
2024-02-02 12:50 ` Meetakshi Setiya
2024-01-03 6:55 ` [PATCH 1/2] smb: client: reuse file lease key in compound operations kernel test robot
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=242e196c-dc38-49d2-a213-e703c3b4e647@samba.org \
--to=metze@samba.org \
--cc=bharathsm.hsk@gmail.com \
--cc=linux-cifs@vger.kernel.org \
--cc=meetakshisetiyaoss@gmail.com \
--cc=msetiya@microsoft.com \
--cc=nspmangalore@gmail.com \
--cc=pc@manguebit.com \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.org \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.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