All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Shilovsky <piastryyy@gmail.com>
To: Murphy Zhou <jencce.kernel@gmail.com>
Cc: linux-cifs <linux-cifs@vger.kernel.org>,
	Jeff Layton <jlayton@kernel.org>,
	Steve French <smfrench@gmail.com>
Subject: Re: [PATCH v2] cifs: allow unlock flock and OFD lock across fork
Date: Tue, 3 Mar 2020 20:42:18 -0800	[thread overview]
Message-ID: <CAKywueTKmwyF0fO_ErFUXa2Jgq+F9xAUKgLdCWWWXXCfp2ih2g@mail.gmail.com> (raw)
In-Reply-To: <20200221023001.vcoc5f43rdqqeifn@xzhoux.usersys.redhat.com>

It looks that I forgot to ack the patch:

Acked-by: Pavel Shilovsky <pshilov@microsoft.com>

--
Best regards,
Pavel Shilovsky

чт, 20 февр. 2020 г. в 18:30, Murphy Zhou <jencce.kernel@gmail.com>:
>
> Since commit d0677992d2af ("cifs: add support for flock") added
> support for flock, LTP/flock03[1] testcase started to fail.
>
> This testcase is testing flock lock and unlock across fork.
> The parent locks file and starts the child process, in which
> it unlock the same fd and lock the same file with another fd
> again. All the lock and unlock operation should succeed.
>
> Now the child process does not actually unlock the file, so
> the following lock fails. Fix this by allowing flock and OFD
> lock go through the unlock routine, not skipping if the unlock
> request comes from another process.
>
> Patch has been tested by LTP/xfstests on samba and Windows
> server, v3.11, with or without cache=none mount option.
>
> [1] https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/flock/flock03.c
> Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
> ---
>  fs/cifs/smb2file.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c
> index afe1f03aabe3..eebfbf3a8c80 100644
> --- a/fs/cifs/smb2file.c
> +++ b/fs/cifs/smb2file.c
> @@ -152,7 +152,12 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
>                     (li->offset + li->length))
>                         continue;
>                 if (current->tgid != li->pid)
> -                       continue;
> +                       /*
> +                        * flock and OFD lock are associated with an open
> +                        * file description, not the process.
> +                        */
> +                       if (!(flock->fl_flags & (FL_FLOCK | FL_OFDLCK)))
> +                               continue;
>                 if (cinode->can_cache_brlcks) {
>                         /*
>                          * We can cache brlock requests - simply remove a lock
> --
> 2.20.1
>
>

  parent reply	other threads:[~2020-03-04  4:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21  2:30 [PATCH v2] cifs: allow unlock flock and OFD lock across fork Murphy Zhou
2020-02-26 15:39 ` Murphy Zhou
2020-02-26 18:41   ` Pavel Shilovsky
2020-03-04  2:33   ` Murphy Zhou
2020-03-04  4:42 ` Pavel Shilovsky [this message]
2020-03-04  6:18 ` Steve French

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=CAKywueTKmwyF0fO_ErFUXa2Jgq+F9xAUKgLdCWWWXXCfp2ih2g@mail.gmail.com \
    --to=piastryyy@gmail.com \
    --cc=jencce.kernel@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=smfrench@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.