[linux-cifs-client] [CIFS] [PATCH] warn on EINVAL error on
posix open, and turn off posix open if server broken for this call
Steve French
smfrench at gmail.com
Wed Mar 4 19:30:31 GMT 2009
We still do posix open in the cifs_create (file creation) path since
that does not appear to be broken:
if (tcon->unix_ext && (tcon->ses->capabilities & CAP_UNIX) &&
(CIFS_UNIX_POSIX_PATH_OPS_CAP &
le64_to_cpu(tcon->fsUnixInfo.Capability))) {
rc = cifs_posix_open(full_path, &newinode, inode->i_sb,
mode, oflags, &oplock, &fileHandle, xid);
and if we try to reopen file, we still try reopening posix first (since reopen
is rarer, and not performance sensitive, it is ok to try twice)
We just disable it in the cifs_open (not create) path:
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);
/* can not refresh inode info since size could be stale */
rc = cifs_posix_open(full_path, &inode, inode->i_sb,
cifs_sb->mnt_file_mode /* ignored */,
oflags, &oplock, &netfid, xid);
if (rc == 0) {
cFYI(1, ("posix open succeeded"));
/* no need for special case handling of setting mode
on read only files needed here */
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 %s of type %s returned"
" unexpected error on SMB posix open"
", disabling posix open support."
" Check if server update available.",
tcon->ses->serverName,
tcon->ses->serverNOS));
On Wed, Mar 4, 2009 at 1:24 PM, simo <idra at samba.org> wrote:
> On Wed, 2009-03-04 at 13:02 -0600, Steve French wrote:
>> 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.
>
> Why do you completely disable posix opens ?
> Wouldn't it make sense to reopen only when it fails ?
> After all when you create new files it works correctly.
>
> Simo.
>
> --
> Simo Sorce
> Samba Team GPL Compliance Officer <simo at samba.org>
> Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>
>
>
--
Thanks,
Steve
More information about the samba-technical
mailing list