diff options
author | Jeff Layton <jlayton@redhat.com> | 2010-09-20 19:01:35 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-09-29 15:04:33 -0400 |
commit | 0d424ad0a4b8c08e45928bccfa5b4b240097b01b (patch) | |
tree | 40f383b138d2e8121cda4b28f1f7c4b9642fe5ec /fs/cifs/inode.c | |
parent | f6acb9d0596889a774e142ed76cb05b90d9763d2 (diff) |
cifs: add cifs_sb_master_tcon and convert some callers to use it
At mount time, we'll always need to create a tcon that will serve as a
template for others that are associated with the mount. This tcon is
known as the "master" tcon.
In some cases, we'll need to use that tcon regardless of who's accessing
the mount. Add an accessor function for the master tcon and go ahead and
switch the appropriate places to use it.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r-- | fs/cifs/inode.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index dce2d598927e..da716d96dae6 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -52,7 +52,7 @@ static void cifs_set_ops(struct inode *inode, const bool is_dfs_referral) | |||
52 | 52 | ||
53 | 53 | ||
54 | /* check if server can support readpages */ | 54 | /* check if server can support readpages */ |
55 | if (cifs_sb_tcon(cifs_sb)->ses->server->maxBuf < | 55 | if (cifs_sb_master_tcon(cifs_sb)->ses->server->maxBuf < |
56 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) | 56 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE) |
57 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | 57 | inode->i_data.a_ops = &cifs_addr_ops_smallbuf; |
58 | else | 58 | else |
@@ -476,6 +476,8 @@ static void | |||
476 | cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, | 476 | cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, |
477 | struct cifs_sb_info *cifs_sb, bool adjust_tz) | 477 | struct cifs_sb_info *cifs_sb, bool adjust_tz) |
478 | { | 478 | { |
479 | struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); | ||
480 | |||
479 | memset(fattr, 0, sizeof(*fattr)); | 481 | memset(fattr, 0, sizeof(*fattr)); |
480 | fattr->cf_cifsattrs = le32_to_cpu(info->Attributes); | 482 | fattr->cf_cifsattrs = le32_to_cpu(info->Attributes); |
481 | if (info->DeletePending) | 483 | if (info->DeletePending) |
@@ -490,8 +492,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, | |||
490 | fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime); | 492 | fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime); |
491 | 493 | ||
492 | if (adjust_tz) { | 494 | if (adjust_tz) { |
493 | fattr->cf_ctime.tv_sec += cifs_sb_tcon(cifs_sb)->ses->server->timeAdj; | 495 | fattr->cf_ctime.tv_sec += tcon->ses->server->timeAdj; |
494 | fattr->cf_mtime.tv_sec += cifs_sb_tcon(cifs_sb)->ses->server->timeAdj; | 496 | fattr->cf_mtime.tv_sec += tcon->ses->server->timeAdj; |
495 | } | 497 | } |
496 | 498 | ||
497 | fattr->cf_eof = le64_to_cpu(info->EndOfFile); | 499 | fattr->cf_eof = le64_to_cpu(info->EndOfFile); |
@@ -698,6 +700,7 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb) | |||
698 | int pplen = cifs_sb->prepathlen; | 700 | int pplen = cifs_sb->prepathlen; |
699 | int dfsplen; | 701 | int dfsplen; |
700 | char *full_path = NULL; | 702 | char *full_path = NULL; |
703 | struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); | ||
701 | 704 | ||
702 | /* if no prefix path, simply set path to the root of share to "" */ | 705 | /* if no prefix path, simply set path to the root of share to "" */ |
703 | if (pplen == 0) { | 706 | if (pplen == 0) { |
@@ -707,8 +710,8 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb) | |||
707 | return full_path; | 710 | return full_path; |
708 | } | 711 | } |
709 | 712 | ||
710 | if (cifs_sb_tcon(cifs_sb) && (cifs_sb_tcon(cifs_sb)->Flags & SMB_SHARE_IS_IN_DFS)) | 713 | if (tcon->Flags & SMB_SHARE_IS_IN_DFS) |
711 | dfsplen = strnlen(cifs_sb_tcon(cifs_sb)->treeName, MAX_TREE_SIZE + 1); | 714 | dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1); |
712 | else | 715 | else |
713 | dfsplen = 0; | 716 | dfsplen = 0; |
714 | 717 | ||
@@ -717,7 +720,7 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb) | |||
717 | return full_path; | 720 | return full_path; |
718 | 721 | ||
719 | if (dfsplen) { | 722 | if (dfsplen) { |
720 | strncpy(full_path, cifs_sb_tcon(cifs_sb)->treeName, dfsplen); | 723 | strncpy(full_path, tcon->treeName, dfsplen); |
721 | /* switch slash direction in prepath depending on whether | 724 | /* switch slash direction in prepath depending on whether |
722 | * windows or posix style path names | 725 | * windows or posix style path names |
723 | */ | 726 | */ |
@@ -831,18 +834,18 @@ retry_iget5_locked: | |||
831 | struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) | 834 | struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) |
832 | { | 835 | { |
833 | int xid; | 836 | int xid; |
834 | struct cifs_sb_info *cifs_sb; | 837 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
835 | struct inode *inode = NULL; | 838 | struct inode *inode = NULL; |
836 | long rc; | 839 | long rc; |
837 | char *full_path; | 840 | char *full_path; |
841 | struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); | ||
838 | 842 | ||
839 | cifs_sb = CIFS_SB(sb); | ||
840 | full_path = cifs_build_path_to_root(cifs_sb); | 843 | full_path = cifs_build_path_to_root(cifs_sb); |
841 | if (full_path == NULL) | 844 | if (full_path == NULL) |
842 | return ERR_PTR(-ENOMEM); | 845 | return ERR_PTR(-ENOMEM); |
843 | 846 | ||
844 | xid = GetXid(); | 847 | xid = GetXid(); |
845 | if (cifs_sb_tcon(cifs_sb)->unix_ext) | 848 | if (tcon->unix_ext) |
846 | rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); | 849 | rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); |
847 | else | 850 | else |
848 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, | 851 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, |
@@ -853,10 +856,10 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) | |||
853 | 856 | ||
854 | #ifdef CONFIG_CIFS_FSCACHE | 857 | #ifdef CONFIG_CIFS_FSCACHE |
855 | /* populate tcon->resource_id */ | 858 | /* populate tcon->resource_id */ |
856 | cifs_sb_tcon(cifs_sb)->resource_id = CIFS_I(inode)->uniqueid; | 859 | tcon->resource_id = CIFS_I(inode)->uniqueid; |
857 | #endif | 860 | #endif |
858 | 861 | ||
859 | if (rc && cifs_sb_tcon(cifs_sb)->ipc) { | 862 | if (rc && tcon->ipc) { |
860 | cFYI(1, "ipc connection - fake read inode"); | 863 | cFYI(1, "ipc connection - fake read inode"); |
861 | inode->i_mode |= S_IFDIR; | 864 | inode->i_mode |= S_IFDIR; |
862 | inode->i_nlink = 2; | 865 | inode->i_nlink = 2; |
@@ -1661,7 +1664,7 @@ int cifs_revalidate_dentry(struct dentry *dentry) | |||
1661 | "jiffies %ld", full_path, inode, inode->i_count.counter, | 1664 | "jiffies %ld", full_path, inode, inode->i_count.counter, |
1662 | dentry, dentry->d_time, jiffies); | 1665 | dentry, dentry->d_time, jiffies); |
1663 | 1666 | ||
1664 | if (cifs_sb_tcon(CIFS_SB(sb))->unix_ext) | 1667 | if (cifs_sb_master_tcon(CIFS_SB(sb))->unix_ext) |
1665 | rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); | 1668 | rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); |
1666 | else | 1669 | else |
1667 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, | 1670 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, |
@@ -2087,7 +2090,7 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
2087 | { | 2090 | { |
2088 | struct inode *inode = direntry->d_inode; | 2091 | struct inode *inode = direntry->d_inode; |
2089 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 2092 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
2090 | struct cifsTconInfo *pTcon = cifs_sb_tcon(cifs_sb); | 2093 | struct cifsTconInfo *pTcon = cifs_sb_master_tcon(cifs_sb); |
2091 | 2094 | ||
2092 | if (pTcon->unix_ext) | 2095 | if (pTcon->unix_ext) |
2093 | return cifs_setattr_unix(direntry, attrs); | 2096 | return cifs_setattr_unix(direntry, attrs); |