Commit c6ea21e3 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: prevent infinite recursion in cifs_reconnect_tcon
  cifs: set backing_dev_info on new S_ISREG inodes
parents f4a3330d f569599a
...@@ -232,7 +232,7 @@ static int ...@@ -232,7 +232,7 @@ static int
small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
void **request_buf) void **request_buf)
{ {
int rc = 0; int rc;
rc = cifs_reconnect_tcon(tcon, smb_command); rc = cifs_reconnect_tcon(tcon, smb_command);
if (rc) if (rc)
...@@ -250,7 +250,7 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, ...@@ -250,7 +250,7 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
if (tcon != NULL) if (tcon != NULL)
cifs_stats_inc(&tcon->num_smbs_sent); cifs_stats_inc(&tcon->num_smbs_sent);
return rc; return 0;
} }
int int
...@@ -281,16 +281,9 @@ small_smb_init_no_tc(const int smb_command, const int wct, ...@@ -281,16 +281,9 @@ small_smb_init_no_tc(const int smb_command, const int wct,
/* If the return code is zero, this function must fill in request_buf pointer */ /* If the return code is zero, this function must fill in request_buf pointer */
static int static int
smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, __smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
void **request_buf /* returned */ , void **request_buf, void **response_buf)
void **response_buf /* returned */ )
{ {
int rc = 0;
rc = cifs_reconnect_tcon(tcon, smb_command);
if (rc)
return rc;
*request_buf = cifs_buf_get(); *request_buf = cifs_buf_get();
if (*request_buf == NULL) { if (*request_buf == NULL) {
/* BB should we add a retry in here if not a writepage? */ /* BB should we add a retry in here if not a writepage? */
...@@ -309,7 +302,31 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, ...@@ -309,7 +302,31 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
if (tcon != NULL) if (tcon != NULL)
cifs_stats_inc(&tcon->num_smbs_sent); cifs_stats_inc(&tcon->num_smbs_sent);
return 0;
}
/* If the return code is zero, this function must fill in request_buf pointer */
static int
smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
void **request_buf, void **response_buf)
{
int rc;
rc = cifs_reconnect_tcon(tcon, smb_command);
if (rc)
return rc; return rc;
return __smb_init(smb_command, wct, tcon, request_buf, response_buf);
}
static int
smb_init_no_reconnect(int smb_command, int wct, struct cifsTconInfo *tcon,
void **request_buf, void **response_buf)
{
if (tcon->ses->need_reconnect || tcon->need_reconnect)
return -EHOSTDOWN;
return __smb_init(smb_command, wct, tcon, request_buf, response_buf);
} }
static int validate_t2(struct smb_t2_rsp *pSMB) static int validate_t2(struct smb_t2_rsp *pSMB)
...@@ -4534,8 +4551,8 @@ CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon) ...@@ -4534,8 +4551,8 @@ CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon)
cFYI(1, "In QFSUnixInfo"); cFYI(1, "In QFSUnixInfo");
QFSUnixRetry: QFSUnixRetry:
rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, rc = smb_init_no_reconnect(SMB_COM_TRANSACTION2, 15, tcon,
(void **) &pSMBr); (void **) &pSMB, (void **) &pSMBr);
if (rc) if (rc)
return rc; return rc;
...@@ -4604,8 +4621,8 @@ CIFSSMBSetFSUnixInfo(const int xid, struct cifsTconInfo *tcon, __u64 cap) ...@@ -4604,8 +4621,8 @@ CIFSSMBSetFSUnixInfo(const int xid, struct cifsTconInfo *tcon, __u64 cap)
cFYI(1, "In SETFSUnixInfo"); cFYI(1, "In SETFSUnixInfo");
SETFSUnixRetry: SETFSUnixRetry:
/* BB switch to small buf init to save memory */ /* BB switch to small buf init to save memory */
rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, rc = smb_init_no_reconnect(SMB_COM_TRANSACTION2, 15, tcon,
(void **) &pSMBr); (void **) &pSMB, (void **) &pSMBr);
if (rc) if (rc)
return rc; return rc;
......
...@@ -801,6 +801,8 @@ cifs_iget(struct super_block *sb, struct cifs_fattr *fattr) ...@@ -801,6 +801,8 @@ cifs_iget(struct super_block *sb, struct cifs_fattr *fattr)
inode->i_flags |= S_NOATIME | S_NOCMTIME; inode->i_flags |= S_NOATIME | S_NOCMTIME;
if (inode->i_state & I_NEW) { if (inode->i_state & I_NEW) {
inode->i_ino = hash; inode->i_ino = hash;
if (S_ISREG(inode->i_mode))
inode->i_data.backing_dev_info = sb->s_bdi;
#ifdef CONFIG_CIFS_FSCACHE #ifdef CONFIG_CIFS_FSCACHE
/* initialize per-inode cache cookie pointer */ /* initialize per-inode cache cookie pointer */
CIFS_I(inode)->fscache = NULL; CIFS_I(inode)->fscache = NULL;
......
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