diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 8ea6ca5..c4860cf 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -72,10 +72,15 @@ static u32 cifs_posix_convert_flags(unsigned int flags) else if ((flags & O_ACCMODE) == O_RDWR) posix_flags = SMB_O_RDWR; - if (flags & O_CREAT) + if (flags & O_CREAT) { posix_flags |= SMB_O_CREAT; - if (flags & O_EXCL) - posix_flags |= SMB_O_EXCL; + if (flags & O_EXCL) + posix_flags |= SMB_O_EXCL; + } else if (flags & O_EXCL) + WARN_ONCE(1, "Application has incorrectly set O_EXCL flag " + "without O_CREAT on file open, ignoring O_EXCL"); + + if (flags & O_TRUNC) posix_flags |= SMB_O_TRUNC; /* be safe and imply O_SYNC for O_DSYNC */