: CIFS: block in wait_for_free_credits when open file for SMB1.0
Subsystems (2)
Hi,
Setup samba server on v5.1-rc3 and mount it in local with vers=1.0. Use the reproducer below to test if open file succesffully after unlink. The process blocked in wait_for_free_credits and never return. SMB2.0+ don't have this issue because of
https://bugzilla.kernel.org/show_bug.cgi?id=203271
It's a regression issue. Testing pass on v4.9-rc8 but start failed after v5.0.
[<0>] wait_for_free_credits+0x258/0x460 [cifs] [<0>] SendReceive+0xcd/0x360 [cifs] [<0>] CIFSPOSIXCreate+0x1bf/0x440 [cifs] [<0>] cifs_posix_open+0x1ee/0x300 [cifs] [<0>] cifs_do_create+0x447/0x710 [cifs] [<0>] cifs_atomic_open+0x1ab/0x530 [cifs] [<0>] path_openat+0xd54/0x1670 [<0>] do_filp_open+0x93/0x100 [<0>] do_sys_open+0x186/0x220 [<0>] do_syscall_64+0x55/0x1a0 [<0>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[<0>] 0xffffffffffffffff
reproducer.c:
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/file.h>
#include <errno.h>
void test()
{
int fd;
int ret;
fd = open("./testfile",O_RDWR|O_CREAT,0644);
printf("errno=%d\n",errno);
if (fd < 0)
{
perror("open failed");
exit(1);
}
ret = unlink("./testfile");
if (ret < 0)
{
perror("unlink failed");
exit(1);
}
//add close(fd) here, then does not block.
}
int main(int argc, char **argv)
{
int index=50;
while(index)
{
index--;
printf("loop %d\n",index);
test();
}
return 0;
}I reported it in https://bugzilla.kernel.org/show_bug.cgi?id=203269
Signature · 8 lines
Best regards! XiaoLi Feng 冯小丽 Red Hat Software (Beijing) Co.,Ltd filesystem-qe Team IRC:xifeng,#channel: fs-qe Tel:+86-10-8388112 9/F, Raycom
Ronnie's patch fixed this and I have merged into cifs-2.6.git for-next and added cc:stable
Quoted 74 lines · Xiaoli Feng
Hi,
Setup samba server on v5.1-rc3 and mount it in local with vers=1.0. Use the reproducer below to test if open file succesffully after unlink. The process blocked in
wait_for_free_creditsand never return. SMB2.0+ don't have this issue because ofhttps://bugzilla.kernel.org/show_bug.cgi?id=203271
It's a regression issue. Testing pass on v4.9-rc8 but start failed after v5.0.
[<0>] wait_for_free_credits+0x258/0x460 [cifs] [<0>] SendReceive+0xcd/0x360 [cifs] [<0>] CIFSPOSIXCreate+0x1bf/0x440 [cifs] [<0>] cifs_posix_open+0x1ee/0x300 [cifs] [<0>] cifs_do_create+0x447/0x710 [cifs] [<0>] cifs_atomic_open+0x1ab/0x530 [cifs] [<0>] path_openat+0xd54/0x1670 [<0>] do_filp_open+0x93/0x100 [<0>] do_sys_open+0x186/0x220 [<0>] do_syscall_64+0x55/0x1a0 [<0>] entry_SYSCALL_64_after_hwframe+0x44/0xa9[<0>]
0xffffffffffffffff
reproducer.c:
#define_GNU_SOURCE
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/file.h>
#include <errno.h>
voidtest(){ int fd; int ret; fd = open("./testfile",O_RDWR|O_CREAT,0644); printf("errno=%d\n",errno); if (fd < 0) { perror("open failed"); exit(1); } ret = unlink("./testfile"); if (ret < 0) { perror("unlink failed"); exit(1); } //add close(fd) here, then does not block. } int main(int argc, char **argv) { int index=50; while(index) { index--; printf("loop %d\n",index); test(); } return 0; }I reported it in https://bugzilla.kernel.org/show_bug.cgi?id=203269
--
Best regards!
XiaoLi Feng 冯小丽Red Hat Software (Beijing) Co.,Ltd
filesystem-qe Team
IRC:xifeng,#channel: fs-qe
Tel:+86-10-8388112
9/F, Raycom
Signature · 3 lines
Thanks, Steve