From patchwork Mon Feb 18 17:02:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 2159551 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id E16403FCFC for ; Mon, 18 Feb 2013 17:02:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755487Ab3BRRCj (ORCPT ); Mon, 18 Feb 2013 12:02:39 -0500 Received: from mail-da0-f48.google.com ([209.85.210.48]:37256 "EHLO mail-da0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755451Ab3BRRCi (ORCPT ); Mon, 18 Feb 2013 12:02:38 -0500 Received: by mail-da0-f48.google.com with SMTP id v40so2570228dad.7 for ; Mon, 18 Feb 2013 09:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=zFnJjkjjvh8FpLFZRUFpYlbGYJ+PeRxmCo1eAp/skFI=; b=F8PHPDVsQ25fxuOey3fHrG0HDdyBHmVxTFC5vtUuSMRwR66dNiiXvPBwo1+yRRJI/o KR+oyN+21xIN2CeYkLcMGzxPxnInJw7gbbP2+f8Uu2TnxzGOC/q1+PAMhtRU24dT//WM Hf4uNCVX7hk69byCKfTTu+XwYPKnG/7Bv3eLIHp5B1Qq9N0VTm24oybGS1CGnp6KHgX4 1NND4UWCvXGpSvD4PyZRaNojzgxERLlctXNLsJNlJZ5dAaubJdNK1XiykAG6y+shSe0i 8oSOwAYI6LPxjjHmUDOUuoXGFmoxVAN/VSQ6skC/oDaAN2Z19UvyupUJIhQnrnCrgm7I LtGw== MIME-Version: 1.0 X-Received: by 10.68.232.69 with SMTP id tm5mr31792005pbc.150.1361206958166; Mon, 18 Feb 2013 09:02:38 -0800 (PST) Received: by 10.68.13.162 with HTTP; Mon, 18 Feb 2013 09:02:38 -0800 (PST) Date: Mon, 18 Feb 2013 11:02:38 -0600 Message-ID: Subject: Samba bug 9519 - patch for kernel client workaround From: Steve French To: linux-cifs@vger.kernel.org, samba-technical Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org [CIFS] 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 Signed-off-by: Steve French diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 8ea6ca5..433743a 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -43,6 +43,7 @@ #include "cifs_fs_sb.h" #include "fscache.h" + static inline int cifs_convert_flags(unsigned int flags) { 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) 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) + 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) posix_flags |= SMB_O_TRUNC; /* be safe and imply O_SYNC for O_DSYNC */