Re: Possible timeout problem when opening a file twice on a SMB mount

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx>:
>
> 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




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux