diff options
-rw-r--r-- | fs/cifs/cifsproto.h | 24 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 359 | ||||
-rw-r--r-- | fs/cifs/connect.c | 26 |
3 files changed, 396 insertions, 13 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 8a7adb31ffed..c25d0636cc4f 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -154,6 +154,12 @@ extern struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *, struct inode *, | |||
154 | extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *, | 154 | extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *, |
155 | const char *, int); | 155 | const char *, int); |
156 | 156 | ||
157 | extern void dequeue_mid(struct mid_q_entry *mid, bool malformed); | ||
158 | extern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf, | ||
159 | unsigned int to_read); | ||
160 | extern int cifs_readv_from_socket(struct TCP_Server_Info *server, | ||
161 | struct kvec *iov_orig, unsigned int nr_segs, | ||
162 | unsigned int to_read); | ||
157 | extern void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, | 163 | extern void cifs_setup_cifs_sb(struct smb_vol *pvolume_info, |
158 | struct cifs_sb_info *cifs_sb); | 164 | struct cifs_sb_info *cifs_sb); |
159 | extern int cifs_match_super(struct super_block *, void *); | 165 | extern int cifs_match_super(struct super_block *, void *); |
@@ -443,6 +449,24 @@ extern int E_md4hash(const unsigned char *passwd, unsigned char *p16); | |||
443 | extern int SMBencrypt(unsigned char *passwd, const unsigned char *c8, | 449 | extern int SMBencrypt(unsigned char *passwd, const unsigned char *c8, |
444 | unsigned char *p24); | 450 | unsigned char *p24); |
445 | 451 | ||
452 | /* asynchronous read support */ | ||
453 | struct cifs_readdata { | ||
454 | struct cifsFileInfo *cfile; | ||
455 | struct address_space *mapping; | ||
456 | __u64 offset; | ||
457 | unsigned int bytes; | ||
458 | pid_t pid; | ||
459 | int result; | ||
460 | struct list_head pages; | ||
461 | struct work_struct work; | ||
462 | unsigned int nr_iov; | ||
463 | struct kvec iov[1]; | ||
464 | }; | ||
465 | |||
466 | struct cifs_readdata *cifs_readdata_alloc(unsigned int nr_pages); | ||
467 | void cifs_readdata_free(struct cifs_readdata *rdata); | ||
468 | int cifs_async_readv(struct cifs_readdata *rdata); | ||
469 | |||
446 | /* asynchronous write support */ | 470 | /* asynchronous write support */ |
447 | struct cifs_writedata { | 471 | struct cifs_writedata { |
448 | struct kref refcount; | 472 | struct kref refcount; |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 0613df4d8e74..aaad4ce6e6c5 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/posix_acl_xattr.h> | 34 | #include <linux/posix_acl_xattr.h> |
35 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
36 | #include <linux/swap.h> | ||
37 | #include <linux/task_io_accounting_ops.h> | ||
36 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
37 | #include "cifspdu.h" | 39 | #include "cifspdu.h" |
38 | #include "cifsglob.h" | 40 | #include "cifsglob.h" |
@@ -40,6 +42,7 @@ | |||
40 | #include "cifsproto.h" | 42 | #include "cifsproto.h" |
41 | #include "cifs_unicode.h" | 43 | #include "cifs_unicode.h" |
42 | #include "cifs_debug.h" | 44 | #include "cifs_debug.h" |
45 | #include "fscache.h" | ||
43 | 46 | ||
44 | #ifdef CONFIG_CIFS_POSIX | 47 | #ifdef CONFIG_CIFS_POSIX |
45 | static struct { | 48 | static struct { |
@@ -83,6 +86,9 @@ static struct { | |||
83 | #endif /* CONFIG_CIFS_WEAK_PW_HASH */ | 86 | #endif /* CONFIG_CIFS_WEAK_PW_HASH */ |
84 | #endif /* CIFS_POSIX */ | 87 | #endif /* CIFS_POSIX */ |
85 | 88 | ||
89 | /* Forward declarations */ | ||
90 | static void cifs_readv_complete(struct work_struct *work); | ||
91 | |||
86 | /* Mark as invalid, all open files on tree connections since they | 92 | /* Mark as invalid, all open files on tree connections since they |
87 | were closed when session to server was lost */ | 93 | were closed when session to server was lost */ |
88 | static void mark_open_files_invalid(struct cifs_tcon *pTcon) | 94 | static void mark_open_files_invalid(struct cifs_tcon *pTcon) |
@@ -1375,6 +1381,359 @@ openRetry: | |||
1375 | return rc; | 1381 | return rc; |
1376 | } | 1382 | } |
1377 | 1383 | ||
1384 | struct cifs_readdata * | ||
1385 | cifs_readdata_alloc(unsigned int nr_pages) | ||
1386 | { | ||
1387 | struct cifs_readdata *rdata; | ||
1388 | |||
1389 | /* readdata + 1 kvec for each page */ | ||
1390 | rdata = kzalloc(sizeof(*rdata) + | ||
1391 | sizeof(struct kvec) * nr_pages, GFP_KERNEL); | ||
1392 | if (rdata != NULL) { | ||
1393 | INIT_WORK(&rdata->work, cifs_readv_complete); | ||
1394 | INIT_LIST_HEAD(&rdata->pages); | ||
1395 | } | ||
1396 | return rdata; | ||
1397 | } | ||
1398 | |||
1399 | void | ||
1400 | cifs_readdata_free(struct cifs_readdata *rdata) | ||
1401 | { | ||
1402 | cifsFileInfo_put(rdata->cfile); | ||
1403 | kfree(rdata); | ||
1404 | } | ||
1405 | |||
1406 | /* | ||
1407 | * Discard any remaining data in the current SMB. To do this, we borrow the | ||
1408 | * current bigbuf. | ||
1409 | */ | ||
1410 | static int | ||
1411 | cifs_readv_discard(struct TCP_Server_Info *server, struct mid_q_entry *mid) | ||
1412 | { | ||
1413 | READ_RSP *rsp = (READ_RSP *)server->smallbuf; | ||
1414 | unsigned int rfclen = be32_to_cpu(rsp->hdr.smb_buf_length); | ||
1415 | int remaining = rfclen + 4 - server->total_read; | ||
1416 | struct cifs_readdata *rdata = mid->callback_data; | ||
1417 | |||
1418 | while (remaining > 0) { | ||
1419 | int length; | ||
1420 | |||
1421 | length = cifs_read_from_socket(server, server->bigbuf, | ||
1422 | min_t(unsigned int, remaining, | ||
1423 | CIFSMaxBufSize + MAX_CIFS_HDR_SIZE)); | ||
1424 | if (length < 0) | ||
1425 | return length; | ||
1426 | server->total_read += length; | ||
1427 | remaining -= length; | ||
1428 | } | ||
1429 | |||
1430 | dequeue_mid(mid, rdata->result); | ||
1431 | return 0; | ||
1432 | } | ||
1433 | |||
1434 | static int | ||
1435 | cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) | ||
1436 | { | ||
1437 | int length, len; | ||
1438 | unsigned int data_offset, remaining, data_len; | ||
1439 | struct cifs_readdata *rdata = mid->callback_data; | ||
1440 | READ_RSP *rsp = (READ_RSP *)server->smallbuf; | ||
1441 | unsigned int rfclen = be32_to_cpu(rsp->hdr.smb_buf_length) + 4; | ||
1442 | u64 eof; | ||
1443 | pgoff_t eof_index; | ||
1444 | struct page *page, *tpage; | ||
1445 | |||
1446 | cFYI(1, "%s: mid=%u offset=%llu bytes=%u", __func__, | ||
1447 | mid->mid, rdata->offset, rdata->bytes); | ||
1448 | |||
1449 | /* | ||
1450 | * read the rest of READ_RSP header (sans Data array), or whatever we | ||
1451 | * can if there's not enough data. At this point, we've read down to | ||
1452 | * the Mid. | ||
1453 | */ | ||
1454 | len = min_t(unsigned int, rfclen, sizeof(*rsp)) - | ||
1455 | sizeof(struct smb_hdr) + 1; | ||
1456 | |||
1457 | rdata->iov[0].iov_base = server->smallbuf + sizeof(struct smb_hdr) - 1; | ||
1458 | rdata->iov[0].iov_len = len; | ||
1459 | |||
1460 | length = cifs_readv_from_socket(server, rdata->iov, 1, len); | ||
1461 | if (length < 0) | ||
1462 | return length; | ||
1463 | server->total_read += length; | ||
1464 | |||
1465 | /* Was the SMB read successful? */ | ||
1466 | rdata->result = map_smb_to_linux_error(&rsp->hdr, false); | ||
1467 | if (rdata->result != 0) { | ||
1468 | cFYI(1, "%s: server returned error %d", __func__, | ||
1469 | rdata->result); | ||
1470 | return cifs_readv_discard(server, mid); | ||
1471 | } | ||
1472 | |||
1473 | /* Is there enough to get to the rest of the READ_RSP header? */ | ||
1474 | if (server->total_read < sizeof(READ_RSP)) { | ||
1475 | cFYI(1, "%s: server returned short header. got=%u expected=%zu", | ||
1476 | __func__, server->total_read, sizeof(READ_RSP)); | ||
1477 | rdata->result = -EIO; | ||
1478 | return cifs_readv_discard(server, mid); | ||
1479 | } | ||
1480 | |||
1481 | data_offset = le16_to_cpu(rsp->DataOffset) + 4; | ||
1482 | if (data_offset < server->total_read) { | ||
1483 | /* | ||
1484 | * win2k8 sometimes sends an offset of 0 when the read | ||
1485 | * is beyond the EOF. Treat it as if the data starts just after | ||
1486 | * the header. | ||
1487 | */ | ||
1488 | cFYI(1, "%s: data offset (%u) inside read response header", | ||
1489 | __func__, data_offset); | ||
1490 | data_offset = server->total_read; | ||
1491 | } else if (data_offset > MAX_CIFS_SMALL_BUFFER_SIZE) { | ||
1492 | /* data_offset is beyond the end of smallbuf */ | ||
1493 | cFYI(1, "%s: data offset (%u) beyond end of smallbuf", | ||
1494 | __func__, data_offset); | ||
1495 | rdata->result = -EIO; | ||
1496 | return cifs_readv_discard(server, mid); | ||
1497 | } | ||
1498 | |||
1499 | cFYI(1, "%s: total_read=%u data_offset=%u", __func__, | ||
1500 | server->total_read, data_offset); | ||
1501 | |||
1502 | len = data_offset - server->total_read; | ||
1503 | if (len > 0) { | ||
1504 | /* read any junk before data into the rest of smallbuf */ | ||
1505 | rdata->iov[0].iov_base = server->smallbuf + server->total_read; | ||
1506 | rdata->iov[0].iov_len = len; | ||
1507 | length = cifs_readv_from_socket(server, rdata->iov, 1, len); | ||
1508 | if (length < 0) | ||
1509 | return length; | ||
1510 | server->total_read += length; | ||
1511 | } | ||
1512 | |||
1513 | /* set up first iov for signature check */ | ||
1514 | rdata->iov[0].iov_base = server->smallbuf; | ||
1515 | rdata->iov[0].iov_len = server->total_read; | ||
1516 | cFYI(1, "0: iov_base=%p iov_len=%zu", | ||
1517 | rdata->iov[0].iov_base, rdata->iov[0].iov_len); | ||
1518 | |||
1519 | /* how much data is in the response? */ | ||
1520 | data_len = le16_to_cpu(rsp->DataLengthHigh) << 16; | ||
1521 | data_len += le16_to_cpu(rsp->DataLength); | ||
1522 | if (data_offset + data_len > rfclen) { | ||
1523 | /* data_len is corrupt -- discard frame */ | ||
1524 | rdata->result = -EIO; | ||
1525 | return cifs_readv_discard(server, mid); | ||
1526 | } | ||
1527 | |||
1528 | /* marshal up the page array */ | ||
1529 | len = 0; | ||
1530 | remaining = data_len; | ||
1531 | rdata->nr_iov = 1; | ||
1532 | |||
1533 | /* determine the eof that the server (probably) has */ | ||
1534 | eof = CIFS_I(rdata->mapping->host)->server_eof; | ||
1535 | eof_index = eof ? (eof - 1) >> PAGE_CACHE_SHIFT : 0; | ||
1536 | cFYI(1, "eof=%llu eof_index=%lu", eof, eof_index); | ||
1537 | |||
1538 | list_for_each_entry_safe(page, tpage, &rdata->pages, lru) { | ||
1539 | if (remaining >= PAGE_CACHE_SIZE) { | ||
1540 | /* enough data to fill the page */ | ||
1541 | rdata->iov[rdata->nr_iov].iov_base = kmap(page); | ||
1542 | rdata->iov[rdata->nr_iov].iov_len = PAGE_CACHE_SIZE; | ||
1543 | cFYI(1, "%u: idx=%lu iov_base=%p iov_len=%zu", | ||
1544 | rdata->nr_iov, page->index, | ||
1545 | rdata->iov[rdata->nr_iov].iov_base, | ||
1546 | rdata->iov[rdata->nr_iov].iov_len); | ||
1547 | ++rdata->nr_iov; | ||
1548 | len += PAGE_CACHE_SIZE; | ||
1549 | remaining -= PAGE_CACHE_SIZE; | ||
1550 | } else if (remaining > 0) { | ||
1551 | /* enough for partial page, fill and zero the rest */ | ||
1552 | rdata->iov[rdata->nr_iov].iov_base = kmap(page); | ||
1553 | rdata->iov[rdata->nr_iov].iov_len = remaining; | ||
1554 | cFYI(1, "%u: idx=%lu iov_base=%p iov_len=%zu", | ||
1555 | rdata->nr_iov, page->index, | ||
1556 | rdata->iov[rdata->nr_iov].iov_base, | ||
1557 | rdata->iov[rdata->nr_iov].iov_len); | ||
1558 | memset(rdata->iov[rdata->nr_iov].iov_base + remaining, | ||
1559 | '\0', PAGE_CACHE_SIZE - remaining); | ||
1560 | ++rdata->nr_iov; | ||
1561 | len += remaining; | ||
1562 | remaining = 0; | ||
1563 | } else if (page->index > eof_index) { | ||
1564 | /* | ||
1565 | * The VFS will not try to do readahead past the | ||
1566 | * i_size, but it's possible that we have outstanding | ||
1567 | * writes with gaps in the middle and the i_size hasn't | ||
1568 | * caught up yet. Populate those with zeroed out pages | ||
1569 | * to prevent the VFS from repeatedly attempting to | ||
1570 | * fill them until the writes are flushed. | ||
1571 | */ | ||
1572 | zero_user(page, 0, PAGE_CACHE_SIZE); | ||
1573 | list_del(&page->lru); | ||
1574 | lru_cache_add_file(page); | ||
1575 | flush_dcache_page(page); | ||
1576 | SetPageUptodate(page); | ||
1577 | unlock_page(page); | ||
1578 | page_cache_release(page); | ||
1579 | } else { | ||
1580 | /* no need to hold page hostage */ | ||
1581 | list_del(&page->lru); | ||
1582 | lru_cache_add_file(page); | ||
1583 | unlock_page(page); | ||
1584 | page_cache_release(page); | ||
1585 | } | ||
1586 | } | ||
1587 | |||
1588 | /* issue the read if we have any iovecs left to fill */ | ||
1589 | if (rdata->nr_iov > 1) { | ||
1590 | length = cifs_readv_from_socket(server, &rdata->iov[1], | ||
1591 | rdata->nr_iov - 1, len); | ||
1592 | if (length < 0) | ||
1593 | return length; | ||
1594 | server->total_read += length; | ||
1595 | } else { | ||
1596 | length = 0; | ||
1597 | } | ||
1598 | |||
1599 | rdata->bytes = length; | ||
1600 | |||
1601 | cFYI(1, "total_read=%u rfclen=%u remaining=%u", server->total_read, | ||
1602 | rfclen, remaining); | ||
1603 | |||
1604 | /* discard anything left over */ | ||
1605 | if (server->total_read < rfclen) | ||
1606 | return cifs_readv_discard(server, mid); | ||
1607 | |||
1608 | dequeue_mid(mid, false); | ||
1609 | return length; | ||
1610 | } | ||
1611 | |||
1612 | static void | ||
1613 | cifs_readv_complete(struct work_struct *work) | ||
1614 | { | ||
1615 | struct cifs_readdata *rdata = container_of(work, | ||
1616 | struct cifs_readdata, work); | ||
1617 | struct page *page, *tpage; | ||
1618 | |||
1619 | list_for_each_entry_safe(page, tpage, &rdata->pages, lru) { | ||
1620 | list_del(&page->lru); | ||
1621 | lru_cache_add_file(page); | ||
1622 | kunmap(page); | ||
1623 | |||
1624 | if (rdata->result == 0) { | ||
1625 | flush_dcache_page(page); | ||
1626 | SetPageUptodate(page); | ||
1627 | } | ||
1628 | |||
1629 | unlock_page(page); | ||
1630 | |||
1631 | if (rdata->result == 0) | ||
1632 | cifs_readpage_to_fscache(rdata->mapping->host, page); | ||
1633 | |||
1634 | page_cache_release(page); | ||
1635 | } | ||
1636 | cifs_readdata_free(rdata); | ||
1637 | } | ||
1638 | |||
1639 | static void | ||
1640 | cifs_readv_callback(struct mid_q_entry *mid) | ||
1641 | { | ||
1642 | struct cifs_readdata *rdata = mid->callback_data; | ||
1643 | struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink); | ||
1644 | struct TCP_Server_Info *server = tcon->ses->server; | ||
1645 | |||
1646 | cFYI(1, "%s: mid=%u state=%d result=%d bytes=%u", __func__, | ||
1647 | mid->mid, mid->midState, rdata->result, rdata->bytes); | ||
1648 | |||
1649 | switch (mid->midState) { | ||
1650 | case MID_RESPONSE_RECEIVED: | ||
1651 | /* result already set, check signature */ | ||
1652 | if (server->sec_mode & | ||
1653 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) { | ||
1654 | if (cifs_verify_signature(rdata->iov, rdata->nr_iov, | ||
1655 | server, mid->sequence_number + 1)) | ||
1656 | cERROR(1, "Unexpected SMB signature"); | ||
1657 | } | ||
1658 | /* FIXME: should this be counted toward the initiating task? */ | ||
1659 | task_io_account_read(rdata->bytes); | ||
1660 | cifs_stats_bytes_read(tcon, rdata->bytes); | ||
1661 | break; | ||
1662 | case MID_REQUEST_SUBMITTED: | ||
1663 | case MID_RETRY_NEEDED: | ||
1664 | rdata->result = -EAGAIN; | ||
1665 | break; | ||
1666 | default: | ||
1667 | rdata->result = -EIO; | ||
1668 | } | ||
1669 | |||
1670 | queue_work(system_nrt_wq, &rdata->work); | ||
1671 | DeleteMidQEntry(mid); | ||
1672 | atomic_dec(&server->inFlight); | ||
1673 | wake_up(&server->request_q); | ||
1674 | } | ||
1675 | |||
1676 | /* cifs_async_readv - send an async write, and set up mid to handle result */ | ||
1677 | int | ||
1678 | cifs_async_readv(struct cifs_readdata *rdata) | ||
1679 | { | ||
1680 | int rc; | ||
1681 | READ_REQ *smb = NULL; | ||
1682 | int wct; | ||
1683 | struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink); | ||
1684 | |||
1685 | cFYI(1, "%s: offset=%llu bytes=%u", __func__, | ||
1686 | rdata->offset, rdata->bytes); | ||
1687 | |||
1688 | if (tcon->ses->capabilities & CAP_LARGE_FILES) | ||
1689 | wct = 12; | ||
1690 | else { | ||
1691 | wct = 10; /* old style read */ | ||
1692 | if ((rdata->offset >> 32) > 0) { | ||
1693 | /* can not handle this big offset for old */ | ||
1694 | return -EIO; | ||
1695 | } | ||
1696 | } | ||
1697 | |||
1698 | rc = small_smb_init(SMB_COM_READ_ANDX, wct, tcon, (void **)&smb); | ||
1699 | if (rc) | ||
1700 | return rc; | ||
1701 | |||
1702 | smb->hdr.Pid = cpu_to_le16((__u16)rdata->pid); | ||
1703 | smb->hdr.PidHigh = cpu_to_le16((__u16)(rdata->pid >> 16)); | ||
1704 | |||
1705 | smb->AndXCommand = 0xFF; /* none */ | ||
1706 | smb->Fid = rdata->cfile->netfid; | ||
1707 | smb->OffsetLow = cpu_to_le32(rdata->offset & 0xFFFFFFFF); | ||
1708 | if (wct == 12) | ||
1709 | smb->OffsetHigh = cpu_to_le32(rdata->offset >> 32); | ||
1710 | smb->Remaining = 0; | ||
1711 | smb->MaxCount = cpu_to_le16(rdata->bytes & 0xFFFF); | ||
1712 | smb->MaxCountHigh = cpu_to_le32(rdata->bytes >> 16); | ||
1713 | if (wct == 12) | ||
1714 | smb->ByteCount = 0; | ||
1715 | else { | ||
1716 | /* old style read */ | ||
1717 | struct smb_com_readx_req *smbr = | ||
1718 | (struct smb_com_readx_req *)smb; | ||
1719 | smbr->ByteCount = 0; | ||
1720 | } | ||
1721 | |||
1722 | /* 4 for RFC1001 length + 1 for BCC */ | ||
1723 | rdata->iov[0].iov_base = smb; | ||
1724 | rdata->iov[0].iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4; | ||
1725 | |||
1726 | rc = cifs_call_async(tcon->ses->server, rdata->iov, 1, | ||
1727 | cifs_readv_receive, cifs_readv_callback, | ||
1728 | rdata, false); | ||
1729 | |||
1730 | if (rc == 0) | ||
1731 | cifs_stats_inc(&tcon->num_reads); | ||
1732 | |||
1733 | cifs_small_buf_release(smb); | ||
1734 | return rc; | ||
1735 | } | ||
1736 | |||
1378 | int | 1737 | int |
1379 | CIFSSMBRead(const int xid, struct cifs_io_parms *io_parms, unsigned int *nbytes, | 1738 | CIFSSMBRead(const int xid, struct cifs_io_parms *io_parms, unsigned int *nbytes, |
1380 | char **buf, int *pbuf_type) | 1739 | char **buf, int *pbuf_type) |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index eeee2f5d13ce..3d518b9e8c18 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -422,9 +422,9 @@ get_server_iovec(struct TCP_Server_Info *server, unsigned int nr_segs) | |||
422 | return new_iov; | 422 | return new_iov; |
423 | } | 423 | } |
424 | 424 | ||
425 | static int | 425 | int |
426 | readv_from_socket(struct TCP_Server_Info *server, struct kvec *iov_orig, | 426 | cifs_readv_from_socket(struct TCP_Server_Info *server, struct kvec *iov_orig, |
427 | unsigned int nr_segs, unsigned int to_read) | 427 | unsigned int nr_segs, unsigned int to_read) |
428 | { | 428 | { |
429 | int length = 0; | 429 | int length = 0; |
430 | int total_read; | 430 | int total_read; |
@@ -479,16 +479,16 @@ readv_from_socket(struct TCP_Server_Info *server, struct kvec *iov_orig, | |||
479 | return total_read; | 479 | return total_read; |
480 | } | 480 | } |
481 | 481 | ||
482 | static int | 482 | int |
483 | read_from_socket(struct TCP_Server_Info *server, char *buf, | 483 | cifs_read_from_socket(struct TCP_Server_Info *server, char *buf, |
484 | unsigned int to_read) | 484 | unsigned int to_read) |
485 | { | 485 | { |
486 | struct kvec iov; | 486 | struct kvec iov; |
487 | 487 | ||
488 | iov.iov_base = buf; | 488 | iov.iov_base = buf; |
489 | iov.iov_len = to_read; | 489 | iov.iov_len = to_read; |
490 | 490 | ||
491 | return readv_from_socket(server, &iov, 1, to_read); | 491 | return cifs_readv_from_socket(server, &iov, 1, to_read); |
492 | } | 492 | } |
493 | 493 | ||
494 | static bool | 494 | static bool |
@@ -553,8 +553,8 @@ find_mid(struct TCP_Server_Info *server, struct smb_hdr *buf) | |||
553 | return NULL; | 553 | return NULL; |
554 | } | 554 | } |
555 | 555 | ||
556 | static void | 556 | void |
557 | dequeue_mid(struct mid_q_entry *mid, int malformed) | 557 | dequeue_mid(struct mid_q_entry *mid, bool malformed) |
558 | { | 558 | { |
559 | #ifdef CONFIG_CIFS_STATS2 | 559 | #ifdef CONFIG_CIFS_STATS2 |
560 | mid->when_received = jiffies; | 560 | mid->when_received = jiffies; |
@@ -730,7 +730,7 @@ standard_receive3(struct TCP_Server_Info *server, struct mid_q_entry *mid) | |||
730 | } | 730 | } |
731 | 731 | ||
732 | /* now read the rest */ | 732 | /* now read the rest */ |
733 | length = read_from_socket(server, | 733 | length = cifs_read_from_socket(server, |
734 | buf + sizeof(struct smb_hdr) - 1, | 734 | buf + sizeof(struct smb_hdr) - 1, |
735 | pdu_length - sizeof(struct smb_hdr) + 1 + 4); | 735 | pdu_length - sizeof(struct smb_hdr) + 1 + 4); |
736 | if (length < 0) | 736 | if (length < 0) |
@@ -791,7 +791,7 @@ cifs_demultiplex_thread(void *p) | |||
791 | buf = server->smallbuf; | 791 | buf = server->smallbuf; |
792 | pdu_length = 4; /* enough to get RFC1001 header */ | 792 | pdu_length = 4; /* enough to get RFC1001 header */ |
793 | 793 | ||
794 | length = read_from_socket(server, buf, pdu_length); | 794 | length = cifs_read_from_socket(server, buf, pdu_length); |
795 | if (length < 0) | 795 | if (length < 0) |
796 | continue; | 796 | continue; |
797 | server->total_read = length; | 797 | server->total_read = length; |
@@ -816,8 +816,8 @@ cifs_demultiplex_thread(void *p) | |||
816 | } | 816 | } |
817 | 817 | ||
818 | /* read down to the MID */ | 818 | /* read down to the MID */ |
819 | length = read_from_socket(server, buf + 4, | 819 | length = cifs_read_from_socket(server, buf + 4, |
820 | sizeof(struct smb_hdr) - 1 - 4); | 820 | sizeof(struct smb_hdr) - 1 - 4); |
821 | if (length < 0) | 821 | if (length < 0) |
822 | continue; | 822 | continue; |
823 | server->total_read += length; | 823 | server->total_read += length; |