inode.c (8ce44a2174c3b07950d7a8d44774e23e60518205) inode.c (129d1977ed39cbb4f091a518e4a12498c04f45ba)
1/*
2 * linux/fs/nfs/inode.c
3 *
4 * Copyright (C) 1992 Rick Sladkey
5 *
6 * nfs inode and superblock handling functions
7 *
8 * Modularised by Alan Cox <alan@lxorguk.ukuu.org.uk>, while hacking some

--- 18 unchanged lines hidden (view full) ---

27#include <linux/sunrpc/stats.h>
28#include <linux/sunrpc/metrics.h>
29#include <linux/nfs_fs.h>
30#include <linux/nfs_mount.h>
31#include <linux/nfs4_mount.h>
32#include <linux/lockd/bind.h>
33#include <linux/seq_file.h>
34#include <linux/mount.h>
1/*
2 * linux/fs/nfs/inode.c
3 *
4 * Copyright (C) 1992 Rick Sladkey
5 *
6 * nfs inode and superblock handling functions
7 *
8 * Modularised by Alan Cox <alan@lxorguk.ukuu.org.uk>, while hacking some

--- 18 unchanged lines hidden (view full) ---

27#include <linux/sunrpc/stats.h>
28#include <linux/sunrpc/metrics.h>
29#include <linux/nfs_fs.h>
30#include <linux/nfs_mount.h>
31#include <linux/nfs4_mount.h>
32#include <linux/lockd/bind.h>
33#include <linux/seq_file.h>
34#include <linux/mount.h>
35#include <linux/nfs_idmap.h>
36#include <linux/vfs.h>
37#include <linux/inet.h>
38#include <linux/nfs_xdr.h>
39#include <linux/slab.h>
40#include <linux/compat.h>
41#include <linux/freezer.h>
42#include <linux/crc32.h>
43

--- 381 unchanged lines hidden (view full) ---

425
426 fattr = nfs_alloc_fattr();
427 if (fattr == NULL)
428 goto out;
429 /*
430 * Return any delegations if we're going to change ACLs
431 */
432 if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0)
35#include <linux/vfs.h>
36#include <linux/inet.h>
37#include <linux/nfs_xdr.h>
38#include <linux/slab.h>
39#include <linux/compat.h>
40#include <linux/freezer.h>
41#include <linux/crc32.h>
42

--- 381 unchanged lines hidden (view full) ---

424
425 fattr = nfs_alloc_fattr();
426 if (fattr == NULL)
427 goto out;
428 /*
429 * Return any delegations if we're going to change ACLs
430 */
431 if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0)
433 nfs_inode_return_delegation(inode);
432 NFS_PROTO(inode)->return_delegation(inode);
434 error = NFS_PROTO(inode)->setattr(dentry, fattr, attr);
435 if (error == 0)
436 nfs_refresh_inode(inode, fattr);
437 nfs_free_fattr(fattr);
438out:
439 return error;
440}
441

--- 1010 unchanged lines hidden (view full) ---

1452 nfsi->attrtimeo_timestamp = now;
1453 }
1454 }
1455 invalid &= ~NFS_INO_INVALID_ATTR;
1456 /* Don't invalidate the data if we were to blame */
1457 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)
1458 || S_ISLNK(inode->i_mode)))
1459 invalid &= ~NFS_INO_INVALID_DATA;
433 error = NFS_PROTO(inode)->setattr(dentry, fattr, attr);
434 if (error == 0)
435 nfs_refresh_inode(inode, fattr);
436 nfs_free_fattr(fattr);
437out:
438 return error;
439}
440

--- 1010 unchanged lines hidden (view full) ---

