Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 07b92d0d authored by Steve French's avatar Steve French
Browse files

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: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent ce2ac521
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -43,6 +43,7 @@
#include "cifs_fs_sb.h"
#include "cifs_fs_sb.h"
#include "fscache.h"
#include "fscache.h"



static inline int cifs_convert_flags(unsigned int flags)
static inline int cifs_convert_flags(unsigned int flags)
{
{
	if ((flags & O_ACCMODE) == O_RDONLY)
	if ((flags & O_ACCMODE) == O_RDONLY)
@@ -72,10 +73,15 @@ static u32 cifs_posix_convert_flags(unsigned int flags)
	else if ((flags & O_ACCMODE) == O_RDWR)
	else if ((flags & O_ACCMODE) == O_RDWR)
		posix_flags = SMB_O_RDWR;
		posix_flags = SMB_O_RDWR;


	if (flags & O_CREAT)
	if (flags & O_CREAT) {
		posix_flags |= SMB_O_CREAT;
		posix_flags |= SMB_O_CREAT;
		if (flags & O_EXCL)
		if (flags & O_EXCL)
			posix_flags |= SMB_O_EXCL;
			posix_flags |= SMB_O_EXCL;
	} else if (flags & O_EXCL)
		cFYI(1, "Application %s pid %d has incorrectly set O_EXCL flag"
			"but not O_CREAT on file open. Ignoring O_EXCL",
			current->comm, current->tgid);

	if (flags & O_TRUNC)
	if (flags & O_TRUNC)
		posix_flags |= SMB_O_TRUNC;
		posix_flags |= SMB_O_TRUNC;
	/* be safe and imply O_SYNC for O_DSYNC */
	/* be safe and imply O_SYNC for O_DSYNC */