aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2009-04-01 09:22:10 -0400
committerBenny Halevy <bhalevy@panasas.com>2009-06-17 13:46:35 -0400
commit66cc042970f7077c66be65a780eb3a60a9bcbf0b (patch)
treec0d9e00611ac207f845679729538d00e44119b59 /fs/nfs/nfs4xdr.c
parent28f566942c6b1d929f5e240e69e7081b77b238d3 (diff)
nfs41: encode minorversion in compound header
Signed-off-by: Andy Adamdon <andros@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com> [nfs41: pass *session in seq_args and seq_res] Signed-off-by: Benny Halevy <bhalevy@panasas.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c70
1 files changed, 40 insertions, 30 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 68889469d114..19ca0b519a1d 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -546,6 +546,7 @@ struct compound_hdr {
546 uint32_t taglen; 546 uint32_t taglen;
547 char * tag; 547 char * tag;
548 uint32_t replen; /* expected reply words */ 548 uint32_t replen; /* expected reply words */
549 u32 minorversion;
549}; 550};
550 551
551/* 552/*
@@ -598,7 +599,7 @@ static void encode_compound_hdr(struct xdr_stream *xdr,
598 RESERVE_SPACE(12+(XDR_QUADLEN(hdr->taglen)<<2)); 599 RESERVE_SPACE(12+(XDR_QUADLEN(hdr->taglen)<<2));
599 WRITE32(hdr->taglen); 600 WRITE32(hdr->taglen);
600 WRITEMEM(hdr->tag, hdr->taglen); 601 WRITEMEM(hdr->tag, hdr->taglen);
601 WRITE32(NFS4_MINOR_VERSION); 602 WRITE32(hdr->minorversion);
602 hdr->nops_p = p; 603 hdr->nops_p = p;
603 WRITE32(hdr->nops); 604 WRITE32(hdr->nops);
604} 605}
@@ -1388,6 +1389,15 @@ static void encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *state
1388 * END OF "GENERIC" ENCODE ROUTINES. 1389 * END OF "GENERIC" ENCODE ROUTINES.
1389 */ 1390 */
1390 1391
1392static u32 nfs4_xdr_minorversion(const struct nfs4_sequence_args *args)
1393{
1394#if defined(CONFIG_NFS_V4_1)
1395 if (args->sa_session)
1396 return args->sa_session->clp->cl_minorversion;
1397#endif /* CONFIG_NFS_V4_1 */
1398 return 0;
1399}
1400
1391/* 1401/*
1392 * Encode an ACCESS request 1402 * Encode an ACCESS request
1393 */ 1403 */
@@ -1395,7 +1405,7 @@ static int nfs4_xdr_enc_access(struct rpc_rqst *req, __be32 *p, const struct nfs
1395{ 1405{
1396 struct xdr_stream xdr; 1406 struct xdr_stream xdr;
1397 struct compound_hdr hdr = { 1407 struct compound_hdr hdr = {
1398 .nops = 0, 1408 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1399 }; 1409 };
1400 1410
1401 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1411 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1414,7 +1424,7 @@ static int nfs4_xdr_enc_lookup(struct rpc_rqst *req, __be32 *p, const struct nfs
1414{ 1424{
1415 struct xdr_stream xdr; 1425 struct xdr_stream xdr;
1416 struct compound_hdr hdr = { 1426 struct compound_hdr hdr = {
1417 .nops = 0, 1427 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1418 }; 1428 };
1419 1429
1420 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1430 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1434,7 +1444,7 @@ static int nfs4_xdr_enc_lookup_root(struct rpc_rqst *req, __be32 *p, const struc
1434{ 1444{
1435 struct xdr_stream xdr; 1445 struct xdr_stream xdr;
1436 struct compound_hdr hdr = { 1446 struct compound_hdr hdr = {
1437 .nops = 0, 1447 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1438 }; 1448 };
1439 1449
1440 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1450 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1453,7 +1463,7 @@ static int nfs4_xdr_enc_remove(struct rpc_rqst *req, __be32 *p, const struct nfs
1453{ 1463{
1454 struct xdr_stream xdr; 1464 struct xdr_stream xdr;
1455 struct compound_hdr hdr = { 1465 struct compound_hdr hdr = {
1456 .nops = 0, 1466 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1457 }; 1467 };
1458 1468
1459 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1469 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1472,7 +1482,7 @@ static int nfs4_xdr_enc_rename(struct rpc_rqst *req, __be32 *p, const struct nfs
1472{ 1482{
1473 struct xdr_stream xdr; 1483 struct xdr_stream xdr;
1474 struct compound_hdr hdr = { 1484 struct compound_hdr hdr = {
1475 .nops = 0, 1485 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1476 }; 1486 };
1477 1487
1478 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1488 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1495,7 +1505,7 @@ static int nfs4_xdr_enc_link(struct rpc_rqst *req, __be32 *p, const struct nfs4_
1495{ 1505{
1496 struct xdr_stream xdr; 1506 struct xdr_stream xdr;
1497 struct compound_hdr hdr = { 1507 struct compound_hdr hdr = {
1498 .nops = 0, 1508 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1499 }; 1509 };
1500 1510
1501 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1511 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1518,7 +1528,7 @@ static int nfs4_xdr_enc_create(struct rpc_rqst *req, __be32 *p, const struct nfs
1518{ 1528{
1519 struct xdr_stream xdr; 1529 struct xdr_stream xdr;
1520 struct compound_hdr hdr = { 1530 struct compound_hdr hdr = {
1521 .nops = 0, 1531 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1522 }; 1532 };
1523 1533
1524 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1534 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1549,7 +1559,7 @@ static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, __be32 *p, const struct nf
1549{ 1559{
1550 struct xdr_stream xdr; 1560 struct xdr_stream xdr;
1551 struct compound_hdr hdr = { 1561 struct compound_hdr hdr = {
1552 .nops = 0, 1562 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1553 }; 1563 };
1554 1564
1555 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1565 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1567,7 +1577,7 @@ static int nfs4_xdr_enc_close(struct rpc_rqst *req, __be32 *p, struct nfs_closea
1567{ 1577{
1568 struct xdr_stream xdr; 1578 struct xdr_stream xdr;
1569 struct compound_hdr hdr = { 1579 struct compound_hdr hdr = {
1570 .nops = 0, 1580 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1571 }; 1581 };
1572 1582
1573 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1583 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1586,7 +1596,7 @@ static int nfs4_xdr_enc_open(struct rpc_rqst *req, __be32 *p, struct nfs_openarg
1586{ 1596{
1587 struct xdr_stream xdr; 1597 struct xdr_stream xdr;
1588 struct compound_hdr hdr = { 1598 struct compound_hdr hdr = {
1589 .nops = 0, 1599 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1590 }; 1600 };
1591 1601
1592 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1602 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1627,7 +1637,7 @@ static int nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, __be32 *p, struct nfs_
1627{ 1637{
1628 struct xdr_stream xdr; 1638 struct xdr_stream xdr;
1629 struct compound_hdr hdr = { 1639 struct compound_hdr hdr = {
1630 .nops = 0, 1640 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1631 }; 1641 };
1632 1642
1633 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1643 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1646,7 +1656,7 @@ static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, __be32 *p, struct n
1646{ 1656{
1647 struct xdr_stream xdr; 1657 struct xdr_stream xdr;
1648 struct compound_hdr hdr = { 1658 struct compound_hdr hdr = {
1649 .nops = 0, 1659 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1650 }; 1660 };
1651 1661
1652 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1662 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1665,7 +1675,7 @@ static int nfs4_xdr_enc_lock(struct rpc_rqst *req, __be32 *p, struct nfs_lock_ar
1665{ 1675{
1666 struct xdr_stream xdr; 1676 struct xdr_stream xdr;
1667 struct compound_hdr hdr = { 1677 struct compound_hdr hdr = {
1668 .nops = 0, 1678 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1669 }; 1679 };
1670 1680
1671 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1681 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1683,7 +1693,7 @@ static int nfs4_xdr_enc_lockt(struct rpc_rqst *req, __be32 *p, struct nfs_lockt_
1683{ 1693{
1684 struct xdr_stream xdr; 1694 struct xdr_stream xdr;
1685 struct compound_hdr hdr = { 1695 struct compound_hdr hdr = {
1686 .nops = 0, 1696 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1687 }; 1697 };
1688 1698
1689 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1699 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1701,7 +1711,7 @@ static int nfs4_xdr_enc_locku(struct rpc_rqst *req, __be32 *p, struct nfs_locku_
1701{ 1711{
1702 struct xdr_stream xdr; 1712 struct xdr_stream xdr;
1703 struct compound_hdr hdr = { 1713 struct compound_hdr hdr = {
1704 .nops = 0, 1714 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1705 }; 1715 };
1706 1716
1707 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1717 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1719,7 +1729,7 @@ static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct n
1719{ 1729{
1720 struct xdr_stream xdr; 1730 struct xdr_stream xdr;
1721 struct compound_hdr hdr = { 1731 struct compound_hdr hdr = {
1722 .nops = 0, 1732 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1723 }; 1733 };
1724 1734
1725 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1735 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1740,7 +1750,7 @@ static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nf
1740{ 1750{
1741 struct xdr_stream xdr; 1751 struct xdr_stream xdr;
1742 struct compound_hdr hdr = { 1752 struct compound_hdr hdr = {
1743 .nops = 0, 1753 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1744 }; 1754 };
1745 1755
1746 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1756 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1764,7 +1774,7 @@ static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readarg
1764{ 1774{
1765 struct xdr_stream xdr; 1775 struct xdr_stream xdr;
1766 struct compound_hdr hdr = { 1776 struct compound_hdr hdr = {
1767 .nops = 0, 1777 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1768 }; 1778 };
1769 1779
1770 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1780 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1786,7 +1796,7 @@ static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, __be32 *p, struct nfs_seta
1786{ 1796{
1787 struct xdr_stream xdr; 1797 struct xdr_stream xdr;
1788 struct compound_hdr hdr = { 1798 struct compound_hdr hdr = {
1789 .nops = 0, 1799 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1790 }; 1800 };
1791 1801
1792 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1802 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1807,7 +1817,7 @@ nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p,
1807{ 1817{
1808 struct xdr_stream xdr; 1818 struct xdr_stream xdr;
1809 struct compound_hdr hdr = { 1819 struct compound_hdr hdr = {
1810 .nops = 0, 1820 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1811 }; 1821 };
1812 uint32_t replen; 1822 uint32_t replen;
1813 1823
@@ -1830,7 +1840,7 @@ static int nfs4_xdr_enc_write(struct rpc_rqst *req, __be32 *p, struct nfs_writea
1830{ 1840{
1831 struct xdr_stream xdr; 1841 struct xdr_stream xdr;
1832 struct compound_hdr hdr = { 1842 struct compound_hdr hdr = {
1833 .nops = 0, 1843 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1834 }; 1844 };
1835 1845
1836 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1846 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1850,7 +1860,7 @@ static int nfs4_xdr_enc_commit(struct rpc_rqst *req, __be32 *p, struct nfs_write
1850{ 1860{
1851 struct xdr_stream xdr; 1861 struct xdr_stream xdr;
1852 struct compound_hdr hdr = { 1862 struct compound_hdr hdr = {
1853 .nops = 0, 1863 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1854 }; 1864 };
1855 1865
1856 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1866 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1869,7 +1879,7 @@ static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs4_fsin
1869{ 1879{
1870 struct xdr_stream xdr; 1880 struct xdr_stream xdr;
1871 struct compound_hdr hdr = { 1881 struct compound_hdr hdr = {
1872 .nops = 0, 1882 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1873 }; 1883 };
1874 1884
1875 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1885 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1887,7 +1897,7 @@ static int nfs4_xdr_enc_pathconf(struct rpc_rqst *req, __be32 *p, const struct n
1887{ 1897{
1888 struct xdr_stream xdr; 1898 struct xdr_stream xdr;
1889 struct compound_hdr hdr = { 1899 struct compound_hdr hdr = {
1890 .nops = 0, 1900 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1891 }; 1901 };
1892 1902
1893 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1903 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1906,7 +1916,7 @@ static int nfs4_xdr_enc_statfs(struct rpc_rqst *req, __be32 *p, const struct nfs
1906{ 1916{
1907 struct xdr_stream xdr; 1917 struct xdr_stream xdr;
1908 struct compound_hdr hdr = { 1918 struct compound_hdr hdr = {
1909 .nops = 0, 1919 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1910 }; 1920 };
1911 1921
1912 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1922 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -1926,7 +1936,7 @@ static int nfs4_xdr_enc_server_caps(struct rpc_rqst *req, __be32 *p,
1926{ 1936{
1927 struct xdr_stream xdr; 1937 struct xdr_stream xdr;
1928 struct compound_hdr hdr = { 1938 struct compound_hdr hdr = {
1929 .nops = 0, 1939 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
1930 }; 1940 };
1931 1941
1932 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 1942 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -2001,7 +2011,7 @@ static int nfs4_xdr_enc_delegreturn(struct rpc_rqst *req, __be32 *p, const struc
2001{ 2011{
2002 struct xdr_stream xdr; 2012 struct xdr_stream xdr;
2003 struct compound_hdr hdr = { 2013 struct compound_hdr hdr = {
2004 .nops = 0, 2014 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2005 }; 2015 };
2006 2016
2007 xdr_init_encode(&xdr, &req->rq_snd_buf, p); 2017 xdr_init_encode(&xdr, &req->rq_snd_buf, p);
@@ -2020,7 +2030,7 @@ static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs
2020{ 2030{
2021 struct xdr_stream xdr; 2031 struct xdr_stream xdr;
2022 struct compound_hdr hdr = { 2032 struct compound_hdr hdr = {
2023 .nops = 0, 2033 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2024 }; 2034 };
2025 uint32_t replen; 2035 uint32_t replen;
2026 2036
@@ -3996,7 +4006,7 @@ nfs4_xdr_enc_setacl(struct rpc_rqst *req, __be32 *p, struct nfs_setaclargs *args
3996{ 4006{
3997 struct xdr_stream xdr; 4007 struct xdr_stream xdr;
3998 struct compound_hdr hdr = { 4008 struct compound_hdr hdr = {
3999 .nops = 0, 4009 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
4000 }; 4010 };
4001 int status; 4011 int status;
4002 4012