tech-pkg archive

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

Re: samba4





On 26/05/21 5:54 pm, Mark Davies wrote:
On 25/05/21 3:29 pm, Mark Davies wrote:
On NetBSD 9.2_STABLE (amd64) using samba-4.13.7 I can happily export an smb share to Windows 10 and everything works happily but if I upgrade to 4.14.2 (or 4.14.4) and try to edit an EXISTING file (eg a text file with notepad) then when I go to save the file I get a "File exists" dialog box and it fails.

Anybody else seeing this?

Digging in to this some more, it looks like in source3/smbd/open.c open_file now returns NT_STATUS_OBJECT_NAME_COLLISION for this situation when previously it didn't.  And specifically where it used to call fd_open_atomic() to open the file and get the status its now calling reopen_from_fsp() which then calls reopen_from_procfd() which returns the status.


More digging. I've confirmed that 4.14.4 on linux with exactly the same setup works.

What seems to be happening is that smbd opens the file readonly and then tries to reopen the file readwrite via the fd in the /proc filesystem.
This works in linux:

1577334 openat(AT_FDCWD, "foo.txt", O_RDONLY|O_NOFOLLOW|O_PATH) = 48
   [...]
1577334 openat(AT_FDCWD, "/proc/self/fd/48", O_RDWR|O_CREAT|O_NONBLOCK, 0744) = 53
1577334 close(48)                       = 0

but doesn't in NetBSD (at least for me):

 16703    1 smbd     CALL  openat(0xffffff9c,0x7e1ae4126410,0x100,0)
 16703    1 smbd     NAMI  "foo.txt"
 16703    1 smbd     RET   openat 55/0x37
[...]
 16703    1 smbd     CALL  openat(0xffffff9c,0x7f7fffd16540,0x206,0x1e4)
 16703    1 smbd     NAMI  "/proc/self/fd/55"
 16703    1 smbd     RET   openat -1 errno 17 File exists


again is anyone else seeing this?  Should this work?

cheers
mark


Home | Main Index | Thread Index | Old Index