aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
authorPavel Shilovsky <piastry@etersoft.ru>2011-05-26 02:01:59 -0400
committerSteve French <sfrench@us.ibm.com>2011-05-26 14:07:02 -0400
commitfa2989f4473413a86890066aa3a5676a53b541e4 (patch)
treea033c59307ba77ae0819e818aec7d68178d11d4d /fs/cifs/inode.c
parentc28c89fc43e3f81436efc4748837534d4d46f90c (diff)
CIFS: Use pid saved from cifsFileInfo in writepages and set_file_size
We need it to make them work with mandatory locking style because we can fail in a situation like when kernel need to flush dirty pages and there is a lock held by a process who opened file. Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index de02ed5e25c2..5e278d37912b 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1873,6 +1873,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
1873 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); 1873 struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
1874 struct tcon_link *tlink = NULL; 1874 struct tcon_link *tlink = NULL;
1875 struct cifsTconInfo *pTcon = NULL; 1875 struct cifsTconInfo *pTcon = NULL;
1876 struct cifs_io_parms io_parms;
1876 1877
1877 /* 1878 /*
1878 * To avoid spurious oplock breaks from server, in the case of 1879 * To avoid spurious oplock breaks from server, in the case of
@@ -1894,8 +1895,14 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
1894 cFYI(1, "SetFSize for attrs rc = %d", rc); 1895 cFYI(1, "SetFSize for attrs rc = %d", rc);
1895 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { 1896 if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
1896 unsigned int bytes_written; 1897 unsigned int bytes_written;
1897 rc = CIFSSMBWrite(xid, pTcon, nfid, 0, attrs->ia_size, 1898
1898 &bytes_written, NULL, NULL, 1); 1899 io_parms.netfid = nfid;
1900 io_parms.pid = npid;
1901 io_parms.tcon = pTcon;
1902 io_parms.offset = 0;
1903 io_parms.length = attrs->ia_size;
1904 rc = CIFSSMBWrite(xid, &io_parms, &bytes_written,
1905 NULL, NULL, 1);
1899 cFYI(1, "Wrt seteof rc %d", rc); 1906 cFYI(1, "Wrt seteof rc %d", rc);
1900 } 1907 }
1901 } else 1908 } else
@@ -1930,10 +1937,15 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
1930 CIFS_MOUNT_MAP_SPECIAL_CHR); 1937 CIFS_MOUNT_MAP_SPECIAL_CHR);
1931 if (rc == 0) { 1938 if (rc == 0) {
1932 unsigned int bytes_written; 1939 unsigned int bytes_written;
1933 rc = CIFSSMBWrite(xid, pTcon, netfid, 0, 1940
1934 attrs->ia_size, 1941 io_parms.netfid = netfid;
1935 &bytes_written, NULL, 1942 io_parms.pid = current->tgid;
1936 NULL, 1); 1943 io_parms.tcon = pTcon;
1944 io_parms.offset = 0;
1945 io_parms.length = attrs->ia_size;
1946 rc = CIFSSMBWrite(xid, &io_parms,
1947 &bytes_written,
1948 NULL, NULL, 1);
1937 cFYI(1, "wrt seteof rc %d", rc); 1949 cFYI(1, "wrt seteof rc %d", rc);
1938 CIFSSMBClose(xid, pTcon, netfid); 1950 CIFSSMBClose(xid, pTcon, netfid);
1939 } 1951 }