Commit 03bdeda6 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
 "A few small cifs fixes including two for stable, and fixing a
  regression introduced by the VFS change to file create"

* 'for-linus' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: set FILE_CREATED
  cifs: We do not drop reference to tlink in CIFSCheckMFSymlink()
  Add missing end of line termination to some cifs messages
parents 71ce176e f1e32681
...@@ -477,9 +477,10 @@ extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -477,9 +477,10 @@ extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon,
const int netfid, __u64 *pExtAttrBits, __u64 *pMask); const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb); extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
extern bool CIFSCouldBeMFSymlink(const struct cifs_fattr *fattr); extern bool CIFSCouldBeMFSymlink(const struct cifs_fattr *fattr);
extern int CIFSCheckMFSymlink(struct cifs_fattr *fattr, extern int CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon,
const unsigned char *path, struct cifs_sb_info *cifs_sb,
struct cifs_sb_info *cifs_sb, unsigned int xid); struct cifs_fattr *fattr,
const unsigned char *path);
extern int mdfour(unsigned char *, unsigned char *, int); extern int mdfour(unsigned char *, unsigned char *, int);
extern int E_md4hash(const unsigned char *passwd, unsigned char *p16, extern int E_md4hash(const unsigned char *passwd, unsigned char *p16,
const struct nls_table *codepage); const struct nls_table *codepage);
......
...@@ -4010,7 +4010,7 @@ CIFSSMBQFileInfo(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -4010,7 +4010,7 @@ CIFSSMBQFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0); (struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc) { if (rc) {
cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc); cifs_dbg(FYI, "Send error in QFileInfo = %d", rc);
} else { /* decode response */ } else { /* decode response */
rc = validate_t2((struct smb_t2_rsp *)pSMBr); rc = validate_t2((struct smb_t2_rsp *)pSMBr);
...@@ -4179,7 +4179,7 @@ CIFSSMBUnixQFileInfo(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -4179,7 +4179,7 @@ CIFSSMBUnixQFileInfo(const unsigned int xid, struct cifs_tcon *tcon,
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0); (struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc) { if (rc) {
cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc); cifs_dbg(FYI, "Send error in UnixQFileInfo = %d", rc);
} else { /* decode response */ } else { /* decode response */
rc = validate_t2((struct smb_t2_rsp *)pSMBr); rc = validate_t2((struct smb_t2_rsp *)pSMBr);
...@@ -4263,7 +4263,7 @@ CIFSSMBUnixQPathInfo(const unsigned int xid, struct cifs_tcon *tcon, ...@@ -4263,7 +4263,7 @@ CIFSSMBUnixQPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0); (struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc) { if (rc) {
cifs_dbg(FYI, "Send error in QPathInfo = %d\n", rc); cifs_dbg(FYI, "Send error in UnixQPathInfo = %d", rc);
} else { /* decode response */ } else { /* decode response */
rc = validate_t2((struct smb_t2_rsp *)pSMBr); rc = validate_t2((struct smb_t2_rsp *)pSMBr);
......
...@@ -193,7 +193,7 @@ check_name(struct dentry *direntry) ...@@ -193,7 +193,7 @@ check_name(struct dentry *direntry)
static int static int
cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
struct tcon_link *tlink, unsigned oflags, umode_t mode, struct tcon_link *tlink, unsigned oflags, umode_t mode,
__u32 *oplock, struct cifs_fid *fid, int *created) __u32 *oplock, struct cifs_fid *fid)
{ {
int rc = -ENOENT; int rc = -ENOENT;
int create_options = CREATE_NOT_DIR; int create_options = CREATE_NOT_DIR;
...@@ -349,7 +349,6 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid, ...@@ -349,7 +349,6 @@ cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned int xid,
.device = 0, .device = 0,
}; };
*created |= FILE_CREATED;
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
args.uid = current_fsuid(); args.uid = current_fsuid();
if (inode->i_mode & S_ISGID) if (inode->i_mode & S_ISGID)
...@@ -480,13 +479,16 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, ...@@ -480,13 +479,16 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry,
cifs_add_pending_open(&fid, tlink, &open); cifs_add_pending_open(&fid, tlink, &open);
rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode, rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode,
&oplock, &fid, opened); &oplock, &fid);
if (rc) { if (rc) {
cifs_del_pending_open(&open); cifs_del_pending_open(&open);
goto out; goto out;
} }
if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
*opened |= FILE_CREATED;
rc = finish_open(file, direntry, generic_file_open, opened); rc = finish_open(file, direntry, generic_file_open, opened);
if (rc) { if (rc) {
if (server->ops->close) if (server->ops->close)
...@@ -529,7 +531,6 @@ int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode, ...@@ -529,7 +531,6 @@ int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode,
struct TCP_Server_Info *server; struct TCP_Server_Info *server;
struct cifs_fid fid; struct cifs_fid fid;
__u32 oplock; __u32 oplock;
int created = FILE_CREATED;
cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %s and dentry = 0x%p\n", cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %s and dentry = 0x%p\n",
inode, direntry->d_name.name, direntry); inode, direntry->d_name.name, direntry);
...@@ -546,7 +547,7 @@ int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode, ...@@ -546,7 +547,7 @@ int cifs_create(struct inode *inode, struct dentry *direntry, umode_t mode,
server->ops->new_lease_key(&fid); server->ops->new_lease_key(&fid);
rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode, rc = cifs_do_create(inode, direntry, xid, tlink, oflags, mode,
&oplock, &fid, &created); &oplock, &fid);
if (!rc && server->ops->close) if (!rc && server->ops->close)
server->ops->close(xid, tcon, &fid); server->ops->close(xid, tcon, &fid);
......
...@@ -383,7 +383,8 @@ int cifs_get_inode_info_unix(struct inode **pinode, ...@@ -383,7 +383,8 @@ int cifs_get_inode_info_unix(struct inode **pinode,
/* check for Minshall+French symlinks */ /* check for Minshall+French symlinks */
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) {
int tmprc = CIFSCheckMFSymlink(&fattr, full_path, cifs_sb, xid); int tmprc = CIFSCheckMFSymlink(xid, tcon, cifs_sb, &fattr,
full_path);
if (tmprc) if (tmprc)
cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc); cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc);
} }
...@@ -799,7 +800,8 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, ...@@ -799,7 +800,8 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
/* check for Minshall+French symlinks */ /* check for Minshall+French symlinks */
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MF_SYMLINKS) {
tmprc = CIFSCheckMFSymlink(&fattr, full_path, cifs_sb, xid); tmprc = CIFSCheckMFSymlink(xid, tcon, cifs_sb, &fattr,
full_path);
if (tmprc) if (tmprc)
cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc); cifs_dbg(FYI, "CIFSCheckMFSymlink: %d\n", tmprc);
} }
......
...@@ -354,34 +354,30 @@ open_query_close_cifs_symlink(const unsigned char *path, char *pbuf, ...@@ -354,34 +354,30 @@ open_query_close_cifs_symlink(const unsigned char *path, char *pbuf,
int int
CIFSCheckMFSymlink(struct cifs_fattr *fattr, CIFSCheckMFSymlink(unsigned int xid, struct cifs_tcon *tcon,
const unsigned char *path, struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
struct cifs_sb_info *cifs_sb, unsigned int xid) const unsigned char *path)
{ {
int rc = 0; int rc;
u8 *buf = NULL; u8 *buf = NULL;
unsigned int link_len = 0; unsigned int link_len = 0;
unsigned int bytes_read = 0; unsigned int bytes_read = 0;
struct cifs_tcon *ptcon;
if (!CIFSCouldBeMFSymlink(fattr)) if (!CIFSCouldBeMFSymlink(fattr))
/* it's not a symlink */ /* it's not a symlink */
return 0; return 0;
buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL); buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL);
if (!buf) { if (!buf)
rc = -ENOMEM; return -ENOMEM;
goto out;
}
ptcon = tlink_tcon(cifs_sb_tlink(cifs_sb)); if (tcon->ses->server->ops->query_mf_symlink)
if ((ptcon->ses) && (ptcon->ses->server->ops->query_mf_symlink)) rc = tcon->ses->server->ops->query_mf_symlink(path, buf,
rc = ptcon->ses->server->ops->query_mf_symlink(path, buf,
&bytes_read, cifs_sb, xid); &bytes_read, cifs_sb, xid);
else else
goto out; rc = -ENOSYS;
if (rc != 0) if (rc)
goto out; goto out;
if (bytes_read == 0) /* not a symlink */ if (bytes_read == 0) /* not a symlink */
......
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