From patchwork Wed Mar 4 19:02:08 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 9896 Received: from lists.samba.org (mail.samba.org [66.70.73.150]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n24J31O9020149 for ; Wed, 4 Mar 2009 19:03:01 GMT Received: from dp.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id B94CD163DDB for ; Wed, 4 Mar 2009 19:02:46 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on dp.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.8 tests=AWL,BAYES_00, DNS_FROM_RFC_POST,SPF_PASS autolearn=no version=3.1.7 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from qw-out-1920.google.com (qw-out-1920.google.com [74.125.92.145]) by lists.samba.org (Postfix) with ESMTP id D9076163B95 for ; Wed, 4 Mar 2009 19:02:05 +0000 (GMT) Received: by qw-out-1920.google.com with SMTP id 9so3161282qwj.14 for ; Wed, 04 Mar 2009 11:02:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=XLfwD2jxZSbVb2CpW0XZfm0KTCmlxRU86H3f32g/rG8=; b=g47lU+d85uVsMUB/onV07UfwiNgYbN/Qyy9jJoqZgTgzZIVS4QW8TLeaiz7RLZPl7w jpygubClOQHvowHVWVhEdKCPFiHniQMBil7YmNa+6+MNmko4iQ97/sSMXMLdSBM2Qzrm +FCSoQHH2kxHE9Jf0/BaoNnlOyUsKPK9GHr/8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=kvOgPfvNLbLt8FvCClKyS2l4kFEw88YxfmUoe0625qoBatGyiy+lyiHKzvtLC2LyvM 9bYE48jXl6tkO+oODHqek24jJHSA/SE+zFQ0JmYunU+61C0K5CKwlSPOP3RNJJ1dJL7M tirVj34anUQov27RJbIFNzhBkTOHzfXOSPPf8= MIME-Version: 1.0 Received: by 10.229.82.15 with SMTP id z15mr347006qck.32.1236193328419; Wed, 04 Mar 2009 11:02:08 -0800 (PST) Date: Wed, 4 Mar 2009 13:02:08 -0600 Message-ID: <524f69650903041102v415a807m8a93f0462458a51@mail.gmail.com> From: Steve French To: Jeremy Allison , Jeff Layton , linux-fsdevel , "linux-cifs-client@lists.samba.org" , samba-technical Subject: [linux-cifs-client] [CIFS] [PATCH] warn on EINVAL error on posix open, and turn off posix open if server broken for this call X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org Errors-To: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org Attached is patch to workaround the problem found in posix open to Samba versions 3.3.1 and earlier (create works, but open would fail with invalid parameter) - it disables requests to try posix open after a first failure. diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index b33c841..fc977df 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES @@ -11,6 +11,8 @@ to better ensure that we wait for server to write all of the data to server disk (not just write it over the network). Add new mount parameter to allow user to disable sending the (slow) SMB flush on fsync if desired (fsync still flushes all cached write data to the server). +Posix file open support added (turned off after one attempt if server +fails to support it properly, as with Samba server versions prior to 3.3.2) Version 1.56 ------------ diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 44ff94d..9fbf4df 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -299,6 +299,7 @@ struct cifsTconInfo { bool unix_ext:1; /* if false disable Linux extensions to CIFS protocol for this mount even if server would support */ bool local_lease:1; /* check leases (only) on local system not remote */ + bool broken_posix_open; /* e.g. Samba server versions < 3.3.2, 3.2.9 */ bool need_reconnect:1; /* connection reset, tid now invalid */ /* BB add field for back pointer to sb struct(s)? */ }; diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 7bef4cc..b877f9a 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -328,7 +328,8 @@ int cifs_open(struct inode *inode, struct file *file) else oplock = 0; - if (tcon->unix_ext && (tcon->ses->capabilities & CAP_UNIX) && + if (!tcon->broken_posix_open && tcon->unix_ext && + (tcon->ses->capabilities & CAP_UNIX) && (CIFS_UNIX_POSIX_PATH_OPS_CAP & le64_to_cpu(tcon->fsUnixInfo.Capability))) { int oflags = (int) cifs_posix_convert_flags(file->f_flags); @@ -344,11 +345,19 @@ int cifs_open(struct inode *inode, struct file *file) cifs_posix_open_inode_helper(inode, file, pCifsInode, pCifsFile, oplock, netfid); goto out; + } else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { + if (tcon->ses->serverNOS) + cERROR(1, ("server of type %s returned" + " unexpected error on SMB posix open" + ", disabling posix open support." + " Check if server update available.", + tcon->ses->serverNOS)); + tcon->broken_posix_open = true; } else if ((rc != -EIO) && (rc != -EREMOTE) && (rc != -EOPNOTSUPP)) /* path not found or net err */ goto out; - /* fallthrough to retry open the old way on operation - not supported or DFS errors */ + /* else fallthrough to retry open the old way on network i/o + or DFS errors */ } desiredAccess = cifs_convert_flags(file->f_flags);