linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Shilovsky <piastryyy@gmail.com>
To: Moritz M <mailinglist@moritzmueller.ee>
Cc: linux-cifs <linux-cifs@vger.kernel.org>
Subject: Re: Possible timeout problem when opening a file twice on a SMB mount
Date: Wed, 30 Oct 2019 14:51:15 -0700	[thread overview]
Message-ID: <CAKywueSWxDA5veCWjf+vGM96TSKrJbiddt93dv=arXyizJCbmw@mail.gmail.com> (raw)
In-Reply-To: <6492326ef9d8d1a9401fac243160646f@moritzmueller.ee>

Hi Moritz,

I think there is a difference in your setup between v5.2.21 and v5.3.7
kernels. I found the issue in oplock break processing that can happen
if you have several shares from the same server mounted on the client.
We put such shares in the list and any new share is being attached to
the beginning of the list. There is a bug in the code that causes the
client to process only the 1st share in the list skipping all the
others. I could repro it by mounting two shares in the order (test and
test2) and then doing two subsequent opens like in your original
repro. I doesn't repro if only one share is mounted for the reasons
mentioned before.

Could you test the patch to see if it works for your environment?

diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index 8db6201b18ba..527c9efd3de0 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -664,10 +664,10 @@ smb2_is_valid_oplock_break(char *buffer, struct
TCP_Server_Info *server)
        spin_lock(&cifs_tcp_ses_lock);
        list_for_each(tmp, &server->smb_ses_list) {
                ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
+
                list_for_each(tmp1, &ses->tcon_list) {
                        tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);

-                       cifs_stats_inc(&tcon->stats.cifs_stats.num_oplock_brks);
                        spin_lock(&tcon->open_file_lock);
                        list_for_each(tmp2, &tcon->openFileList) {
                                cfile = list_entry(tmp2, struct cifsFileInfo,
@@ -679,6 +679,8 @@ smb2_is_valid_oplock_break(char *buffer, struct
TCP_Server_Info *server)
                                        continue;

                                cifs_dbg(FYI, "file id match, oplock break\n");
+                               cifs_stats_inc(
+                                   &tcon->stats.cifs_stats.num_oplock_brks);
                                cinode = CIFS_I(d_inode(cfile->dentry));
                                spin_lock(&cfile->file_info_lock);
                                if (!CIFS_CACHE_WRITE(cinode) &&
@@ -702,9 +704,6 @@ smb2_is_valid_oplock_break(char *buffer, struct
TCP_Server_Info *server)
                                return true;
                        }
                        spin_unlock(&tcon->open_file_lock);
-                       spin_unlock(&cifs_tcp_ses_lock);
-                       cifs_dbg(FYI, "No matching file for oplock break\n");
-                       return true;
                }
        }
        spin_unlock(&cifs_tcp_ses_lock);


--
Best regards,
Pavel Shilovsky

ср, 30 окт. 2019 г. в 06:26, Moritz M <mailinglist@moritzmueller.ee>:
>
> Pavel,
>
> meanwhile I updated to the supported kernels. The strange thing is, in
> the kernel 5.2.21 in my distro (Manjaro) it works.
>
> While it is not working with 5.3.7.
>
> I checked the kernel sources of my distro and the patch is included
> there.
>
> I've attached a pcap and the dmesg output when using my small demo tool.
>
> Can you check if it is the same issue as before or something different?
>
>
>
> $ uname -r
> 5.3.7-2-MANJARO
>
> $ mount.cifs -V
> mount.cifs version: 6.8
>
> $ samba --version
> Version 4.10.8
>
> Thanks
> Moritz

  reply	other threads:[~2019-10-30 21:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20 10:57 Possible timeout problem when opening a file twice on a SMB mount Moritz M
2019-09-20 23:26 ` Pavel Shilovsky
2019-09-23 14:04   ` Moritz M
2019-09-24 18:11     ` ronnie sahlberg
2019-09-24 19:05       ` Pavel Shilovsky
2019-09-24 21:06         ` Pavel Shilovsky
2019-09-25 19:23           ` Moritz M
2019-09-25 20:54             ` Pavel Shilovsky
2019-09-26 10:53               ` Moritz M
2019-09-26 18:58                 ` Pavel Shilovsky
2019-10-30 13:26                   ` Moritz M
2019-10-30 21:51                     ` Pavel Shilovsky [this message]
2019-10-31  9:20                       ` Moritz M
2019-10-31 21:01                         ` Pavel Shilovsky
2019-09-24 19:33       ` Moritz M

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='CAKywueSWxDA5veCWjf+vGM96TSKrJbiddt93dv=arXyizJCbmw@mail.gmail.com' \
    --to=piastryyy@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=mailinglist@moritzmueller.ee \
    /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 NNTP newsgroup(s).