Commit 418182b7 authored by Pavel Shilovsky's avatar Pavel Shilovsky

Update 3.7 sources from stable (v3.7.10)

parent 67c27898
...@@ -226,6 +226,8 @@ compose_mount_options_out: ...@@ -226,6 +226,8 @@ compose_mount_options_out:
compose_mount_options_err: compose_mount_options_err:
kfree(mountdata); kfree(mountdata);
mountdata = ERR_PTR(rc); mountdata = ERR_PTR(rc);
kfree(*devname);
*devname = NULL;
goto compose_mount_options_out; goto compose_mount_options_out;
} }
......
...@@ -66,18 +66,21 @@ static inline void dump_cifs_file_struct(struct file *file, char *label) ...@@ -66,18 +66,21 @@ static inline void dump_cifs_file_struct(struct file *file, char *label)
#endif /* DEBUG2 */ #endif /* DEBUG2 */
/* /*
* Attempt to preload the dcache with the results from the FIND_FIRST/NEXT
*
* Find the dentry that matches "name". If there isn't one, create one. If it's * Find the dentry that matches "name". If there isn't one, create one. If it's
* a negative dentry or the uniqueid changed, then drop it and recreate it. * a negative dentry or the uniqueid changed, then drop it and recreate it.
*/ */
static struct dentry * static void
cifs_readdir_lookup(struct dentry *parent, struct qstr *name, cifs_prime_dcache(struct dentry *parent, struct qstr *name,
struct cifs_fattr *fattr) struct cifs_fattr *fattr)
{ {
struct dentry *dentry, *alias; struct dentry *dentry, *alias;
struct inode *inode; struct inode *inode;
struct super_block *sb = parent->d_inode->i_sb; struct super_block *sb = parent->d_inode->i_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
cFYI(1, "For %s", name->name); cFYI(1, "%s: for %s", __func__, name->name);
if (parent->d_op && parent->d_op->d_hash) if (parent->d_op && parent->d_op->d_hash)
parent->d_op->d_hash(parent, parent->d_inode, name); parent->d_op->d_hash(parent, parent->d_inode, name);
...@@ -87,37 +90,42 @@ cifs_readdir_lookup(struct dentry *parent, struct qstr *name, ...@@ -87,37 +90,42 @@ cifs_readdir_lookup(struct dentry *parent, struct qstr *name,
dentry = d_lookup(parent, name); dentry = d_lookup(parent, name);
if (dentry) { if (dentry) {
int err; int err;
inode = dentry->d_inode; inode = dentry->d_inode;
/* update inode in place if i_ino didn't change */ if (inode) {
if (inode && CIFS_I(inode)->uniqueid == fattr->cf_uniqueid) { /*
cifs_fattr_to_inode(inode, fattr); * If we're generating inode numbers, then we don't
return dentry; * want to clobber the existing one with the one that
* the readdir code created.
*/
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM))
fattr->cf_uniqueid = CIFS_I(inode)->uniqueid;
/* update inode in place if i_ino didn't change */
if (CIFS_I(inode)->uniqueid == fattr->cf_uniqueid) {
cifs_fattr_to_inode(inode, fattr);
goto out;
}
} }
err = d_invalidate(dentry); err = d_invalidate(dentry);
dput(dentry); dput(dentry);
if (err) if (err)
return NULL; return;
} }
dentry = d_alloc(parent, name); dentry = d_alloc(parent, name);
if (dentry == NULL) if (!dentry)
return NULL; return;
inode = cifs_iget(sb, fattr); inode = cifs_iget(sb, fattr);
if (!inode) { if (!inode)
dput(dentry); goto out;
return NULL;
}
alias = d_materialise_unique(dentry, inode); alias = d_materialise_unique(dentry, inode);
if (alias != NULL) { if (alias && !IS_ERR(alias))
dput(dentry); dput(alias);
if (IS_ERR(alias)) out:
return NULL; dput(dentry);
dentry = alias;
}
return dentry;
} }
static void static void
...@@ -652,7 +660,6 @@ static int cifs_filldir(char *find_entry, struct file *file, filldir_t filldir, ...@@ -652,7 +660,6 @@ static int cifs_filldir(char *find_entry, struct file *file, filldir_t filldir,
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifs_dirent de = { NULL, }; struct cifs_dirent de = { NULL, };
struct cifs_fattr fattr; struct cifs_fattr fattr;
struct dentry *dentry;
struct qstr name; struct qstr name;
int rc = 0; int rc = 0;
ino_t ino; ino_t ino;
...@@ -723,13 +730,11 @@ static int cifs_filldir(char *find_entry, struct file *file, filldir_t filldir, ...@@ -723,13 +730,11 @@ static int cifs_filldir(char *find_entry, struct file *file, filldir_t filldir,
*/ */
fattr.cf_flags |= CIFS_FATTR_NEED_REVAL; fattr.cf_flags |= CIFS_FATTR_NEED_REVAL;
ino = cifs_uniqueid_to_ino_t(fattr.cf_uniqueid); cifs_prime_dcache(file->f_dentry, &name, &fattr);
dentry = cifs_readdir_lookup(file->f_dentry, &name, &fattr);
ino = cifs_uniqueid_to_ino_t(fattr.cf_uniqueid);
rc = filldir(dirent, name.name, name.len, file->f_pos, ino, rc = filldir(dirent, name.name, name.len, file->f_pos, ino,
fattr.cf_dtype); fattr.cf_dtype);
dput(dentry);
return rc; return rc;
} }
......
...@@ -53,6 +53,13 @@ send_nt_cancel(struct TCP_Server_Info *server, void *buf, ...@@ -53,6 +53,13 @@ send_nt_cancel(struct TCP_Server_Info *server, void *buf,
mutex_unlock(&server->srv_mutex); mutex_unlock(&server->srv_mutex);
return rc; return rc;
} }
/*
* The response to this call was already factored into the sequence
* number when the call went out, so we must adjust it back downward
* after signing here.
*/
--server->sequence_number;
rc = smb_send(server, in_buf, be32_to_cpu(in_buf->smb_buf_length)); rc = smb_send(server, in_buf, be32_to_cpu(in_buf->smb_buf_length));
mutex_unlock(&server->srv_mutex); mutex_unlock(&server->srv_mutex);
......
...@@ -425,7 +425,7 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses) ...@@ -425,7 +425,7 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
} }
cFYI(1, "sec_flags 0x%x", sec_flags); cFYI(1, "sec_flags 0x%x", sec_flags);
if (sec_flags & CIFSSEC_MUST_SIGN) { if ((sec_flags & CIFSSEC_MUST_SIGN) == CIFSSEC_MUST_SIGN) {
cFYI(1, "Signing required"); cFYI(1, "Signing required");
if (!(server->sec_mode & (SMB2_NEGOTIATE_SIGNING_REQUIRED | if (!(server->sec_mode & (SMB2_NEGOTIATE_SIGNING_REQUIRED |
SMB2_NEGOTIATE_SIGNING_ENABLED))) { SMB2_NEGOTIATE_SIGNING_ENABLED))) {
......
...@@ -144,9 +144,6 @@ smb_send_kvec(struct TCP_Server_Info *server, struct kvec *iov, size_t n_vec, ...@@ -144,9 +144,6 @@ smb_send_kvec(struct TCP_Server_Info *server, struct kvec *iov, size_t n_vec,
*sent = 0; *sent = 0;
if (ssocket == NULL)
return -ENOTSOCK; /* BB eventually add reconnect code here */
smb_msg.msg_name = (struct sockaddr *) &server->dstaddr; smb_msg.msg_name = (struct sockaddr *) &server->dstaddr;
smb_msg.msg_namelen = sizeof(struct sockaddr); smb_msg.msg_namelen = sizeof(struct sockaddr);
smb_msg.msg_control = NULL; smb_msg.msg_control = NULL;
...@@ -291,6 +288,9 @@ smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst) ...@@ -291,6 +288,9 @@ smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst)
struct socket *ssocket = server->ssocket; struct socket *ssocket = server->ssocket;
int val = 1; int val = 1;
if (ssocket == NULL)
return -ENOTSOCK;
cFYI(1, "Sending smb: smb_len=%u", smb_buf_length); cFYI(1, "Sending smb: smb_len=%u", smb_buf_length);
dump_smb(iov[0].iov_base, iov[0].iov_len); dump_smb(iov[0].iov_base, iov[0].iov_len);
......
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