Linux-CIFS Archive mirror
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: Paulo Alcantara <pc@manguebit.com>
Cc: CIFS <linux-cifs@vger.kernel.org>, Xiaoli Feng <xifeng@redhat.com>
Subject: Re: [PATCH] smb: client: fix rename(2) regression against samba
Date: Fri, 19 Apr 2024 11:47:57 -0500	[thread overview]
Message-ID: <CAH2r5mv_pahAs=4VsMEh_Ctajf97W3+JAALve1qmOn7AHNCD9A@mail.gmail.com> (raw)
In-Reply-To: <20240419150507.554196-1-pc@manguebit.com>

I merged this into cifs-2.6.git for-next (pending more testing) but
wasn't able to reproduce
the problem. Would be useful to know if others could repro the problem
without the patch
(and verify that the patch fixes the problem).  Testing it now e.g.:
    http://smb311-linux-testing.southcentralus.cloudapp.azure.com/#/builders/5/builds/94

Also would like any feedback/testing/comments/opinions on David Howell's patch:

        cifs: Fix reacquisition of volume cookie on still-live connection

On Fri, Apr 19, 2024 at 10:05 AM Paulo Alcantara <pc@manguebit.com> wrote:
>
> After commit 2c7d399e551c ("smb: client: reuse file lease key in
> compound operations") the client started reusing lease keys for
> rename, unlink and set path size operations to prevent it from
> breaking its own leases and thus causing unnecessary lease breaks to
> same connection.
>
> The implementation relies on positive dentries and
> cifsInodeInfo::lease_granted to decide whether reusing lease keys for
> the compound requests.  cifsInodeInfo::lease_granted was introduced by
> commit 0ab95c2510b6 ("Defer close only when lease is enabled.") to
> indicate whether lease caching is granted for a specific file, but
> that can only happen until file is open, so
> cifsInodeInfo::lease_granted was left uninitialised in ->alloc_inode
> and then client started sending random lease keys for files that
> hadn't any leases.
>
> This fixes the following test case against samba:
>
> mount.cifs //srv/share /mnt/1 -o ...,nosharesock
> mount.cifs //srv/share /mnt/2 -o ...,nosharesock
> touch /mnt/1/foo; tail -f /mnt/1/foo & pid=$!
> mv /mnt/2/foo /mnt/2/bar # fails with -EIO
> kill $pid
>
> Fixes: 0ab95c2510b6 ("Defer close only when lease is enabled.")
> Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
> ---
>  fs/smb/client/cifsfs.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
> index d41eedbff674..8907bbcd9f96 100644
> --- a/fs/smb/client/cifsfs.c
> +++ b/fs/smb/client/cifsfs.c
> @@ -389,6 +389,7 @@ cifs_alloc_inode(struct super_block *sb)
>          * server, can not assume caching of file data or metadata.
>          */
>         cifs_set_oplock_level(cifs_inode, 0);
> +       cifs_inode->lease_granted = false;
>         cifs_inode->flags = 0;
>         spin_lock_init(&cifs_inode->writers_lock);
>         cifs_inode->writers = 0;
> --
> 2.44.0
>


-- 
Thanks,

Steve

      reply	other threads:[~2024-04-19 16:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19 15:05 [PATCH] smb: client: fix rename(2) regression against samba Paulo Alcantara
2024-04-19 16:47 ` Steve French [this message]

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='CAH2r5mv_pahAs=4VsMEh_Ctajf97W3+JAALve1qmOn7AHNCD9A@mail.gmail.com' \
    --to=smfrench@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=pc@manguebit.com \
    --cc=xifeng@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).