Commit 07b92d0d570c903aeef4f3b76ebbdd728bc72805
1 parent
ce2ac52105
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
POSIX extensions disabled on client due to illegal O_EXCL flag sent to Samba
Samba rejected libreoffice's attempt to open a file with illegal O_EXCL (without O_CREAT). Mask this flag off (as the local linux file system case does) for this case, so that we don't have disable Unix Extensions unnecessarily due to the Samba error (Samba server is also being fixed). See https://bugzilla.samba.org/show_bug.cgi?id=9519 Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Showing 1 changed file with 9 additions and 3 deletions Side-by-side Diff
fs/cifs/file.c
... | ... | @@ -43,6 +43,7 @@ |
43 | 43 | #include "cifs_fs_sb.h" |
44 | 44 | #include "fscache.h" |
45 | 45 | |
46 | + | |
46 | 47 | static inline int cifs_convert_flags(unsigned int flags) |
47 | 48 | { |
48 | 49 | if ((flags & O_ACCMODE) == O_RDONLY) |
49 | 50 | |
... | ... | @@ -72,10 +73,15 @@ |
72 | 73 | else if ((flags & O_ACCMODE) == O_RDWR) |
73 | 74 | posix_flags = SMB_O_RDWR; |
74 | 75 | |
75 | - if (flags & O_CREAT) | |
76 | + if (flags & O_CREAT) { | |
76 | 77 | posix_flags |= SMB_O_CREAT; |
77 | - if (flags & O_EXCL) | |
78 | - posix_flags |= SMB_O_EXCL; | |
78 | + if (flags & O_EXCL) | |
79 | + posix_flags |= SMB_O_EXCL; | |
80 | + } else if (flags & O_EXCL) | |
81 | + cFYI(1, "Application %s pid %d has incorrectly set O_EXCL flag" | |
82 | + "but not O_CREAT on file open. Ignoring O_EXCL", | |
83 | + current->comm, current->tgid); | |
84 | + | |
79 | 85 | if (flags & O_TRUNC) |
80 | 86 | posix_flags |= SMB_O_TRUNC; |
81 | 87 | /* be safe and imply O_SYNC for O_DSYNC */ |