1451 nfsi->attrtimeo_timestamp = now;
1452 }
1453 }
1454 invalid &= ~NFS_INO_INVALID_ATTR;
1455 /* Don't invalidate the data if we were to blame */
1456 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)
1457 || S_ISLNK(inode->i_mode)))
1458 invalid &= ~NFS_INO_INVALID_DATA;
1460 if (!nfs_have_delegation(inode, FMODE_READ) ||
1459 if (!NFS_PROTO(inode)->have_delegation(inode, FMODE_READ) ||
1461 (save_cache_validity & NFS_INO_REVAL_FORCED))
1462 nfsi->cache_validity |= invalid;
1463
1464 return 0;
1465 out_err:
1466 /*
1467 * No need to worry about unhashing the dentry, as the
1468 * lookup validation will know that the inode is bad.

--- 154 unchanged lines hidden (view full) ---

1623
1624/*
1625 * Initialize NFS
1626 */
1627static int __init init_nfs_fs(void)
1628{
1629 int err;
1630
1460 (save_cache_validity & NFS_INO_REVAL_FORCED))
1461 nfsi->cache_validity |= invalid;
1462
1463 return 0;
1464 out_err:
1465 /*
1466 * No need to worry about unhashing the dentry, as the
1467 * lookup validation will know that the inode is bad.

--- 154 unchanged lines hidden (view full) ---

1622
1623/*
1624 * Initialize NFS
1625 */
1626static int __init init_nfs_fs(void)
1627{
1628 int err;
1629
1631 err = nfs_idmap_init();
1632 if (err < 0)
1633 goto out10;
1634
1635 err = nfs_dns_resolver_init();
1636 if (err < 0)
1630 err = nfs_dns_resolver_init();
1631 if (err < 0)
1637 goto out9;
1632 goto out11;
1638
1639 err = register_pernet_subsys(&nfs_net_ops);
1640 if (err < 0)
1633
1634 err = register_pernet_subsys(&nfs_net_ops);
1635 if (err < 0)
1641 goto out8;
1636 goto out10;
1642
1643 err = nfs_fscache_register();
1644 if (err < 0)
1637
1638 err = nfs_fscache_register();
1639 if (err < 0)
1645 goto out7;
1640 goto out9;
1646
1647 err = nfsiod_start();
1648 if (err)
1641
1642 err = nfsiod_start();
1643 if (err)
1649 goto out6;
1644 goto out8;
1650
1651 err = nfs_fs_proc_init();
1652 if (err)
1645
1646 err = nfs_fs_proc_init();
1647 if (err)
1653 goto out5;
1648 goto out7;
1654
1655 err = nfs_init_nfspagecache();
1656 if (err)
1649
1650 err = nfs_init_nfspagecache();
1651 if (err)
1657 goto out4;
1652 goto out6;
1658
1659 err = nfs_init_inodecache();
1660 if (err)
1653
1654 err = nfs_init_inodecache();
1655 if (err)
1661 goto out3;
1656 goto out5;
1662
1663 err = nfs_init_readpagecache();
1664 if (err)
1657
1658 err = nfs_init_readpagecache();
1659 if (err)
1665 goto out2;
1660 goto out4;
1666
1667 err = nfs_init_writepagecache();
1668 if (err)
1661
1662 err = nfs_init_writepagecache();
1663 if (err)
1669 goto out1;
1664 goto out3;
1670
1671 err = nfs_init_directcache();
1672 if (err)
1665
1666 err = nfs_init_directcache();
1667 if (err)
1673 goto out0;
1668 goto out2;
1674
1675#ifdef CONFIG_PROC_FS
1676 rpc_proc_register(&init_net, &nfs_rpcstat);
1677#endif
1669
1670#ifdef CONFIG_PROC_FS
1671 rpc_proc_register(&init_net, &nfs_rpcstat);
1672#endif
1673
1674#ifdef CONFIG_NFS_V4
1675 err = init_nfs_v4();
1676 if (err)
1677 goto out1;
1678#endif
1679
1678 if ((err = register_nfs_fs()) != 0)
1680 if ((err = register_nfs_fs()) != 0)
1679 goto out;
1681 goto out0;
1682
1680 return 0;
1683 return 0;
1681out:
1684out0:
1685#ifdef CONFIG_NFS_V4
1686 exit_nfs_v4();
1687out1:
1688#endif
1682#ifdef CONFIG_PROC_FS
1683 rpc_proc_unregister(&init_net, "nfs");
1684#endif
1685 nfs_destroy_directcache();
1689#ifdef CONFIG_PROC_FS
1690 rpc_proc_unregister(&init_net, "nfs");
1691#endif
1692 nfs_destroy_directcache();
1686out0:
1687 nfs_destroy_writepagecache();
1688out1:
1689 nfs_destroy_readpagecache();
1690out2:
1693out2:
1691 nfs_destroy_inodecache();
1694 nfs_destroy_writepagecache();
1692out3:
1695out3:
1693 nfs_destroy_nfspagecache();
1696 nfs_destroy_readpagecache();
1694out4:
1697out4:
1695 nfs_fs_proc_exit();
1698 nfs_destroy_inodecache();
1696out5:
1699out5:
1697 nfsiod_stop();
1700 nfs_destroy_nfspagecache();
1698out6:
1701out6:
1699 nfs_fscache_unregister();
1702 nfs_fs_proc_exit();
1700out7:
1703out7:
1701 unregister_pernet_subsys(&nfs_net_ops);
1704 nfsiod_stop();
1702out8:
1705out8:
1703 nfs_dns_resolver_destroy();
1706 nfs_fscache_unregister();
1704out9:
1707out9:
1705 nfs_idmap_quit();
1708 unregister_pernet_subsys(&nfs_net_ops);
1706out10:
1709out10:
1710 nfs_dns_resolver_destroy();
1711out11:
1707 return err;
1708}
1709
1710static void __exit exit_nfs_fs(void)
1711{
1712 return err;
1713}
1714
1715static void __exit exit_nfs_fs(void)
1716{
1717#ifdef CONFIG_NFS_V4
1718 exit_nfs_v4();
1719#endif
1712 nfs_destroy_directcache();
1713 nfs_destroy_writepagecache();
1714 nfs_destroy_readpagecache();
1715 nfs_destroy_inodecache();
1716 nfs_destroy_nfspagecache();
1717 nfs_fscache_unregister();
1718 unregister_pernet_subsys(&nfs_net_ops);
1719 nfs_dns_resolver_destroy();
1720 nfs_destroy_directcache();
1721 nfs_destroy_writepagecache();
1722 nfs_destroy_readpagecache();
1723 nfs_destroy_inodecache();
1724 nfs_destroy_nfspagecache();
1725 nfs_fscache_unregister();
1726 unregister_pernet_subsys(&nfs_net_ops);
1727 nfs_dns_resolver_destroy();
1720 nfs_idmap_quit();
1721#ifdef CONFIG_PROC_FS
1722 rpc_proc_unregister(&init_net, "nfs");
1723#endif
1724 unregister_nfs_fs();
1725 nfs_fs_proc_exit();
1726 nfsiod_stop();
1727}
1728
1729/* Not quite true; I just maintain it */
1730MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
1731MODULE_LICENSE("GPL");
1732module_param(enable_ino64, bool, 0644);
1733
1734module_init(init_nfs_fs)
1735module_exit(exit_nfs_fs)
1728#ifdef CONFIG_PROC_FS
1729 rpc_proc_unregister(&init_net, "nfs");
1730#endif
1731 unregister_nfs_fs();
1732 nfs_fs_proc_exit();
1733 nfsiod_stop();
1734}
1735
1736/* Not quite true; I just maintain it */
1737MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
1738MODULE_LICENSE("GPL");
1739module_param(enable_ino64, bool, 0644);
1740
1741module_init(init_nfs_fs)
1742module_exit(exit_nfs_fs)