Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@manguebit.com>
To: meetakshisetiyaoss@gmail.com, linux-cifs@vger.kernel.org,
	smfrench@gmail.com, nspmangalore@gmail.com,
	bharathsm.hsk@gmail.com, lsahlber@redhat.com, tom@talpey.com
Cc: Meetakshi Setiya <msetiya@microsoft.com>
Subject: Re: [PATCH] cifs: Reuse file lease key in compound operations
Date: Tue, 05 Dec 2023 16:32:13 -0300	[thread overview]
Message-ID: <65d6d76197069e56b472bbfead425913@manguebit.com> (raw)
In-Reply-To: <20231204045632.72226-1-meetakshisetiyaoss@gmail.com>

meetakshisetiyaoss@gmail.com writes:

> From: Meetakshi Setiya <msetiya@microsoft.com>
>
> Lock contention during unlink operation causes cifs lease break ack
> worker thread to block and delay sending lease break acks to server.
> This case occurs when multiple threads perform unlink, write and lease
> break acks on the same file. Thhis patch fixes the problem by reusing
> the existing lease keys for rename, unlink and set path size compound
> operations so that the client does not break its own lease.
>
> Signed-off-by: Meetakshi Setiya <msetiya@microsoft.com>
> ---
>  fs/smb/client/cifsglob.h  |  6 ++---
>  fs/smb/client/cifsproto.h |  8 +++----
>  fs/smb/client/cifssmb.c   |  6 ++---
>  fs/smb/client/inode.c     | 12 +++++-----
>  fs/smb/client/smb2inode.c | 49 +++++++++++++++++++++++++--------------
>  fs/smb/client/smb2proto.h |  8 +++----
>  6 files changed, 51 insertions(+), 38 deletions(-)

NAK.  This patch broke some xfstests.

Consider this reproducer:

$ cat repro.sh
#!/bin/sh

umount /mnt/1 &>/dev/null
mount.cifs //srv/share /mnt/1 -o ...,vers=3.1.1
rm /mnt/1/* &>/dev/null
pushd /mnt/1 >/dev/null
touch foo
ln -v foo bar
rm -v bar
popd >/dev/null
umount /mnt/1 &>/dev/null
$ ./repro.sh
'bar' => 'foo'
rm: cannot remove 'bar': Invalid argument

This is what going on

- client creates 'foo' with RHW lease granted.
- client creates hardlink file 'bar'.

At this point, we have two positive dentries (foo & bar) which share
same inode.

- The client then attempts to remove 'bar' by re-using lease key from
'foo' through compound request CREATE(DELETE)+CLOSE, which fails with
STATUS_INVALID_PARAMETER.

  parent reply	other threads:[~2023-12-05 19:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04  4:56 [PATCH] cifs: Reuse file lease key in compound operations meetakshisetiyaoss
2023-12-04 12:19 ` Shyam Prasad N
2023-12-04 20:23 ` Steve French
2023-12-05 10:36   ` Shyam Prasad N
2023-12-05 19:32 ` Paulo Alcantara [this message]
2023-12-06  5:31   ` Shyam Prasad N
2023-12-06  5:38     ` Meetakshi Setiya
2023-12-06 13:42     ` Tom Talpey
2023-12-08 10:58       ` Shyam Prasad N
2023-12-08 14:02         ` Tom Talpey
2023-12-08 17:45           ` Jeremy Allison
2023-12-06 14:08     ` Paulo Alcantara
2023-12-08 10:37       ` Meetakshi Setiya
2023-12-08 13:43         ` Tom Talpey

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=65d6d76197069e56b472bbfead425913@manguebit.com \
    --to=pc@manguebit.com \
    --cc=bharathsm.hsk@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lsahlber@redhat.com \
    --cc=meetakshisetiyaoss@gmail.com \
    --cc=msetiya@microsoft.com \
    --cc=nspmangalore@gmail.com \
    --cc=smfrench@gmail.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