Commit b3a9bd1f authored by Steve French's avatar Steve French

Merge bk://linux.bkbits.net/linux-2.5

into hostme.bitkeeper.com:/repos/c/cifs/linux-2.5cifs
parents bd7b6c43 1cba1828
......@@ -22,6 +22,7 @@ Andi Kleen
Amrut Joshi
Shobhit Dayal
Sergey Vlasov
Richard Hughes
Test case and Bug Report contributors
-------------------------------------
......
Version 1.14
------------
Fix incomplete listings of large directories on Samba servers when Unix
extensions enabled. Fix oops when smb_buffer can not be allocated. Fix
rename deadlock when writing out dirty pages at same time.
Version 1.13
------------
Fix open of files in which O_CREATE can cause the mode to change in
some cases. Fix case in which retry of write overlaps file close.
Fix PPC64 build error. Reduce excessive stack usage in smb password
hashing.
hashing. Fix overwrite of Linux user's view of file mode to Windows servers.
Version 1.12
------------
......
......@@ -104,9 +104,21 @@ may require specifying a mkdev function to Samba. For more information on these
see the manual pages ("man smb.conf") on the Samba server system. Note that the
cifs vfs, unlike the smbfs vfs, does not read the smb.conf on the client system
(the few optional settings are passed in on mount via -o parameters instead).
Note that Samba 2.2.7 or later includes a fix that allows the CIFS VFS to delete
Note that Samba 2.2.7 or later includes a fix that allows the CIFS VFS to delete
open files (required for strict POSIX compliance). Windows Servers already
supported this feature.
supported this feature. Samba server does not allow symlinks that refer to files
outside of the share, so in Samba versions prior to 3.0.5, most symlinks to
files with absolute paths (ie beginning with slash) such as:
ln -s /mnt/foo bar
would be forbidden. Samba 3.0.5 server or later includes the ability to create
such symlinks safely by converting unsafe symlinks (ie symlinks to server
files that are outside of the share) to a samba specific format on the server
that is ignored by local server applications and non-cifs clients and that will
not be traversed by the Samba server). This is opaque to the Linux client
application using the cifs vfs. Absolute symlinks will work to Samba 3.0.5 or
later, but only for remote clients using the CIFS Unix extensions, and will
be invisbile to Windows clients and typically will not affect local
applications running on the same server as Samba.
Use instructions:
================
......@@ -142,6 +154,8 @@ of the mount options. Credential files contain two lines
password=your_password
2) By specifying the password in the PASSWD environment variable (similarly
the user name can be taken from the USER environment variable).
3) By specifying the password in a file by name via PASSWD_FILE
4) By specifying the password in a file by file descriptor via PASSWD_FD
If no password is provided, mount.cifs will prompt for password entry
......@@ -166,8 +180,28 @@ A partial list of the supported mount options follows:
mount.
domain Set the SMB/CIFS workgroup name prepended to the
username during CIFS session establishment
uid If CIFS Unix extensions are not supported by the server
this overrides the default uid for inodes.
uid If CIFS Unix extensions are not supported by the server
this overrides the default uid for inodes. For mounts to
servers which do support the CIFS Unix extensions, such
as a properly configured Samba server, the server provides
the uid, gid and mode. For servers which do not support
the Unix extensions, the default uid (and gid) returned on
lookup of existing files is the uid (gid) of the person
who executed the mount (root, except when mount.cifs
is configured setuid for user mounts) unless the "uid="
(gid) mount option is specified. For the uid (gid) of newly
created files and directories, ie files created since
the last mount of the server share, the expected uid
(gid) is cached as as long as the inode remains in
memory on the client. Also note that permission
checks (authorization checks) on accesses to a file occur
at the server, but there are cases in which an administrator
may want to restrict at the client as well. For those
servers which do not report a uid/gid owner
(such as Windows), permissions can also be checked at the
client, and a crude form of client side permission checking
can be enabled by specifying file_mode and dir_mode on
the client
gid If CIFS Unix extensions are not supported by the server
this overrides the default gid for inodes.
file_mode If CIFS Unix extensions are not supported by the server
......@@ -219,6 +253,17 @@ A partial list of the supported mount options follows:
if guest is specified on the mount options. If no
password is specified a null password will be used.
The mount.cifs mount helper also accepts a few mount options before -o
including:
-S take password from stdin (equivalent to setting the environment
variable "PASSWD_FD=0"
-V print mount.cifs version
-? display simple usage information
With recent 2.6 kernel versions of modutils, the version of the cifs kernel
module can be displayed via modinfo.
Misc /proc/fs/cifs Flags and Debug Info
=======================================
Informational pseudo-files:
......
version 1.0.2 January 29, 2004
version 1.14 May 14, 2004
A Partial List of Known Problems and Missing Features
=====================================================
......@@ -21,8 +21,8 @@ e) NTLMv2 authentication (mostly implemented)
f) MD5-HMAC signing SMB PDUs when SPNEGO style SessionSetup
used (Kerberos or NTLMSSP). Signing alreadyimplemented for NTLM
and raw NTLMSSP already. This is important when enabling
extended security and mounting to Windows 2003 Servers
and raw NTLMSSP already. This is important when enabling
extended security and mounting to Windows 2003 Servers
f) Directory entry caching relies on a 1 second timer, rather than
using FindNotify or equivalent. - (started)
......@@ -34,7 +34,8 @@ h) quota support
i) support for the Linux 2.5 kernel new feature get_xattr and set_xattr
which will allow us to expose dos attributes as well as real
ACLs
ACLs. This support has been started in the current code, but is
ifdeffed out.
k) finish writepages support (multi-page write behind for improved
performance) and syncpage
......@@ -42,7 +43,9 @@ performance) and syncpage
l) hook lower into the sockets api (as NFS/SunRPC does) to avoid the
extra copy in/out of the socket buffers in some cases.
m) finish support for IPv6
m) finish support for IPv6. This is mostly complete but
needs a simple inet_pton like function to convert ipv6
addresses in string representation.
o) Better optimize open (and pathbased setfilesize) to reduce the
oplock breaks coming from windows srv. Piggyback identical file
......@@ -53,8 +56,18 @@ spurious oplock breaks).
p) Improve performance of readpages by sending more than one read
at a time when 8 pages or more are requested.
q) For support of Windows9x/98 we need to retry failed mounts
to *SMBSERVER (default server name) with the uppercase hostname
in the RFC1001 session_init request.
KNOWN BUGS (updated January 30, 2004)
r) Add Extended Attributed support (for storing UID/GID info
to Windows servers)
s) Finish fcntl D_NOTIFY support so kde and gnome file list windows
will autorefresh
KNOWN BUGS (updated May 14, 2004)
====================================
1) existing symbolic links (Windows reparse points) are recognized but
can not be created remotely. They are implemented for Samba and those that
......@@ -64,20 +77,22 @@ symlink text beginning with slash
but recognizes them
3) create of new files to FAT partitions on Windows servers can
succeed but still return access denied (appears to be Windows
not client problem). NTFS partitions do not have this problem.
4) debug connectathon special test case nfs_idem (which does
some invalid symlink naming, or at least what Samba thinks
is an invalid symlink target).
5) debug connectation lock test case 10 which fails against
not client problem) and has not been reproduced recently.
NTFS partitions do not have this problem.
4) debug connectation lock test case 10 which fails against
Samba (may be unmappable due to POSIX to Windows lock model
differences but worth investigating). Also debug Samba to
see why lock test case 7 takes longer to complete to Samba
than to Windows.
5) prepare_write does not initialize pages properly when partial
page writes begin in the middle of a page (pages can get zeroed).
6) Write caching done incorrectly when files are only opened
with write permission by the application.
Misc testing to do
=================
1) check out max path names and max path name components against various server
types.
types. Return max path name in stat -f information
2) Modify file portion of ltp so it can run against a mounted network
share and run it against cifs vfs.
......
File mode changed from 100755 to 100644
......@@ -93,5 +93,5 @@ extern int cifs_setxattr(struct dentry *, const char *, const void *,
size_t, int);
extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t);
extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
#define CIFS_VERSION "1.13"
#define CIFS_VERSION "1.14"
#endif /* _CIFSFS_H */
......@@ -34,9 +34,10 @@
#define SMB_COM_DELETE 0x06
#define SMB_COM_RENAME 0x07
#define SMB_COM_LOCKING_ANDX 0x24
#define SMB_COM_COPY 0x29
#define SMB_COM_READ_ANDX 0x2E
#define SMB_COM_WRITE_ANDX 0x2F
#define SMB_COM_TRANSACTION2 0x32
#define SMB_COM_TRANSACTION2 0x32
#define SMB_COM_TRANSACTION2_SECONDARY 0x33
#define SMB_COM_FIND_CLOSE2 0x34
#define SMB_COM_TREE_DISCONNECT 0x71
......@@ -775,6 +776,34 @@ typedef struct smb_com_rename_req {
/* followed by NewFileName */
} RENAME_REQ;
/* copy request flags */
#define COPY_MUST_BE_FILE 0x0001
#define COPY_MUST_BE_DIR 0x0002
#define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */
#define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */
#define COPY_VERIFY_WRITES 0x0010
#define COPY_TREE 0x0020
typedef struct smb_com_copy_req {
struct smb_hdr hdr; /* wct = 3 */
__u16 Tid2;
__u16 OpenFunction;
__u16 Flags;
__u16 ByteCount;
__u8 BufferFormat; /* 4 = ASCII or Unicode */
unsigned char OldFileName[1];
/* followed by __u8 BufferFormat2 */
/* followed by NewFileName string */
} COPY_REQ;
typedef struct smb_com_copy_rsp {
struct smb_hdr hdr; /* wct = 1 */
__u16 CopyCount; /* number of files copied */
__u16 ByteCount; /* may be zero */
__u8 BufferFormat; /* 0x04 - only present if errored file follows */
unsigned char ErrorFileName[1]; /* only present if error in copy */
} COPY_RSP;
#define CREATE_HARD_LINK 0x103
#define MOVEFILE_COPY_ALLOWED 0x0002
#define MOVEFILE_REPLACE_EXISTING 0x0001
......@@ -912,6 +941,15 @@ typedef struct smb_com_transaction_change_notify_req {
#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
#define FILE_ACTION_ADDED 0x00000001
#define FILE_ACTION_REMOVED 0x00000002
#define FILE_ACTION_MODIFIED 0x00000003
#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
#define FILE_ACTION_ADDED_STREAM 0x00000006
#define FILE_ACTION_REMOVED_STREAM 0x00000007
#define FILE_ACTION_MODIFIED_STREAM 0x00000008
/* response contains array of the following structures */
struct file_notify_information {
__u32 NextEntryOffset;
......@@ -1010,8 +1048,13 @@ typedef union smb_com_transaction2 {
#define SMB_SET_FILE_UNIX_HLINK 0x203
#define SMB_SET_FILE_BASIC_INFO2 0x3ec
#define SMB_SET_FILE_RENAME_INFORMATION 0x3f2
#define SMB_FILE_ALL_INFO2 0x3fa
#define SMB_SET_FILE_ALLOCATION_INFO2 0x3fb
#define SMB_SET_FILE_END_OF_FILE_INFO2 0x3fc
#define SMB_FILE_MOVE_CLUSTER_INFO 0x407
#define SMB_FILE_QUOTA_INFO 0x408
#define SMB_FILE_REPARSEPOINT_INFO 0x409
#define SMB_FILE_MAXIMUM_INFO 0x40d
/* Find File infolevels */
#define SMB_FIND_FILE_DIRECTORY_INFO 0x101
......@@ -1273,6 +1316,7 @@ typedef struct smb_com_transaction2_fnext_rsp_parms {
__u16 LastNameOffset;
} T2_FNEXT_RSP_PARMS;
/* QFSInfo Levels */
#define SMB_INFO_ALLOCATION 1
#define SMB_INFO_VOLUME 2
#define SMB_QUERY_FS_VOLUME_INFO 0x102
......@@ -1280,6 +1324,8 @@ typedef struct smb_com_transaction2_fnext_rsp_parms {
#define SMB_QUERY_FS_DEVICE_INFO 0x104
#define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105
#define SMB_QUERY_CIFS_UNIX_INFO 0x200
#define SMB_QUERY_LABEL_INFO 0x3ea
#define SMB_QUERY_FS_QUOTA_INFO 0x3ee
typedef struct smb_com_transaction2_qfsi_req {
struct smb_hdr hdr; /* wct = 14+ */
......
......@@ -239,8 +239,9 @@ extern int CIFSSMBSeek(int xid,
int whence, unsigned long offset, long long *newoffset);
extern int CIFSSMBCopy(int xid,
struct cifsTconInfo *ftcon,
char *fromName,
struct cifsTconInfo *ttcon,
char *toName, int ofun, int flags);
struct cifsTconInfo *source_tcon,
const char *fromName,
const __u16 target_tid,
const char *toName, const int flags,
const struct nls_table *nls_codepage);
#endif /* _CIFSPROTO_H */
......@@ -143,7 +143,7 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
return rc;
*request_buf = cifs_buf_get();
if (request_buf == 0) {
if (*request_buf == 0) {
return -ENOMEM;
}
/* Although the original thought was we needed the response buf for */
......@@ -892,7 +892,6 @@ CIFSSMBRename(const int xid, struct cifsTconInfo *tcon,
}
pSMB->ByteCount = 1 /* 1st signature byte */ + name_len + name_len2;
/* we could also set search attributes but not needed */
pSMB->hdr.smb_buf_length += pSMB->ByteCount;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
......@@ -986,6 +985,77 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
return rc;
}
int
CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName,
const __u16 target_tid, const char *toName, const int flags,
const struct nls_table *nls_codepage)
{
int rc = 0;
COPY_REQ *pSMB = NULL;
COPY_RSP *pSMBr = NULL;
int bytes_returned;
int name_len, name_len2;
cFYI(1, ("In CIFSSMBCopy"));
copyRetry:
rc = smb_init(SMB_COM_COPY, 1, tcon, (void **) &pSMB,
(void **) &pSMBr);
if (rc)
return rc;
pSMB->BufferFormat = 0x04;
pSMB->Tid2 = target_tid;
if(flags & COPY_TREE)
pSMB->Flags |= COPY_TREE;
pSMB->Flags = cpu_to_le16(pSMB->Flags);
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
name_len =
cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, 530
/* find define for this maxpathcomponent */
, nls_codepage);
name_len++; /* trailing null */
name_len *= 2;
pSMB->OldFileName[name_len] = 0x04; /* pad */
/* protocol requires ASCII signature byte on Unicode string */
pSMB->OldFileName[name_len + 1] = 0x00;
name_len2 =
cifs_strtoUCS((wchar_t *) & pSMB->
OldFileName[name_len + 2], toName, 530,
nls_codepage);
name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
name_len2 *= 2; /* convert to bytes */
} else { /* BB improve the check for buffer overruns BB */
name_len = strnlen(fromName, 530);
name_len++; /* trailing null */
strncpy(pSMB->OldFileName, fromName, name_len);
name_len2 = strnlen(toName, 530);
name_len2++; /* trailing null */
pSMB->OldFileName[name_len] = 0x04; /* 2nd buffer format */
strncpy(&pSMB->OldFileName[name_len + 1], toName, name_len2);
name_len2++; /* trailing null */
name_len2++; /* signature byte */
}
pSMB->ByteCount = 1 /* 1st signature byte */ + name_len + name_len2;
pSMB->hdr.smb_buf_length += pSMB->ByteCount;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc) {
cFYI(1, ("Send error in copy = %d with %d files copied",
rc, pSMBr->CopyCount));
}
if (pSMB)
cifs_buf_release(pSMB);
if (rc == -EAGAIN)
goto copyRetry;
return rc;
}
int
CIFSUnixCreateSymLink(const int xid, struct cifsTconInfo *tcon,
......
......@@ -63,6 +63,7 @@ struct smb_vol {
mode_t dir_mode;
int rw:1;
int retry:1;
int intr:1;
unsigned int rsize;
unsigned int wsize;
unsigned int sockopt;
......@@ -699,6 +700,7 @@ cifs_parse_mount_options(char *options, const char *devname, struct smb_vol *vol
(strnicmp(data, "exec", 4) == 0) ||
(strnicmp(data, "noexec", 6) == 0) ||
(strnicmp(data, "nodev", 5) == 0) ||
(strnicmp(data, "noauto", 6) == 0) ||
(strnicmp(data, "dev", 3) == 0)) {
/* The mount tool or mount.cifs helper (if present)
uses these opts to set flags, and the flags are read
......@@ -717,6 +719,12 @@ cifs_parse_mount_options(char *options, const char *devname, struct smb_vol *vol
vol->retry = 0;
} else if (strnicmp(data, "nosoft", 6) == 0) {
vol->retry = 1;
} else if (strnicmp(data, "nointr", 6) == 0) {
vol->intr = 0;
} else if (strnicmp(data, "intr", 4) == 0) {
vol->intr = 1;
} else if (strnicmp(data, "noac", 4) == 0) {
printk(KERN_WARNING "CIFS: Mount option noac not supported. Instead set /proc/fs/cifs/LookupCacheEnabled to 0\n");
} else
printk(KERN_WARNING "CIFS: Unknown mount option %s\n",data);
}
......
......@@ -1793,10 +1793,10 @@ cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
cifsFile->search_resume_name =
kmalloc(cifsFile->resume_name_length, GFP_KERNEL);
cFYI(1,("fnext last file: %s with name %d bytes long",
lastFindData->FileName,
pfindDataUnix->FileName,
cifsFile->resume_name_length));
memcpy(cifsFile->search_resume_name,
lastFindData->FileName,
pfindDataUnix->FileName,
cifsFile->resume_name_length);
}
......
......@@ -647,9 +647,12 @@ cifs_revalidate(struct dentry *direntry)
}
}
/* can not grab this sem since kernel filesys locking
documentation indicates i_sem may be taken by the kernel
on lookup and rename which could deadlock if we grab
the i_sem here as well */
/* down(&direntry->d_inode->i_sem);*/
/* need to write out dirty pages here */
down(&direntry->d_inode->i_sem);
if(direntry->d_inode->i_mapping) {
/* do we need to lock inode until after invalidate completes below? */
filemap_fdatawrite(direntry->d_inode->i_mapping);
......@@ -663,9 +666,7 @@ cifs_revalidate(struct dentry *direntry)
invalidate_remote_inode(direntry->d_inode);
}
}
up(&direntry->d_inode->i_sem);
/* up(&direntry->d_inode->i_sem);*/
if (full_path)
kfree(full_path);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment