[<prev] [next>] [day] [month] [year] [list]
Message-ID: <524f69650905221928he49410ay75000927c73bf93b@mail.gmail.com>
Date: Fri, 22 May 2009 21:28:50 -0500
From: Steve French <smfrench@...il.com>
To: LKML <linux-kernel@...r.kernel.org>,
"linux-cifs-client@...ts.samba.org"
<linux-cifs-client@...ts.samba.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Subject: [CIFS] One more posix open patch on the way
One small additional fix to posix open is being reviewed to address
something Jeff and JRA noticed this morning.
After discussion today on samba-technical about the posix lookup open
regression, and looking at a problem with cifs posix open to one
particular Samba version, Jeff and JRA realized that Samba server's
behavior changed in this area (posix open behavior on files vs.
directories) too. To make this behavior consistent, JRA just made a
fix to Samba server to alter how it handles open of directories (now
returning the equivalent of EISDIR instead of success). Since we don't
know at lookup time whether the inode is a directory or file (and thus
whether posix open will succeed with most current Samba server), I am
testing a change which avoids the posix open code on lookup open (just
issues posix open on creates). This gets the semantic benefits we
want (posix byte range locks, improved write semantics etc. on newly
created files) and file create still is fast, and we avoid the problem
that Jeff noticed this morning with "openat" (and some open directory
calls) of non-cached directories to one version of Samba server, and
will work with future Samba versions (which include the fix jra just
pushed into Samba server).
The small fix attached (or something like it), is a mustfix before
2.6.30 goes out, but want to give Shirish, and Jeff time to look at
it. The main part (other than a trivial rc mapping change) is this
change to cifs_lookup
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index f49d684..c306d3f 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -660,8 +660,16 @@ cifs_lookup(struct inode *parent_dir_inode,
struct dentry *direntry,
if (pTcon->unix_ext) {
if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) &&
(nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open) {
- if (!((nd->intent.open.flags & O_CREAT) &&
- (nd->intent.open.flags & O_EXCL))) {
+ if (nd->intent.open.flags & O_CREAT) {
+ /* POSIX open here is only called for file
+ create. It does not help much for file opens
+ because we do not know if it is a file
+ or directory, and current Samba no
+ longer allows us to do posix open on dirs,
+ so we could end up wasting an open
+ call on what turns out to be a dir.
+ For file opens, we call posix open
+ in cifs_open */
rc = cifs_posix_open(full_path, &newInode,
parent_dir_inode->i_sb,
nd->intent.open.create_mode,
--
Thanks,
Steve
View attachment "posix-open-only-on-create-and-fix-isdir-error-mapping.patch" of type "text/x-diff" (2233 bytes)
Powered by blists - more mailing lists