Created attachment 6431 [details] network cifs dump Description of problem: I get this error while trying to mount home directory from Samba 3.5.8 server: Apr 27 14:39:44 localhost kernel: [14858.888596] CIFS VFS: server 192.168.0.12 of type Samba 3.5.8 returned unexpected error on SMB posix open, disabling posix open support. Check if server update available. We use the 'pam_mount' package to mount Samba home directories. It is working in our labs with Fedora 13... However, now that this error disables 'SMB posix open' we are unable to use Samba for home directories. Here are our mount options (/etc/security/pam_mount.conf.xml): <volume fstype="cifs" server="ada.info.polymtl.ca" user="*" path="%(USER)" mountpoint="/usagers/%(USER)" options="dir_mode=0700,file_mode=0600,serverino,nobrl" /> On the server side, 'unix extensions' are enabled. Kernel version on the fedora-15-beta1 client: 2.6.38.3-18.fc15.i686.PAE A bug report was first published at RedHat: https://bugzilla.redhat.com/show_bug.cgi?id=700206 I'm also including a dump of the network communications I sent them...
This was originally opened as a kernel bug against Fedora, but it looks like a samba bug. I was able to reproduce this by opening a file with O_WRONLY|O_TRUNC. That's a valid combination of flags, that samba always returns an error on. From a smbd -d10 log: call_trans2setfilepathinfo(6) testfile (fnum -1) info_level=521 totdata=18 smbd_do_setfilepathinfo: testfile (fnum -1) info_level=521 totdata=18 smb_posix_open: invalid create mode 0x40 error packet at smbd/error.c(160) cmd=50 (SMBtrans2) NT_STATUS_INVALID_PARAMETER The part of smb_posix_open that sets up the create_disp looks wrong, as it seems to throw an error as it seems to indicate that SMB_O_TRUNC without SMB_O_CREAT is invalid, when that really shouldn't be the case.
True. There's no way in the server POSIX open code to get to : FILE_OVERWRITE which is what is required for (O_TRUNC|O_WRONLY). I'll attach a patch asap. Jeremy.
Created attachment 6432 [details] patch -- handle SMB_O_TRUNC without O_CREAT correctly Proposed patch. I believe this will fix the bug, but there may be a better way to do this and clean up this nasty if statement at the same time.
Yes there's a better way :-). Please wait until I've finished the fix. The problem was we are conflating the O_CREAT|O_EXCL with the O_TRUNC processing, they need to be separate. We need to chose using (O_CREAT|O_EXCL) first, then modify if O_TRUNC is set. This needs 2 separate switch statements. Jeremy.
Created attachment 6433 [details] git-am fix for 3.5.next Jeff please test. I'm adding this to master with an additional test in the run_simple_posix_open_test() code. Jeremy.
Comment on attachment 6433 [details] git-am fix for 3.5.next ACK. Patch seems to fix the reproducer.
Hello Jeff and Jeremy, I can confirm that this error is fixed for me. I recompiled samba-3.5.8 with the patch provided (git-am fix for 3.5.next) and no longer see the error message in my kernel logs. However, I'm still seeing a problem when I use KDE-6.2 (Fedora 15 beta1 + testing updates). When I use 'pam_mount' to automatically mount the user's home directory via CIFS I am not able to properly logout. I have to key in 'CTRL-ALT-BACKSPACE' to close the active session. I don't get this behaviour with a home that is local or via NFS with the above described client. I have a configuration working that uses Fedora 13 + KDE 4.5.5 + pam_mount on the client side. I've already opened a ticket at RedHat thinking that the above CIFS-VFS bug was not related: https://bugzilla.redhat.com/show_bug.cgi?id=700876 Should I wait to see what the Redhat developer says before going upstream on this Bugzilla?
Luc, that looks like a different issue. I'm going to re-assign this to Karolin so she can include the fix and get it into 3.5.next. Jeremy.
Pushed to v3-5-test. Closing out bug report. Please feel free to open a new bug report concerning the other issue. Thanks! Karolin