aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 016975b8e6dd..0fa145596fcf 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -288,8 +288,8 @@ int cifs_get_file_info_unix(struct file *filp)
288 struct cifs_fattr fattr; 288 struct cifs_fattr fattr;
289 struct inode *inode = filp->f_path.dentry->d_inode; 289 struct inode *inode = filp->f_path.dentry->d_inode;
290 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 290 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
291 struct cifsTconInfo *tcon = cifs_sb->tcon;
292 struct cifsFileInfo *cfile = filp->private_data; 291 struct cifsFileInfo *cfile = filp->private_data;
292 struct cifsTconInfo *tcon = cfile->tcon;
293 293
294 xid = GetXid(); 294 xid = GetXid();
295 rc = CIFSSMBUnixQFileInfo(xid, tcon, cfile->netfid, &find_data); 295 rc = CIFSSMBUnixQFileInfo(xid, tcon, cfile->netfid, &find_data);
@@ -522,8 +522,8 @@ int cifs_get_file_info(struct file *filp)
522 struct cifs_fattr fattr; 522 struct cifs_fattr fattr;
523 struct inode *inode = filp->f_path.dentry->d_inode; 523 struct inode *inode = filp->f_path.dentry->d_inode;
524 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 524 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
525 struct cifsTconInfo *tcon = cifs_sb->tcon;
526 struct cifsFileInfo *cfile = filp->private_data; 525 struct cifsFileInfo *cfile = filp->private_data;
526 struct cifsTconInfo *tcon = cfile->tcon;
527 527
528 xid = GetXid(); 528 xid = GetXid();
529 rc = CIFSSMBQFileInfo(xid, tcon, cfile->netfid, &find_data); 529 rc = CIFSSMBQFileInfo(xid, tcon, cfile->netfid, &find_data);
@@ -891,7 +891,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid,
891 struct cifsFileInfo *open_file; 891 struct cifsFileInfo *open_file;
892 struct cifsInodeInfo *cifsInode = CIFS_I(inode); 892 struct cifsInodeInfo *cifsInode = CIFS_I(inode);
893 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 893 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
894 struct cifsTconInfo *pTcon = cifs_sb->tcon; 894 struct cifsTconInfo *pTcon;
895 FILE_BASIC_INFO info_buf; 895 FILE_BASIC_INFO info_buf;
896 896
897 if (attrs == NULL) 897 if (attrs == NULL)
@@ -934,9 +934,12 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid,
934 if (open_file) { 934 if (open_file) {
935 netfid = open_file->netfid; 935 netfid = open_file->netfid;
936 netpid = open_file->pid; 936 netpid = open_file->pid;
937 pTcon = open_file->tcon;
937 goto set_via_filehandle; 938 goto set_via_filehandle;
938 } 939 }
939 940
941 pTcon = cifs_sb->tcon;
942
940 /* 943 /*
941 * NT4 apparently returns success on this call, but it doesn't 944 * NT4 apparently returns success on this call, but it doesn't
942 * really work. 945 * really work.
@@ -1611,11 +1614,12 @@ int cifs_revalidate_file(struct file *filp)
1611{ 1614{
1612 int rc = 0; 1615 int rc = 0;
1613 struct inode *inode = filp->f_path.dentry->d_inode; 1616 struct inode *inode = filp->f_path.dentry->d_inode;
1617 struct cifsFileInfo *cfile = (struct cifsFileInfo *) filp->private_data;
1614 1618
1615 if (!cifs_inode_needs_reval(inode)) 1619 if (!cifs_inode_needs_reval(inode))
1616 goto check_inval; 1620 goto check_inval;
1617 1621
1618 if (CIFS_SB(inode->i_sb)->tcon->unix_ext) 1622 if (cfile->tcon->unix_ext)
1619 rc = cifs_get_file_info_unix(filp); 1623 rc = cifs_get_file_info_unix(filp);
1620 else 1624 else
1621 rc = cifs_get_file_info(filp); 1625 rc = cifs_get_file_info(filp);
@@ -1720,7 +1724,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
1720 struct cifsFileInfo *open_file; 1724 struct cifsFileInfo *open_file;
1721 struct cifsInodeInfo *cifsInode = CIFS_I(inode); 1725 struct cifsInodeInfo *cifsInode = CIFS_I(inode);
1722 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 1726 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1723 struct cifsTconInfo *pTcon = cifs_sb->tcon; 1727 struct cifsTconInfo *pTcon = NULL;
1724 1728
1725 /* 1729 /*
1726 * To avoid spurious oplock breaks from server, in the case of 1730 * To avoid spurious oplock breaks from server, in the case of
@@ -1735,6 +1739,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
1735 if (open_file) { 1739 if (open_file) {
1736 __u16 nfid = open_file->netfid; 1740 __u16 nfid = open_file->netfid;
1737 __u32 npid = open_file->pid; 1741 __u32 npid = open_file->pid;
1742 pTcon = open_file->tcon;
1738 rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, nfid, 1743 rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, nfid,
1739 npid, false); 1744 npid, false);
1740 cifsFileInfo_put(open_file); 1745 cifsFileInfo_put(open_file);
@@ -1749,6 +1754,9 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
1749 rc = -EINVAL; 1754 rc = -EINVAL;
1750 1755
1751 if (rc != 0) { 1756 if (rc != 0) {
1757 if (pTcon == NULL)
1758 pTcon = cifs_sb->tcon;
1759
1752 /* Set file size by pathname rather than by handle 1760 /* Set file size by pathname rather than by handle
1753 either because no valid, writeable file handle for 1761 either because no valid, writeable file handle for
1754 it was found or because there was an error setting 1762 it was found or because there was an error setting
@@ -1798,7 +1806,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
1798 struct inode *inode = direntry->d_inode; 1806 struct inode *inode = direntry->d_inode;
1799 struct cifsInodeInfo *cifsInode = CIFS_I(inode); 1807 struct cifsInodeInfo *cifsInode = CIFS_I(inode);
1800 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 1808 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1801 struct cifsTconInfo *pTcon = cifs_sb->tcon; 1809 struct cifsTconInfo *pTcon;
1802 struct cifs_unix_set_info_args *args = NULL; 1810 struct cifs_unix_set_info_args *args = NULL;
1803 struct cifsFileInfo *open_file; 1811 struct cifsFileInfo *open_file;
1804 1812
@@ -1889,9 +1897,11 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
1889 if (open_file) { 1897 if (open_file) {
1890 u16 nfid = open_file->netfid; 1898 u16 nfid = open_file->netfid;
1891 u32 npid = open_file->pid; 1899 u32 npid = open_file->pid;
1900 pTcon = open_file->tcon;
1892 rc = CIFSSMBUnixSetFileInfo(xid, pTcon, args, nfid, npid); 1901 rc = CIFSSMBUnixSetFileInfo(xid, pTcon, args, nfid, npid);
1893 cifsFileInfo_put(open_file); 1902 cifsFileInfo_put(open_file);
1894 } else { 1903 } else {
1904 pTcon = cifs_sb->tcon;
1895 rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args, 1905 rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args,
1896 cifs_sb->local_nls, 1906 cifs_sb->local_nls,
1897 cifs_sb->mnt_cifs_flags & 1907 cifs_sb->mnt_cifs_flags &