All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: Jeremy Allison <jra@samba.org>, Jeff Layton <jlayton@redhat.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	"linux-cifs-client@lists.samba.org"
	<linux-cifs-client@lists.samba.or
Subject: [CIFS] [PATCH] warn on EINVAL error on posix open, and turn off posix open if server broken for this call
Date: Wed, 4 Mar 2009 13:02:08 -0600	[thread overview]
Message-ID: <524f69650903041102v415a807m8a93f0462458a51@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 245 bytes --]

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.



-- 
Thanks,

Steve

[-- Attachment #2: work-around-broken-posix-open.patch --]
[-- Type: text/x-diff, Size: 2585 bytes --]

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);

             reply	other threads:[~2009-03-04 19:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-04 19:02 Steve French [this message]
2009-03-04 19:24 ` [CIFS] [PATCH] warn on EINVAL error on posix open, and turn off posix open if server broken for this call simo
2009-03-04 19:29   ` Jeremy Allison
2009-03-04 19:34     ` [linux-cifs-client] " Steve French
2009-03-04 19:30   ` Steve French
2009-03-04 20:36     ` simo
2009-03-04 19:29 ` Shirish Pargaonkar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=524f69650903041102v415a807m8a93f0462458a51@mail.gmail.com \
    --to=smfrench@gmail.com \
    --cc=jlayton@redhat.com \
    --cc=jra@samba.org \
    --cc=linux-cifs-client@lists.samba.or \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.