@@ -322,7 +322,7 @@ cifs_dfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
nd->path.dentry = dget(dentry);
cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
- ses = cifs_sb->tcon->ses;
+ ses = cifs_sb_tcon(cifs_sb)->ses;
if (!ses) {
rc = -EINVAL;
@@ -558,7 +558,7 @@ static struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
int xid, rc;
xid = GetXid();
- rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen);
+ rc = CIFSSMBGetCIFSACL(xid, cifs_sb_tcon(cifs_sb), fid, &pntsd, pacllen);
FreeXid(xid);
@@ -576,7 +576,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
xid = GetXid();
- rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, READ_CONTROL, 0,
+ rc = CIFSSMBOpen(xid, cifs_sb_tcon(cifs_sb), path, FILE_OPEN, READ_CONTROL, 0,
&fid, &oplock, NULL, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
if (rc) {
@@ -584,10 +584,10 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
goto out;
}
- rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen);
+ rc = CIFSSMBGetCIFSACL(xid, cifs_sb_tcon(cifs_sb), fid, &pntsd, pacllen);
cFYI(1, ("GetCIFSACL rc = %d ACL len %d", rc, *pacllen));
- CIFSSMBClose(xid, cifs_sb->tcon, fid);
+ CIFSSMBClose(xid, cifs_sb_tcon(cifs_sb), fid);
out:
FreeXid(xid);
return pntsd;
@@ -617,7 +617,7 @@ static int set_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb, __u16 fid,
int xid, rc;
xid = GetXid();
- rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen);
+ rc = CIFSSMBSetCIFSACL(xid, cifs_sb_tcon(cifs_sb), fid, pnntsd, acllen);
FreeXid(xid);
cFYI(DBG2, ("SetCIFSACL rc = %d", rc));
@@ -633,7 +633,7 @@ static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path,
xid = GetXid();
- rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, WRITE_DAC, 0,
+ rc = CIFSSMBOpen(xid, cifs_sb_tcon(cifs_sb), path, FILE_OPEN, WRITE_DAC, 0,
&fid, &oplock, NULL, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
if (rc) {
@@ -641,10 +641,10 @@ static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path,
goto out;
}
- rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen);
+ rc = CIFSSMBSetCIFSACL(xid, cifs_sb_tcon(cifs_sb), fid, pnntsd, acllen);
cFYI(DBG2, ("SetCIFSACL rc = %d", rc));
- CIFSSMBClose(xid, cifs_sb->tcon, fid);
+ CIFSSMBClose(xid, cifs_sb_tcon(cifs_sb), fid);
out:
FreeXid(xid);
return rc;
@@ -135,9 +135,9 @@ cifs_read_super(struct super_block *sb, void *data,
sb->s_magic = CIFS_MAGIC_NUMBER;
sb->s_op = &cifs_super_ops;
-/* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
+/* if (cifs_sb_tcon(cifs_sb)->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
sb->s_blocksize =
- cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
+ cifs_sb_tcon(cifs_sb)->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
#ifdef CONFIG_CIFS_QUOTA
sb->s_qcop = &cifs_quotactl_ops;
#endif
@@ -224,7 +224,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
{
struct super_block *sb = dentry->d_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
- struct cifsTconInfo *tcon = cifs_sb->tcon;
+ struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
int rc = -EOPNOTSUPP;
int xid;
@@ -359,7 +359,7 @@ static int
cifs_show_options(struct seq_file *s, struct vfsmount *m)
{
struct cifs_sb_info *cifs_sb = CIFS_SB(m->mnt_sb);
- struct cifsTconInfo *tcon = cifs_sb->tcon;
+ struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
seq_printf(s, ",unc=%s", tcon->treeName);
if (tcon->ses->userName)
@@ -432,7 +432,7 @@ int cifs_xquota_set(struct super_block *sb, int quota_type, qid_t qid,
struct cifsTconInfo *pTcon;
if (cifs_sb)
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
else
return -EIO;
@@ -456,7 +456,7 @@ int cifs_xquota_get(struct super_block *sb, int quota_type, qid_t qid,
struct cifsTconInfo *pTcon;
if (cifs_sb)
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
else
return -EIO;
@@ -478,7 +478,7 @@ int cifs_xstate_set(struct super_block *sb, unsigned int flags, int operation)
struct cifsTconInfo *pTcon;
if (cifs_sb)
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
else
return -EIO;
@@ -500,7 +500,7 @@ int cifs_xstate_get(struct super_block *sb, struct fs_quota_stat *qstats)
struct cifsTconInfo *pTcon;
if (cifs_sb)
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
else
return -EIO;
@@ -530,7 +530,7 @@ static void cifs_umount_begin(struct super_block *sb)
if (cifs_sb == NULL)
return;
- tcon = cifs_sb->tcon;
+ tcon = cifs_sb_tcon(cifs_sb);
if (tcon == NULL)
return;
@@ -662,7 +662,7 @@ static int cifs_setlease(struct file *file, long arg, struct file_lock **lease)
((arg == F_WRLCK) &&
(CIFS_I(inode)->clientCanCacheAll)))
return generic_setlease(file, arg, lease);
- else if (CIFS_SB(inode->i_sb)->tcon->local_lease &&
+ else if (cifs_sb_tcon(CIFS_SB(inode->i_sb))->local_lease &&
!CIFS_I(inode)->clientCanCacheRead)
/* If the server claims to support oplock on this
file, then we still need to check oplock even
@@ -407,6 +407,12 @@ CIFS_SB(struct super_block *sb)
return sb->s_fs_info;
}
+static inline struct cifsTconInfo *
+cifs_sb_tcon(struct cifs_sb_info *cifs_sb)
+{
+ return cifs_sb->tcon;
+}
+
static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb)
{
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
@@ -2820,8 +2820,8 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb)
int rc = 0;
char *tmp;
- if (cifs_sb->tcon)
- cifs_put_tcon(cifs_sb->tcon);
+ if (cifs_sb_tcon(cifs_sb))
+ cifs_put_tcon(cifs_sb_tcon(cifs_sb));
cifs_sb->tcon = NULL;
tmp = cifs_sb->prepath;
@@ -63,8 +63,8 @@ build_path_from_dentry(struct dentry *direntry)
cifs_sb = CIFS_SB(direntry->d_sb);
dirsep = CIFS_DIR_SEP(cifs_sb);
pplen = cifs_sb->prepathlen;
- if (cifs_sb->tcon && (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS))
- dfsplen = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE + 1);
+ if (cifs_sb_tcon(cifs_sb) && (cifs_sb_tcon(cifs_sb)->Flags & SMB_SHARE_IS_IN_DFS))
+ dfsplen = strnlen(cifs_sb_tcon(cifs_sb)->treeName, MAX_TREE_SIZE + 1);
else
dfsplen = 0;
cifs_bp_rename_retry:
@@ -117,7 +117,7 @@ cifs_bp_rename_retry:
/* BB test paths to Windows with '/' in the midst of prepath */
if (dfsplen) {
- strncpy(full_path, cifs_sb->tcon->treeName, dfsplen);
+ strncpy(full_path, cifs_sb_tcon(cifs_sb)->treeName, dfsplen);
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) {
int i;
for (i = 0; i < dfsplen; i++) {
@@ -160,7 +160,7 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle,
slow_work_init(&pCifsFile->oplock_break, &cifs_oplock_break_ops);
write_lock(&GlobalSMBSeslock);
- list_add(&pCifsFile->tlist, &cifs_sb->tcon->openFileList);
+ list_add(&pCifsFile->tlist, &cifs_sb_tcon(cifs_sb)->openFileList);
pCifsInode = CIFS_I(newinode);
if (pCifsInode) {
/* if readable file instance put first in list*/
@@ -225,7 +225,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
posix_flags |= SMB_O_DIRECT;
mode &= ~current_umask();
- rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode,
+ rc = CIFSPOSIXCreate(xid, cifs_sb_tcon(cifs_sb), posix_flags, mode,
pnetfid, presp_data, poplock, full_path,
cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR);
@@ -300,7 +300,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb);
- tcon = cifs_sb->tcon;
+ tcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry);
if (full_path == NULL) {
@@ -378,7 +378,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
if (!tcon->unix_ext && (mode & S_IWUGO) == 0)
create_options |= CREATE_OPTION_READONLY;
- if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS)
+ if (cifs_sb_tcon(cifs_sb)->ses->capabilities & CAP_NT_SMBS)
rc = CIFSSMBOpen(xid, tcon, full_path, disposition,
desiredAccess, create_options,
&fileHandle, &oplock, buf, cifs_sb->local_nls,
@@ -490,7 +490,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry);
if (full_path == NULL)
@@ -622,7 +622,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
/* check whether path exists */
cifs_sb = CIFS_SB(parent_dir_inode->i_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
/*
* Don't allow the separator character in a path component.
@@ -267,7 +267,7 @@ int cifs_open(struct inode *inode, struct file *file)
xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb);
- tcon = cifs_sb->tcon;
+ tcon = cifs_sb_tcon(cifs_sb);
pCifsInode = CIFS_I(file->f_path.dentry->d_inode);
pCifsFile = cifs_fill_filedata(file);
@@ -369,7 +369,7 @@ int cifs_open(struct inode *inode, struct file *file)
goto out;
}
- if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS)
+ if (cifs_sb_tcon(cifs_sb)->ses->capabilities & CAP_NT_SMBS)
rc = CIFSSMBOpen(xid, tcon, full_path, disposition,
desiredAccess, CREATE_NOT_DIR, &netfid, &oplock, buf,
cifs_sb->local_nls, cifs_sb->mnt_cifs_flags
@@ -483,7 +483,7 @@ static int cifs_reopen_file(struct file *file, bool can_flush)
}
cifs_sb = CIFS_SB(inode->i_sb);
- tcon = cifs_sb->tcon;
+ tcon = cifs_sb_tcon(cifs_sb);
/* can not grab rename sem here because various ops, including
those that already have the rename sem can end up causing writepage
@@ -598,7 +598,7 @@ int cifs_close(struct inode *inode, struct file *file)
xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
if (pSMBFile) {
struct cifsLockInfo *li, *tmp;
write_lock(&GlobalSMBSeslock);
@@ -682,7 +682,7 @@ int cifs_closedir(struct inode *inode, struct file *file)
struct cifs_sb_info *cifs_sb =
CIFS_SB(file->f_path.dentry->d_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
cFYI(1, ("Freeing private data in close dir"));
write_lock(&GlobalSMBSeslock);
@@ -792,7 +792,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
cFYI(1, ("Unknown type of lock"));
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
- tcon = cifs_sb->tcon;
+ tcon = cifs_sb_tcon(cifs_sb);
if (file->private_data == NULL) {
rc = -EBADF;
@@ -961,7 +961,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
/* cFYI(1,
(" write %d bytes to offset %lld of %s", write_size,
@@ -1064,7 +1064,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
cFYI(1, ("write %zd bytes to offset %lld of %s", write_size,
*poffset, file->f_path.dentry->d_name.name));
@@ -1295,7 +1295,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
inode = page->mapping->host;
cifs_sb = CIFS_SB(inode->i_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
offset += (loff_t)from;
write_data = kmap(page);
@@ -1370,8 +1370,8 @@ static int cifs_writepages(struct address_space *mapping,
if (cifs_sb->wsize < PAGE_CACHE_SIZE)
return generic_writepages(mapping, wbc);
- if ((cifs_sb->tcon->ses) && (cifs_sb->tcon->ses->server))
- if (cifs_sb->tcon->ses->server->secMode &
+ if ((cifs_sb_tcon(cifs_sb)->ses) && (cifs_sb_tcon(cifs_sb)->ses->server))
+ if (cifs_sb_tcon(cifs_sb)->ses->server->secMode &
(SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
if (!experimEnabled)
return generic_writepages(mapping, wbc);
@@ -1504,7 +1504,7 @@ retry:
rc = -EBADF;
} else {
long_op = cifs_write_timeout(cifsi, offset);
- rc = CIFSSMBWrite2(xid, cifs_sb->tcon,
+ rc = CIFSSMBWrite2(xid, cifs_sb_tcon(cifs_sb),
open_file->netfid,
bytes_to_write, offset,
&bytes_written, iov, n_iov,
@@ -1522,7 +1522,7 @@ retry:
else
set_bit(AS_EIO, &mapping->flags);
} else {
- cifs_stats_bytes_written(cifs_sb->tcon,
+ cifs_stats_bytes_written(cifs_sb_tcon(cifs_sb),
bytes_written);
}
}
@@ -1668,7 +1668,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
if (rc == 0) {
rc = CIFS_I(inode)->write_behind_rc;
CIFS_I(inode)->write_behind_rc = 0;
- tcon = CIFS_SB(inode->i_sb)->tcon;
+ tcon = cifs_sb_tcon(CIFS_SB(inode->i_sb));
if (!rc && tcon && smbfile &&
!(CIFS_SB(inode->i_sb)->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC))
rc = CIFSSMBFlush(xid, tcon, smbfile->netfid);
@@ -1753,7 +1753,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
xid = GetXid();
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
if (file->private_data == NULL) {
rc = -EBADF;
@@ -1834,7 +1834,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
xid = GetXid();
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
if (file->private_data == NULL) {
rc = -EBADF;
@@ -2015,7 +2015,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
}
open_file = (struct cifsFileInfo *)file->private_data;
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
pagevec_init(&lru_pvec, 0);
cFYI(DBG2, ("rpages: num pages %d", num_pages));
@@ -2349,7 +2349,7 @@ cifs_oplock_break(struct slow_work *work)
* disconnected since oplock already released by the server
*/
if (!cfile->closePend && !cfile->oplock_break_cancelled) {
- rc = CIFSSMBLock(0, cifs_sb->tcon, cfile->netfid, 0, 0, 0, 0,
+ rc = CIFSSMBLock(0, cifs_sb_tcon(cifs_sb), cfile->netfid, 0, 0, 0, 0,
LOCKING_ANDX_OPLOCK_RELEASE, false);
cFYI(1, ("Oplock release rc = %d", rc));
}
@@ -50,7 +50,7 @@ static void cifs_set_ops(struct inode *inode, const bool is_dfs_referral)
/* check if server can support readpages */
- if (cifs_sb->tcon->ses->server->maxBuf <
+ if (cifs_sb_tcon(cifs_sb)->ses->server->maxBuf <
PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)
inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
else
@@ -276,7 +276,7 @@ int cifs_get_file_info_unix(struct file *filp)
struct cifs_fattr fattr;
struct inode *inode = filp->f_path.dentry->d_inode;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
- struct cifsTconInfo *tcon = cifs_sb->tcon;
+ struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
struct cifsFileInfo *cfile = (struct cifsFileInfo *) filp->private_data;
xid = GetXid();
@@ -303,7 +303,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
struct cifsTconInfo *tcon;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
- tcon = cifs_sb->tcon;
+ tcon = cifs_sb_tcon(cifs_sb);
cFYI(1, ("Getting info on %s", full_path));
/* could have done a find first instead but this returns more info */
@@ -340,7 +340,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path,
int rc;
int oplock = 0;
__u16 netfid;
- struct cifsTconInfo *pTcon = cifs_sb->tcon;
+ struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb);
char buf[24];
unsigned int bytes_read;
char *pbuf;
@@ -429,7 +429,7 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
char ea_value[4];
__u32 mode;
- rc = CIFSSMBQAllEAs(xid, cifs_sb->tcon, path, "SETFILEBITS",
+ rc = CIFSSMBQAllEAs(xid, cifs_sb_tcon(cifs_sb), path, "SETFILEBITS",
ea_value, 4 /* size of buf */, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR);
@@ -469,8 +469,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime);
if (adjust_tz) {
- fattr->cf_ctime.tv_sec += cifs_sb->tcon->ses->server->timeAdj;
- fattr->cf_mtime.tv_sec += cifs_sb->tcon->ses->server->timeAdj;
+ fattr->cf_ctime.tv_sec += cifs_sb_tcon(cifs_sb)->ses->server->timeAdj;
+ fattr->cf_mtime.tv_sec += cifs_sb_tcon(cifs_sb)->ses->server->timeAdj;
}
fattr->cf_eof = le64_to_cpu(info->EndOfFile);
@@ -502,7 +502,7 @@ int cifs_get_file_info(struct file *filp)
struct cifs_fattr fattr;
struct inode *inode = filp->f_path.dentry->d_inode;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
- struct cifsTconInfo *tcon = cifs_sb->tcon;
+ struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
struct cifsFileInfo *cfile = (struct cifsFileInfo *) filp->private_data;
xid = GetXid();
@@ -546,7 +546,7 @@ int cifs_get_inode_info(struct inode **pinode,
bool adjustTZ = false;
struct cifs_fattr fattr;
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
cFYI(1, ("Getting info on %s", full_path));
if ((pfindData == NULL) && (*pinode != NULL)) {
@@ -678,8 +678,8 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb)
return full_path;
}
- if (cifs_sb->tcon && (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS))
- dfsplen = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE + 1);
+ if (cifs_sb_tcon(cifs_sb) && (cifs_sb_tcon(cifs_sb)->Flags & SMB_SHARE_IS_IN_DFS))
+ dfsplen = strnlen(cifs_sb_tcon(cifs_sb)->treeName, MAX_TREE_SIZE + 1);
else
dfsplen = 0;
@@ -688,7 +688,7 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb)
return full_path;
if (dfsplen) {
- strncpy(full_path, cifs_sb->tcon->treeName, dfsplen);
+ strncpy(full_path, cifs_sb_tcon(cifs_sb)->treeName, dfsplen);
/* switch slash direction in prepath depending on whether
* windows or posix style path names
*/
@@ -768,7 +768,7 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
return ERR_PTR(-ENOMEM);
xid = GetXid();
- if (cifs_sb->tcon->unix_ext)
+ if (cifs_sb_tcon(cifs_sb)->unix_ext)
rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid);
else
rc = cifs_get_inode_info(&inode, full_path, NULL, sb,
@@ -777,7 +777,7 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino)
if (!inode)
return ERR_PTR(-ENOMEM);
- if (rc && cifs_sb->tcon->ipc) {
+ if (rc && cifs_sb_tcon(cifs_sb)->ipc) {
cFYI(1, ("ipc connection - fake read inode"));
inode->i_mode |= S_IFDIR;
inode->i_nlink = 2;
@@ -813,7 +813,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid,
struct cifsFileInfo *open_file;
struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
- struct cifsTconInfo *pTcon = cifs_sb->tcon;
+ struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb);
FILE_BASIC_INFO info_buf;
if (attrs == NULL)
@@ -919,7 +919,7 @@ cifs_rename_pending_delete(char *full_path, struct dentry *dentry, int xid)
struct inode *inode = dentry->d_inode;
struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
- struct cifsTconInfo *tcon = cifs_sb->tcon;
+ struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
__u32 dosattr, origattr;
FILE_BASIC_INFO *info_buf = NULL;
@@ -1030,7 +1030,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
struct cifsInodeInfo *cifs_inode;
struct super_block *sb = dir->i_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
- struct cifsTconInfo *tcon = cifs_sb->tcon;
+ struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
struct iattr *attrs = NULL;
__u32 dosattr = 0, origattr = 0;
@@ -1132,7 +1132,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry);
if (full_path == NULL) {
@@ -1312,7 +1312,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry);
if (full_path == NULL) {
@@ -1353,7 +1353,7 @@ cifs_do_rename(int xid, struct dentry *from_dentry, const char *fromPath,
struct dentry *to_dentry, const char *toPath)
{
struct cifs_sb_info *cifs_sb = CIFS_SB(from_dentry->d_sb);
- struct cifsTconInfo *pTcon = cifs_sb->tcon;
+ struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb);
__u16 srcfid;
int oplock, rc;
@@ -1402,7 +1402,7 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry,
cifs_sb_target = CIFS_SB(target_dir->i_sb);
cifs_sb_source = CIFS_SB(source_dir->i_sb);
- tcon = cifs_sb_source->tcon;
+ tcon = cifs_sb_tcon(cifs_sb_source);
xid = GetXid();
@@ -1410,7 +1410,7 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry,
* BB: this might be allowed if same server, but different share.
* Consider adding support for this
*/
- if (tcon != cifs_sb_target->tcon) {
+ if (tcon != cifs_sb_tcon(cifs_sb_target)) {
rc = -EXDEV;
goto cifs_rename_exit;
}
@@ -1538,7 +1538,7 @@ int cifs_revalidate_file(struct file *filp)
if (!cifs_inode_needs_reval(inode))
goto check_inval;
- if (CIFS_SB(inode->i_sb)->tcon->unix_ext)
+ if (cifs_sb_tcon(CIFS_SB(inode->i_sb))->unix_ext)
rc = cifs_get_file_info_unix(filp);
else
rc = cifs_get_file_info(filp);
@@ -1579,7 +1579,7 @@ int cifs_revalidate_dentry(struct dentry *dentry)
"jiffies %ld", full_path, inode, inode->i_count.counter,
dentry, dentry->d_time, jiffies));
- if (CIFS_SB(sb)->tcon->unix_ext)
+ if (cifs_sb_tcon(CIFS_SB(sb))->unix_ext)
rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid);
else
rc = cifs_get_inode_info(&inode, full_path, NULL, sb,
@@ -1653,7 +1653,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
struct cifsFileInfo *open_file;
struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
- struct cifsTconInfo *pTcon = cifs_sb->tcon;
+ struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb);
/*
* To avoid spurious oplock breaks from server, in the case of
@@ -1731,7 +1731,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
struct inode *inode = direntry->d_inode;
struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
- struct cifsTconInfo *pTcon = cifs_sb->tcon;
+ struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb);
struct cifs_unix_set_info_args *args = NULL;
struct cifsFileInfo *open_file;
@@ -1997,7 +1997,7 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs)
{
struct inode *inode = direntry->d_inode;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
- struct cifsTconInfo *pTcon = cifs_sb->tcon;
+ struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb);
if (pTcon->unix_ext)
return cifs_setattr_unix(direntry, attrs);
@@ -52,7 +52,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
cifs_sb = CIFS_SB(inode->i_sb);
#ifdef CONFIG_CIFS_POSIX
- tcon = cifs_sb->tcon;
+ tcon = cifs_sb_tcon(cifs_sb);
if (tcon)
caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
else {
@@ -43,7 +43,7 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
xid = GetXid();
cifs_sb_target = CIFS_SB(inode->i_sb);
- pTcon = cifs_sb_target->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb_target);
/* No need to check for cross device links since server will do that
BB note DFS case in future though (when we may have to check) */
@@ -112,7 +112,7 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
char *full_path = NULL;
char *target_path = NULL;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
- struct cifsTconInfo *tcon = cifs_sb->tcon;
+ struct cifsTconInfo *tcon = cifs_sb_tcon(cifs_sb);
xid = GetXid();
@@ -167,7 +167,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry);
@@ -726,6 +726,6 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
"properly. Hardlinks will not be recognized on this "
"mount. Consider mounting with the \"noserverino\" "
"option to silence this message.",
- cifs_sb->tcon->treeName));
+ cifs_sb_tcon(cifs_sb)->treeName));
}
}
@@ -101,7 +101,7 @@ cifs_readdir_lookup(struct dentry *parent, struct qstr *name,
return NULL;
}
- if (CIFS_SB(sb)->tcon->nocase)
+ if (cifs_sb_tcon(CIFS_SB(sb))->nocase)
dentry->d_op = &cifs_ci_dentry_ops;
else
dentry->d_op = &cifs_dentry_ops;
@@ -170,7 +170,7 @@ static void
cifs_std_info_to_fattr(struct cifs_fattr *fattr, FIND_FILE_STANDARD_INFO *info,
struct cifs_sb_info *cifs_sb)
{
- int offset = cifs_sb->tcon->ses->server->timeAdj;
+ int offset = cifs_sb_tcon(cifs_sb)->ses->server->timeAdj;
memset(fattr, 0, sizeof(*fattr));
fattr->cf_atime = cnvrtDosUnixTm(info->LastAccessDate,
@@ -198,7 +198,7 @@ int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb,
int len;
int oplock = 0;
int rc;
- struct cifsTconInfo *ptcon = cifs_sb->tcon;
+ struct cifsTconInfo *ptcon = cifs_sb_tcon(cifs_sb);
char *tmpbuffer;
rc = CIFSSMBOpen(xid, ptcon, full_path, FILE_OPEN, GENERIC_READ,
@@ -242,7 +242,7 @@ static int initiate_cifs_search(const int xid, struct file *file)
if (cifs_sb == NULL)
return -EINVAL;
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
if (pTcon == NULL)
return -EINVAL;
@@ -777,7 +777,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
xid = GetXid();
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
if (pTcon == NULL)
return -EINVAL;
@@ -60,7 +60,7 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name)
xid = GetXid();
cifs_sb = CIFS_SB(sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry);
if (full_path == NULL) {
@@ -115,7 +115,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
xid = GetXid();
cifs_sb = CIFS_SB(sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry);
if (full_path == NULL) {
@@ -223,7 +223,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
xid = GetXid();
cifs_sb = CIFS_SB(sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
full_path = build_path_from_dentry(direntry);
if (full_path == NULL) {
@@ -345,7 +345,7 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
return -EIO;
cifs_sb = CIFS_SB(sb);
- pTcon = cifs_sb->tcon;
+ pTcon = cifs_sb_tcon(cifs_sb);
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
return -EOPNOTSUPP;