Commit 1957e7fd authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
  cifs: cope with negative dentries in cifs_get_root
  cifs: convert prefixpath delimiters in cifs_build_path_to_root
  CIFS: Fix missing a decrement of inFlight value
  cifs: demote DFS referral lookup errors to cFYI
  Revert "cifs: advertise the right receive buffer size to the server"
parents ce195d32 80975d21
...@@ -141,10 +141,11 @@ char *cifs_compose_mount_options(const char *sb_mountdata, ...@@ -141,10 +141,11 @@ char *cifs_compose_mount_options(const char *sb_mountdata,
rc = dns_resolve_server_name_to_ip(*devname, &srvIP); rc = dns_resolve_server_name_to_ip(*devname, &srvIP);
if (rc < 0) { if (rc < 0) {
cERROR(1, "%s: Failed to resolve server part of %s to IP: %d", cFYI(1, "%s: Failed to resolve server part of %s to IP: %d",
__func__, *devname, rc); __func__, *devname, rc);
goto compose_mount_options_err; goto compose_mount_options_err;
} }
/* md_len = strlen(...) + 12 for 'sep+prefixpath=' /* md_len = strlen(...) + 12 for 'sep+prefixpath='
* assuming that we have 'unc=' and 'ip=' in * assuming that we have 'unc=' and 'ip=' in
* the original sb_mountdata * the original sb_mountdata
......
...@@ -563,6 +563,10 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb) ...@@ -563,6 +563,10 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
mutex_unlock(&dir->i_mutex); mutex_unlock(&dir->i_mutex);
dput(dentry); dput(dentry);
dentry = child; dentry = child;
if (!dentry->d_inode) {
dput(dentry);
dentry = ERR_PTR(-ENOENT);
}
} while (!IS_ERR(dentry)); } while (!IS_ERR(dentry));
_FreeXid(xid); _FreeXid(xid);
kfree(full_path); kfree(full_path);
......
...@@ -79,8 +79,8 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) ...@@ -79,8 +79,8 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
/* Perform the upcall */ /* Perform the upcall */
rc = dns_query(NULL, hostname, len, NULL, ip_addr, NULL); rc = dns_query(NULL, hostname, len, NULL, ip_addr, NULL);
if (rc < 0) if (rc < 0)
cERROR(1, "%s: unable to resolve: %*.*s", cFYI(1, "%s: unable to resolve: %*.*s",
__func__, len, len, hostname); __func__, len, len, hostname);
else else
cFYI(1, "%s: resolved: %*.*s to %s", cFYI(1, "%s: resolved: %*.*s to %s",
__func__, len, len, hostname, *ip_addr); __func__, len, len, hostname, *ip_addr);
......
...@@ -764,20 +764,10 @@ char *cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb, ...@@ -764,20 +764,10 @@ char *cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb,
if (full_path == NULL) if (full_path == NULL)
return full_path; return full_path;
if (dfsplen) { if (dfsplen)
strncpy(full_path, tcon->treeName, dfsplen); strncpy(full_path, tcon->treeName, dfsplen);
/* switch slash direction in prepath depending on whether
* windows or posix style path names
*/
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) {
int i;
for (i = 0; i < dfsplen; i++) {
if (full_path[i] == '\\')
full_path[i] = '/';
}
}
}
strncpy(full_path + dfsplen, vol->prepath, pplen); strncpy(full_path + dfsplen, vol->prepath, pplen);
convert_delimiter(full_path, CIFS_DIR_SEP(cifs_sb));
full_path[dfsplen + pplen] = 0; /* add trailing null */ full_path[dfsplen + pplen] = 0; /* add trailing null */
return full_path; return full_path;
} }
......
...@@ -124,8 +124,7 @@ static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, SESSION_SETUP_ANDX *pSMB) ...@@ -124,8 +124,7 @@ static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, SESSION_SETUP_ANDX *pSMB)
/* that we use in next few lines */ /* that we use in next few lines */
/* Note that header is initialized to zero in header_assemble */ /* Note that header is initialized to zero in header_assemble */
pSMB->req.AndXCommand = 0xFF; pSMB->req.AndXCommand = 0xFF;
pSMB->req.MaxBufferSize = cpu_to_le16(min_t(u32, CIFSMaxBufSize - 4, pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf);
USHRT_MAX));
pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq); pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq);
pSMB->req.VcNumber = get_next_vcnum(ses); pSMB->req.VcNumber = get_next_vcnum(ses);
......
...@@ -362,6 +362,8 @@ cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov, ...@@ -362,6 +362,8 @@ cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
mid = AllocMidQEntry(hdr, server); mid = AllocMidQEntry(hdr, server);
if (mid == NULL) { if (mid == NULL) {
mutex_unlock(&server->srv_mutex); mutex_unlock(&server->srv_mutex);
atomic_dec(&server->inFlight);
wake_up(&server->request_q);
return -ENOMEM; return -ENOMEM;
} }
......
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