aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c58
1 files changed, 32 insertions, 26 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 14a1c72ced92..c249b628fd1c 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -555,13 +555,13 @@ int cifs_closedir(struct inode *inode, struct file *file)
555 } 555 }
556 ptmp = pCFileStruct->srch_inf.ntwrk_buf_start; 556 ptmp = pCFileStruct->srch_inf.ntwrk_buf_start;
557 if (ptmp) { 557 if (ptmp) {
558 /* BB removeme BB */ cFYI(1, ("freeing smb buf in srch struct in closedir")); 558 cFYI(1, ("closedir free smb buf in srch struct"));
559 pCFileStruct->srch_inf.ntwrk_buf_start = NULL; 559 pCFileStruct->srch_inf.ntwrk_buf_start = NULL;
560 cifs_buf_release(ptmp); 560 cifs_buf_release(ptmp);
561 } 561 }
562 ptmp = pCFileStruct->search_resume_name; 562 ptmp = pCFileStruct->search_resume_name;
563 if (ptmp) { 563 if (ptmp) {
564 /* BB removeme BB */ cFYI(1, ("freeing resume name in closedir")); 564 cFYI(1, ("closedir free resume name"));
565 pCFileStruct->search_resume_name = NULL; 565 pCFileStruct->search_resume_name = NULL;
566 kfree(ptmp); 566 kfree(ptmp);
567 } 567 }
@@ -870,10 +870,9 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
870 if (rc != 0) 870 if (rc != 0)
871 break; 871 break;
872 } 872 }
873#ifdef CONFIG_CIFS_EXPERIMENTAL
874 /* BB FIXME We can not sign across two buffers yet */ 873 /* BB FIXME We can not sign across two buffers yet */
875 if((experimEnabled) && ((pTcon->ses->server->secMode & 874 if((pTcon->ses->server->secMode &
876 (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) == 0)) { 875 (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) == 0) {
877 struct kvec iov[2]; 876 struct kvec iov[2];
878 unsigned int len; 877 unsigned int len;
879 878
@@ -889,7 +888,6 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
889 iov, 1, long_op); 888 iov, 1, long_op);
890 } else 889 } else
891 /* BB FIXME fixup indentation of line below */ 890 /* BB FIXME fixup indentation of line below */
892#endif
893 rc = CIFSSMBWrite(xid, pTcon, 891 rc = CIFSSMBWrite(xid, pTcon,
894 open_file->netfid, 892 open_file->netfid,
895 min_t(const int, cifs_sb->wsize, 893 min_t(const int, cifs_sb->wsize,
@@ -1026,7 +1024,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
1026 return rc; 1024 return rc;
1027} 1025}
1028 1026
1029#ifdef CONFIG_CIFS_EXPERIMENTAL
1030static int cifs_writepages(struct address_space *mapping, 1027static int cifs_writepages(struct address_space *mapping,
1031 struct writeback_control *wbc) 1028 struct writeback_control *wbc)
1032{ 1029{
@@ -1229,7 +1226,6 @@ retry:
1229 1226
1230 return rc; 1227 return rc;
1231} 1228}
1232#endif
1233 1229
1234static int cifs_writepage(struct page* page, struct writeback_control *wbc) 1230static int cifs_writepage(struct page* page, struct writeback_control *wbc)
1235{ 1231{
@@ -1428,6 +1424,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
1428 rc = -EAGAIN; 1424 rc = -EAGAIN;
1429 smb_read_data = NULL; 1425 smb_read_data = NULL;
1430 while (rc == -EAGAIN) { 1426 while (rc == -EAGAIN) {
1427 int buf_type = CIFS_NO_BUFFER;
1431 if ((open_file->invalidHandle) && 1428 if ((open_file->invalidHandle) &&
1432 (!open_file->closePend)) { 1429 (!open_file->closePend)) {
1433 rc = cifs_reopen_file(file->f_dentry->d_inode, 1430 rc = cifs_reopen_file(file->f_dentry->d_inode,
@@ -1436,20 +1433,22 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
1436 break; 1433 break;
1437 } 1434 }
1438 rc = CIFSSMBRead(xid, pTcon, 1435 rc = CIFSSMBRead(xid, pTcon,
1439 open_file->netfid, 1436 open_file->netfid,
1440 current_read_size, *poffset, 1437 current_read_size, *poffset,
1441 &bytes_read, &smb_read_data); 1438 &bytes_read, &smb_read_data,
1439 &buf_type);
1442 pSMBr = (struct smb_com_read_rsp *)smb_read_data; 1440 pSMBr = (struct smb_com_read_rsp *)smb_read_data;
1443 if (copy_to_user(current_offset, 1441 if (copy_to_user(current_offset,
1444 smb_read_data + 4 /* RFC1001 hdr */ 1442 smb_read_data + 4 /* RFC1001 hdr */
1445 + le16_to_cpu(pSMBr->DataOffset), 1443 + le16_to_cpu(pSMBr->DataOffset),
1446 bytes_read)) { 1444 bytes_read)) {
1447 rc = -EFAULT; 1445 rc = -EFAULT;
1448 FreeXid(xid); 1446 }
1449 return rc;
1450 }
1451 if (smb_read_data) { 1447 if (smb_read_data) {
1452 cifs_buf_release(smb_read_data); 1448 if(buf_type == CIFS_SMALL_BUFFER)
1449 cifs_small_buf_release(smb_read_data);
1450 else if(buf_type == CIFS_LARGE_BUFFER)
1451 cifs_buf_release(smb_read_data);
1453 smb_read_data = NULL; 1452 smb_read_data = NULL;
1454 } 1453 }
1455 } 1454 }
@@ -1482,6 +1481,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1482 int xid; 1481 int xid;
1483 char *current_offset; 1482 char *current_offset;
1484 struct cifsFileInfo *open_file; 1483 struct cifsFileInfo *open_file;
1484 int buf_type = CIFS_NO_BUFFER;
1485 1485
1486 xid = GetXid(); 1486 xid = GetXid();
1487 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 1487 cifs_sb = CIFS_SB(file->f_dentry->d_sb);
@@ -1518,9 +1518,10 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1518 break; 1518 break;
1519 } 1519 }
1520 rc = CIFSSMBRead(xid, pTcon, 1520 rc = CIFSSMBRead(xid, pTcon,
1521 open_file->netfid, 1521 open_file->netfid,
1522 current_read_size, *poffset, 1522 current_read_size, *poffset,
1523 &bytes_read, &current_offset); 1523 &bytes_read, &current_offset,
1524 &buf_type);
1524 } 1525 }
1525 if (rc || (bytes_read == 0)) { 1526 if (rc || (bytes_read == 0)) {
1526 if (total_read) { 1527 if (total_read) {
@@ -1618,6 +1619,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1618 struct smb_com_read_rsp *pSMBr; 1619 struct smb_com_read_rsp *pSMBr;
1619 struct pagevec lru_pvec; 1620 struct pagevec lru_pvec;
1620 struct cifsFileInfo *open_file; 1621 struct cifsFileInfo *open_file;
1622 int buf_type = CIFS_NO_BUFFER;
1621 1623
1622 xid = GetXid(); 1624 xid = GetXid();
1623 if (file->private_data == NULL) { 1625 if (file->private_data == NULL) {
@@ -1674,14 +1676,17 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1674 } 1676 }
1675 1677
1676 rc = CIFSSMBRead(xid, pTcon, 1678 rc = CIFSSMBRead(xid, pTcon,
1677 open_file->netfid, 1679 open_file->netfid,
1678 read_size, offset, 1680 read_size, offset,
1679 &bytes_read, &smb_read_data); 1681 &bytes_read, &smb_read_data,
1680 1682 &buf_type);
1681 /* BB more RC checks ? */ 1683 /* BB more RC checks ? */
1682 if (rc== -EAGAIN) { 1684 if (rc== -EAGAIN) {
1683 if (smb_read_data) { 1685 if (smb_read_data) {
1684 cifs_buf_release(smb_read_data); 1686 if(buf_type == CIFS_SMALL_BUFFER)
1687 cifs_small_buf_release(smb_read_data);
1688 else if(buf_type == CIFS_LARGE_BUFFER)
1689 cifs_buf_release(smb_read_data);
1685 smb_read_data = NULL; 1690 smb_read_data = NULL;
1686 } 1691 }
1687 } 1692 }
@@ -1738,7 +1743,10 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1738 break; 1743 break;
1739 } 1744 }
1740 if (smb_read_data) { 1745 if (smb_read_data) {
1741 cifs_buf_release(smb_read_data); 1746 if(buf_type == CIFS_SMALL_BUFFER)
1747 cifs_small_buf_release(smb_read_data);
1748 else if(buf_type == CIFS_LARGE_BUFFER)
1749 cifs_buf_release(smb_read_data);
1742 smb_read_data = NULL; 1750 smb_read_data = NULL;
1743 } 1751 }
1744 bytes_read = 0; 1752 bytes_read = 0;
@@ -1875,9 +1883,7 @@ struct address_space_operations cifs_addr_ops = {
1875 .readpage = cifs_readpage, 1883 .readpage = cifs_readpage,
1876 .readpages = cifs_readpages, 1884 .readpages = cifs_readpages,
1877 .writepage = cifs_writepage, 1885 .writepage = cifs_writepage,
1878#ifdef CONFIG_CIFS_EXPERIMENTAL
1879 .writepages = cifs_writepages, 1886 .writepages = cifs_writepages,
1880#endif
1881 .prepare_write = cifs_prepare_write, 1887 .prepare_write = cifs_prepare_write,
1882 .commit_write = cifs_commit_write, 1888 .commit_write = cifs_commit_write,
1883 .set_page_dirty = __set_page_dirty_nobuffers, 1889 .set_page_dirty = __set_page_dirty_nobuffers,