Comment 14 for bug 2060919

Revision history for this message
Matthew Ruffell (mruffell) wrote : Re: Remote filesystems mounted as CIFS not working after update to Kernel "6.5.0-27-generic #28-Ubuntu" (amd64) or Kernel "6.5.0-1014-raspi #17-Ubuntu" (aarch64).

Hello,

I can't actually reproduce the issue, I seem to be missing something.

Server
------

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install samba
$ sudo vim /etc/samba/smb.conf
server min protocol = NT1
[sambashare]
    comment = Samba on Ubuntu
    path = /home/ubuntu/sambashare
    read only = no
    browsable = yes
$ mkdir ~/sambashare
$ sudo smbpasswd -a ubuntu

Client
------

$ sudo apt update
$ sudo apt install cifs-utils
$ mkdir ~/share
$ sudo mount -t cifs -o username=ubuntu //192.168.122.185/sambashare ~/share
Password for ubuntu@//192.168.122.185/sambashare:
$ mount -l
...
//192.168.122.185/sambashare on /home/ubuntu/share type cifs (rw,relatime,vers=3.1.1,cache=strict,username=ubuntu,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.122.185,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,closetimeo=1)

$ ls
hallo.txt hello.txt sample.txt sample2.txt
$ sudo cp hello.txt hello.txt.1
$ ll
total 2097176
drwxr-xr-x 2 root root 0 Apr 19 04:46 ./
drwxr-x--- 5 ubuntu ubuntu 4096 Apr 19 03:57 ../
-rwxr-xr-x 1 root root 1960 Apr 19 03:55 hallo.txt*
-rwxr-xr-x 1 root root 1960 Apr 19 04:04 hello.txt*
-rwxr-xr-x 1 root root 1960 Apr 19 04:46 hello.txt.1*
-rwxr-xr-x 1 root root 1073741824 Apr 19 04:01 sample.txt*
-rwxr-xr-x 1 root root 1073741824 Apr 19 04:04 sample2.txt*

No oops in dmesg. I'm not sure what I'm doing wrong. Maybe you can help.

Anyway, I had a look at the stack trace, and it seems to be related to the regression reported here:

https://lore.kernel<email address hidden>/T/

But I think its slightly different in the Ubuntu 6.5 kernel.

The thread mentions that:

commit 7b2404a886f8b91250c31855d287e632123e1746
Author: David Howells <email address hidden>
Date: Fri Dec 1 00:22:00 2023 +0000
Subject: cifs: Fix flushing, invalidation and file size with copy_file_range()
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7b2404a886f8b91250c31855d287e632123e1746

introduced the issue to Debian's 6.1 kernel.

This got backported to Ubuntu in:

commit 3adbe2ccd8b9b8fde93e03958d6176945794d288
Author: David Howells <email address hidden>
Date: Fri Dec 1 00:22:00 2023 +0000
Subject: cifs: Fix flushing, invalidation and file size with copy_file_range()

$ git describe --contains 3adbe2ccd8b9b8fde93e03958d6176945794d288
Ubuntu-6.5.0-20.20~107

Which we have been using for some time now.

Reading the regression mailing list thread, they mention that things work differently in 6.1:

> Yeah. __filemap_get_folio() works differently in v6.1.y. There it returns a
> folio or NULL. In 6.7 it returns a folio or a negative error code. The error
> check in cifs_flush_folio() needs to change to something like:
>
> folio = filemap_get_folio(inode->i_mapping, index);
> if (!folio)
> return -ENOMEM;
>
> David

okay... so 6.1 is different from 6.5. Since we were okay with the patch, we probably didn't need to add anything further.

But they fixed 6.1 with:

commit 21bb2ba4f1ac1e3a57594be62dd74e7b1401b2b1
Author: Steve French <email address hidden>
Date: Fri Jan 12 23:08:51 2024 -0600
Subject: cifs: fix flushing folio regression for 6.1 backport
Link: https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/mantic/commit/?id=21bb2ba4f1ac1e3a57594be62dd74e7b1401b2b1

Now, Ubuntu kernels in between upstream stable releases get patches from current upstream stable and long term upstream stable trees.

We got both 6.1.x and 6.7.x patches recently...

so we pulled in this fix, and it landed in:

$ git describe --contains 21bb2ba4f1ac1e3a57594be62dd74e7b1401b2b1
Ubuntu-6.5.0-27.28~162

Wow, what a coincidence.

I think this patch is probably not needed in 6.5, and causes the issue. How about I build you a test kernel with "cifs: fix flushing folio regression for 6.1 backport" reverted, and then we see if it fixes things?

If it does, I will send a revert to the kernel team. If it doesn't then I will have another look.

I'll write back once a test kernel is ready. I'll build you both Jammy HWE and Mantic kernels.

If you can help me make a reproducer, that would be great. I can test myself then.

Thanks,
Matthew