Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfsd: Remove deprecated nfsctl system call and related code.

As promised in feature-removal-schedule.txt it is time to
remove the nfsctl system call.

Userspace has perferred to not use this call throughout 2.6 and it has been
excluded in the default configuration since 2.6.36 (9 months ago).

So this patch removes all the code that was being compiled out.

There are still references to sys_nfsctl in various arch systemcall tables
and related code. These should be cleaned out too, probably in the next
merge window.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

NeilBrown and committed by
J. Bruce Fields
49b28684 094b5d74

-1238
-10
Documentation/feature-removal-schedule.txt
··· 491 491 492 492 ---------------------------- 493 493 494 - What: access to nfsd auth cache through sys_nfsservctl or '.' files 495 - in the 'nfsd' filesystem. 496 - When: 2.6.40 497 - Why: This is a legacy interface which have been replaced by a more 498 - dynamic cache. Continuing to maintain this interface is an 499 - unnecessary burden. 500 - Who: NeilBrown <neilb@suse.de> 501 - 502 - ---------------------------- 503 - 504 494 What: cancel_rearming_delayed_work[queue]() 505 495 When: 2.6.39 506 496
-1
arch/tile/configs/tilegx_defconfig
··· 1479 1479 CONFIG_NFS_USE_KERNEL_DNS=y 1480 1480 # CONFIG_NFS_USE_NEW_IDMAPPER is not set 1481 1481 CONFIG_NFSD=m 1482 - CONFIG_NFSD_DEPRECATED=y 1483 1482 CONFIG_NFSD_V2_ACL=y 1484 1483 CONFIG_NFSD_V3=y 1485 1484 CONFIG_NFSD_V3_ACL=y
-1
fs/Makefile
··· 29 29 obj-$(CONFIG_AIO) += aio.o 30 30 obj-$(CONFIG_FILE_LOCKING) += locks.o 31 31 obj-$(CONFIG_COMPAT) += compat.o compat_ioctl.o 32 - obj-$(CONFIG_NFSD_DEPRECATED) += nfsctl.o 33 32 obj-$(CONFIG_BINFMT_AOUT) += binfmt_aout.o 34 33 obj-$(CONFIG_BINFMT_EM86) += binfmt_em86.o 35 34 obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o
-246
fs/compat.c
··· 1675 1675 } 1676 1676 #endif /* HAVE_SET_RESTORE_SIGMASK */ 1677 1677 1678 - #if (defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)) && !defined(CONFIG_NFSD_DEPRECATED) 1679 - /* Stuff for NFS server syscalls... */ 1680 - struct compat_nfsctl_svc { 1681 - u16 svc32_port; 1682 - s32 svc32_nthreads; 1683 - }; 1684 - 1685 - struct compat_nfsctl_client { 1686 - s8 cl32_ident[NFSCLNT_IDMAX+1]; 1687 - s32 cl32_naddr; 1688 - struct in_addr cl32_addrlist[NFSCLNT_ADDRMAX]; 1689 - s32 cl32_fhkeytype; 1690 - s32 cl32_fhkeylen; 1691 - u8 cl32_fhkey[NFSCLNT_KEYMAX]; 1692 - }; 1693 - 1694 - struct compat_nfsctl_export { 1695 - char ex32_client[NFSCLNT_IDMAX+1]; 1696 - char ex32_path[NFS_MAXPATHLEN+1]; 1697 - compat_dev_t ex32_dev; 1698 - compat_ino_t ex32_ino; 1699 - compat_int_t ex32_flags; 1700 - __compat_uid_t ex32_anon_uid; 1701 - __compat_gid_t ex32_anon_gid; 1702 - }; 1703 - 1704 - struct compat_nfsctl_fdparm { 1705 - struct sockaddr gd32_addr; 1706 - s8 gd32_path[NFS_MAXPATHLEN+1]; 1707 - compat_int_t gd32_version; 1708 - }; 1709 - 1710 - struct compat_nfsctl_fsparm { 1711 - struct sockaddr gd32_addr; 1712 - s8 gd32_path[NFS_MAXPATHLEN+1]; 1713 - compat_int_t gd32_maxlen; 1714 - }; 1715 - 1716 - struct compat_nfsctl_arg { 1717 - compat_int_t ca32_version; /* safeguard */ 1718 - union { 1719 - struct compat_nfsctl_svc u32_svc; 1720 - struct compat_nfsctl_client u32_client; 1721 - struct compat_nfsctl_export u32_export; 1722 - struct compat_nfsctl_fdparm u32_getfd; 1723 - struct compat_nfsctl_fsparm u32_getfs; 1724 - } u; 1725 - #define ca32_svc u.u32_svc 1726 - #define ca32_client u.u32_client 1727 - #define ca32_export u.u32_export 1728 - #define ca32_getfd u.u32_getfd 1729 - #define ca32_getfs u.u32_getfs 1730 - }; 1731 - 1732 - union compat_nfsctl_res { 1733 - __u8 cr32_getfh[NFS_FHSIZE]; 1734 - struct knfsd_fh cr32_getfs; 1735 - }; 1736 - 1737 - static int compat_nfs_svc_trans(struct nfsctl_arg *karg, 1738 - struct compat_nfsctl_arg __user *arg) 1739 - { 1740 - if (!access_ok(VERIFY_READ, &arg->ca32_svc, sizeof(arg->ca32_svc)) || 1741 - get_user(karg->ca_version, &arg->ca32_version) || 1742 - __get_user(karg->ca_svc.svc_port, &arg->ca32_svc.svc32_port) || 1743 - __get_user(karg->ca_svc.svc_nthreads, 1744 - &arg->ca32_svc.svc32_nthreads)) 1745 - return -EFAULT; 1746 - return 0; 1747 - } 1748 - 1749 - static int compat_nfs_clnt_trans(struct nfsctl_arg *karg, 1750 - struct compat_nfsctl_arg __user *arg) 1751 - { 1752 - if (!access_ok(VERIFY_READ, &arg->ca32_client, 1753 - sizeof(arg->ca32_client)) || 1754 - get_user(karg->ca_version, &arg->ca32_version) || 1755 - __copy_from_user(&karg->ca_client.cl_ident[0], 1756 - &arg->ca32_client.cl32_ident[0], 1757 - NFSCLNT_IDMAX) || 1758 - __get_user(karg->ca_client.cl_naddr, 1759 - &arg->ca32_client.cl32_naddr) || 1760 - __copy_from_user(&karg->ca_client.cl_addrlist[0], 1761 - &arg->ca32_client.cl32_addrlist[0], 1762 - (sizeof(struct in_addr) * NFSCLNT_ADDRMAX)) || 1763 - __get_user(karg->ca_client.cl_fhkeytype, 1764 - &arg->ca32_client.cl32_fhkeytype) || 1765 - __get_user(karg->ca_client.cl_fhkeylen, 1766 - &arg->ca32_client.cl32_fhkeylen) || 1767 - __copy_from_user(&karg->ca_client.cl_fhkey[0], 1768 - &arg->ca32_client.cl32_fhkey[0], 1769 - NFSCLNT_KEYMAX)) 1770 - return -EFAULT; 1771 - 1772 - return 0; 1773 - } 1774 - 1775 - static int compat_nfs_exp_trans(struct nfsctl_arg *karg, 1776 - struct compat_nfsctl_arg __user *arg) 1777 - { 1778 - if (!access_ok(VERIFY_READ, &arg->ca32_export, 1779 - sizeof(arg->ca32_export)) || 1780 - get_user(karg->ca_version, &arg->ca32_version) || 1781 - __copy_from_user(&karg->ca_export.ex_client[0], 1782 - &arg->ca32_export.ex32_client[0], 1783 - NFSCLNT_IDMAX) || 1784 - __copy_from_user(&karg->ca_export.ex_path[0], 1785 - &arg->ca32_export.ex32_path[0], 1786 - NFS_MAXPATHLEN) || 1787 - __get_user(karg->ca_export.ex_dev, 1788 - &arg->ca32_export.ex32_dev) || 1789 - __get_user(karg->ca_export.ex_ino, 1790 - &arg->ca32_export.ex32_ino) || 1791 - __get_user(karg->ca_export.ex_flags, 1792 - &arg->ca32_export.ex32_flags) || 1793 - __get_user(karg->ca_export.ex_anon_uid, 1794 - &arg->ca32_export.ex32_anon_uid) || 1795 - __get_user(karg->ca_export.ex_anon_gid, 1796 - &arg->ca32_export.ex32_anon_gid)) 1797 - return -EFAULT; 1798 - SET_UID(karg->ca_export.ex_anon_uid, karg->ca_export.ex_anon_uid); 1799 - SET_GID(karg->ca_export.ex_anon_gid, karg->ca_export.ex_anon_gid); 1800 - 1801 - return 0; 1802 - } 1803 - 1804 - static int compat_nfs_getfd_trans(struct nfsctl_arg *karg, 1805 - struct compat_nfsctl_arg __user *arg) 1806 - { 1807 - if (!access_ok(VERIFY_READ, &arg->ca32_getfd, 1808 - sizeof(arg->ca32_getfd)) || 1809 - get_user(karg->ca_version, &arg->ca32_version) || 1810 - __copy_from_user(&karg->ca_getfd.gd_addr, 1811 - &arg->ca32_getfd.gd32_addr, 1812 - (sizeof(struct sockaddr))) || 1813 - __copy_from_user(&karg->ca_getfd.gd_path, 1814 - &arg->ca32_getfd.gd32_path, 1815 - (NFS_MAXPATHLEN+1)) || 1816 - __get_user(karg->ca_getfd.gd_version, 1817 - &arg->ca32_getfd.gd32_version)) 1818 - return -EFAULT; 1819 - 1820 - return 0; 1821 - } 1822 - 1823 - static int compat_nfs_getfs_trans(struct nfsctl_arg *karg, 1824 - struct compat_nfsctl_arg __user *arg) 1825 - { 1826 - if (!access_ok(VERIFY_READ,&arg->ca32_getfs,sizeof(arg->ca32_getfs)) || 1827 - get_user(karg->ca_version, &arg->ca32_version) || 1828 - __copy_from_user(&karg->ca_getfs.gd_addr, 1829 - &arg->ca32_getfs.gd32_addr, 1830 - (sizeof(struct sockaddr))) || 1831 - __copy_from_user(&karg->ca_getfs.gd_path, 1832 - &arg->ca32_getfs.gd32_path, 1833 - (NFS_MAXPATHLEN+1)) || 1834 - __get_user(karg->ca_getfs.gd_maxlen, 1835 - &arg->ca32_getfs.gd32_maxlen)) 1836 - return -EFAULT; 1837 - 1838 - return 0; 1839 - } 1840 - 1841 - /* This really doesn't need translations, we are only passing 1842 - * back a union which contains opaque nfs file handle data. 1843 - */ 1844 - static int compat_nfs_getfh_res_trans(union nfsctl_res *kres, 1845 - union compat_nfsctl_res __user *res) 1846 - { 1847 - int err; 1848 - 1849 - err = copy_to_user(res, kres, sizeof(*res)); 1850 - 1851 - return (err) ? -EFAULT : 0; 1852 - } 1853 - 1854 - asmlinkage long compat_sys_nfsservctl(int cmd, 1855 - struct compat_nfsctl_arg __user *arg, 1856 - union compat_nfsctl_res __user *res) 1857 - { 1858 - struct nfsctl_arg *karg; 1859 - union nfsctl_res *kres; 1860 - mm_segment_t oldfs; 1861 - int err; 1862 - 1863 - karg = kmalloc(sizeof(*karg), GFP_USER); 1864 - kres = kmalloc(sizeof(*kres), GFP_USER); 1865 - if(!karg || !kres) { 1866 - err = -ENOMEM; 1867 - goto done; 1868 - } 1869 - 1870 - switch(cmd) { 1871 - case NFSCTL_SVC: 1872 - err = compat_nfs_svc_trans(karg, arg); 1873 - break; 1874 - 1875 - case NFSCTL_ADDCLIENT: 1876 - err = compat_nfs_clnt_trans(karg, arg); 1877 - break; 1878 - 1879 - case NFSCTL_DELCLIENT: 1880 - err = compat_nfs_clnt_trans(karg, arg); 1881 - break; 1882 - 1883 - case NFSCTL_EXPORT: 1884 - case NFSCTL_UNEXPORT: 1885 - err = compat_nfs_exp_trans(karg, arg); 1886 - break; 1887 - 1888 - case NFSCTL_GETFD: 1889 - err = compat_nfs_getfd_trans(karg, arg); 1890 - break; 1891 - 1892 - case NFSCTL_GETFS: 1893 - err = compat_nfs_getfs_trans(karg, arg); 1894 - break; 1895 - 1896 - default: 1897 - err = -EINVAL; 1898 - break; 1899 - } 1900 - 1901 - if (err) 1902 - goto done; 1903 - 1904 - oldfs = get_fs(); 1905 - set_fs(KERNEL_DS); 1906 - /* The __user pointer casts are valid because of the set_fs() */ 1907 - err = sys_nfsservctl(cmd, (void __user *) karg, (void __user *) kres); 1908 - set_fs(oldfs); 1909 - 1910 - if (err) 1911 - goto done; 1912 - 1913 - if((cmd == NFSCTL_GETFD) || 1914 - (cmd == NFSCTL_GETFS)) 1915 - err = compat_nfs_getfh_res_trans(kres, res); 1916 - 1917 - done: 1918 - kfree(karg); 1919 - kfree(kres); 1920 - return err; 1921 - } 1922 - #else /* !NFSD */ 1923 1678 long asmlinkage compat_sys_nfsservctl(int cmd, void *notused, void *notused2) 1924 1679 { 1925 1680 return sys_ni_syscall(); 1926 1681 } 1927 - #endif 1928 1682 1929 1683 #ifdef CONFIG_EPOLL 1930 1684
-100
fs/nfsctl.c
··· 1 - /* 2 - * fs/nfsctl.c 3 - * 4 - * This should eventually move to userland. 5 - * 6 - */ 7 - #include <linux/types.h> 8 - #include <linux/file.h> 9 - #include <linux/fs.h> 10 - #include <linux/nfsd/syscall.h> 11 - #include <linux/cred.h> 12 - #include <linux/sched.h> 13 - #include <linux/linkage.h> 14 - #include <linux/namei.h> 15 - #include <linux/mount.h> 16 - #include <linux/syscalls.h> 17 - #include <asm/uaccess.h> 18 - 19 - /* 20 - * open a file on nfsd fs 21 - */ 22 - 23 - static struct file *do_open(char *name, int flags) 24 - { 25 - struct vfsmount *mnt; 26 - struct file *file; 27 - 28 - mnt = do_kern_mount("nfsd", 0, "nfsd", NULL); 29 - if (IS_ERR(mnt)) 30 - return (struct file *)mnt; 31 - 32 - file = file_open_root(mnt->mnt_root, mnt, name, flags); 33 - 34 - mntput(mnt); /* drop do_kern_mount reference */ 35 - return file; 36 - } 37 - 38 - static struct { 39 - char *name; int wsize; int rsize; 40 - } map[] = { 41 - [NFSCTL_SVC] = { 42 - .name = ".svc", 43 - .wsize = sizeof(struct nfsctl_svc) 44 - }, 45 - [NFSCTL_ADDCLIENT] = { 46 - .name = ".add", 47 - .wsize = sizeof(struct nfsctl_client) 48 - }, 49 - [NFSCTL_DELCLIENT] = { 50 - .name = ".del", 51 - .wsize = sizeof(struct nfsctl_client) 52 - }, 53 - [NFSCTL_EXPORT] = { 54 - .name = ".export", 55 - .wsize = sizeof(struct nfsctl_export) 56 - }, 57 - [NFSCTL_UNEXPORT] = { 58 - .name = ".unexport", 59 - .wsize = sizeof(struct nfsctl_export) 60 - }, 61 - [NFSCTL_GETFD] = { 62 - .name = ".getfd", 63 - .wsize = sizeof(struct nfsctl_fdparm), 64 - .rsize = NFS_FHSIZE 65 - }, 66 - [NFSCTL_GETFS] = { 67 - .name = ".getfs", 68 - .wsize = sizeof(struct nfsctl_fsparm), 69 - .rsize = sizeof(struct knfsd_fh) 70 - }, 71 - }; 72 - 73 - SYSCALL_DEFINE3(nfsservctl, int, cmd, struct nfsctl_arg __user *, arg, 74 - void __user *, res) 75 - { 76 - struct file *file; 77 - void __user *p = &arg->u; 78 - int version; 79 - int err; 80 - 81 - if (copy_from_user(&version, &arg->ca_version, sizeof(int))) 82 - return -EFAULT; 83 - 84 - if (version != NFSCTL_VERSION) 85 - return -EINVAL; 86 - 87 - if (cmd < 0 || cmd >= ARRAY_SIZE(map) || !map[cmd].name) 88 - return -EINVAL; 89 - 90 - file = do_open(map[cmd].name, map[cmd].rsize ? O_RDWR : O_WRONLY); 91 - if (IS_ERR(file)) 92 - return PTR_ERR(file); 93 - err = file->f_op->write(file, p, map[cmd].wsize, &file->f_pos); 94 - if (err >= 0 && map[cmd].rsize) 95 - err = file->f_op->read(file, res, map[cmd].rsize, &file->f_pos); 96 - if (err >= 0) 97 - err = 0; 98 - fput(file); 99 - return err; 100 - }
-12
fs/nfsd/Kconfig
··· 28 28 29 29 If unsure, say N. 30 30 31 - config NFSD_DEPRECATED 32 - bool "Include support for deprecated syscall interface to NFSD" 33 - depends on NFSD 34 - default y 35 - help 36 - The syscall interface to nfsd was obsoleted in 2.6.0 by a new 37 - filesystem based interface. The old interface is due for removal 38 - in 2.6.40. If you wish to remove the interface before then 39 - say N. 40 - 41 - In unsure, say Y. 42 - 43 31 config NFSD_V2_ACL 44 32 bool 45 33 depends on NFSD
-418
fs/nfsd/export.c
··· 797 797 return ek; 798 798 } 799 799 800 - #ifdef CONFIG_NFSD_DEPRECATED 801 - static int exp_set_key(svc_client *clp, int fsid_type, u32 *fsidv, 802 - struct svc_export *exp) 803 - { 804 - struct svc_expkey key, *ek; 805 - 806 - key.ek_client = clp; 807 - key.ek_fsidtype = fsid_type; 808 - memcpy(key.ek_fsid, fsidv, key_len(fsid_type)); 809 - key.ek_path = exp->ex_path; 810 - key.h.expiry_time = NEVER; 811 - key.h.flags = 0; 812 - 813 - ek = svc_expkey_lookup(&key); 814 - if (ek) 815 - ek = svc_expkey_update(&key,ek); 816 - if (ek) { 817 - cache_put(&ek->h, &svc_expkey_cache); 818 - return 0; 819 - } 820 - return -ENOMEM; 821 - } 822 - 823 - /* 824 - * Find the client's export entry matching xdev/xino. 825 - */ 826 - static inline struct svc_expkey * 827 - exp_get_key(svc_client *clp, dev_t dev, ino_t ino) 828 - { 829 - u32 fsidv[3]; 830 - 831 - if (old_valid_dev(dev)) { 832 - mk_fsid(FSID_DEV, fsidv, dev, ino, 0, NULL); 833 - return exp_find_key(clp, FSID_DEV, fsidv, NULL); 834 - } 835 - mk_fsid(FSID_ENCODE_DEV, fsidv, dev, ino, 0, NULL); 836 - return exp_find_key(clp, FSID_ENCODE_DEV, fsidv, NULL); 837 - } 838 - 839 - /* 840 - * Find the client's export entry matching fsid 841 - */ 842 - static inline struct svc_expkey * 843 - exp_get_fsid_key(svc_client *clp, int fsid) 844 - { 845 - u32 fsidv[2]; 846 - 847 - mk_fsid(FSID_NUM, fsidv, 0, 0, fsid, NULL); 848 - 849 - return exp_find_key(clp, FSID_NUM, fsidv, NULL); 850 - } 851 - #endif 852 800 853 801 static svc_export *exp_get_by_name(svc_client *clp, const struct path *path, 854 802 struct cache_req *reqp) ··· 838 890 return exp; 839 891 } 840 892 841 - #ifdef CONFIG_NFSD_DEPRECATED 842 - /* 843 - * Hashtable locking. Write locks are placed only by user processes 844 - * wanting to modify export information. 845 - * Write locking only done in this file. Read locking 846 - * needed externally. 847 - */ 848 893 849 - static DECLARE_RWSEM(hash_sem); 850 - 851 - void 852 - exp_readlock(void) 853 - { 854 - down_read(&hash_sem); 855 - } 856 - 857 - static inline void 858 - exp_writelock(void) 859 - { 860 - down_write(&hash_sem); 861 - } 862 - 863 - void 864 - exp_readunlock(void) 865 - { 866 - up_read(&hash_sem); 867 - } 868 - 869 - static inline void 870 - exp_writeunlock(void) 871 - { 872 - up_write(&hash_sem); 873 - } 874 - #else 875 - 876 - /* hash_sem not needed once deprecated interface is removed */ 877 - void exp_readlock(void) {} 878 - static inline void exp_writelock(void){} 879 - void exp_readunlock(void) {} 880 - static inline void exp_writeunlock(void){} 881 - 882 - #endif 883 - 884 - #ifdef CONFIG_NFSD_DEPRECATED 885 - static void exp_do_unexport(svc_export *unexp); 886 - static int exp_verify_string(char *cp, int max); 887 - 888 - static void exp_fsid_unhash(struct svc_export *exp) 889 - { 890 - struct svc_expkey *ek; 891 - 892 - if ((exp->ex_flags & NFSEXP_FSID) == 0) 893 - return; 894 - 895 - ek = exp_get_fsid_key(exp->ex_client, exp->ex_fsid); 896 - if (!IS_ERR(ek)) { 897 - sunrpc_invalidate(&ek->h, &svc_expkey_cache); 898 - cache_put(&ek->h, &svc_expkey_cache); 899 - } 900 - } 901 - 902 - static int exp_fsid_hash(svc_client *clp, struct svc_export *exp) 903 - { 904 - u32 fsid[2]; 905 - 906 - if ((exp->ex_flags & NFSEXP_FSID) == 0) 907 - return 0; 908 - 909 - mk_fsid(FSID_NUM, fsid, 0, 0, exp->ex_fsid, NULL); 910 - return exp_set_key(clp, FSID_NUM, fsid, exp); 911 - } 912 - 913 - static int exp_hash(struct auth_domain *clp, struct svc_export *exp) 914 - { 915 - u32 fsid[2]; 916 - struct inode *inode = exp->ex_path.dentry->d_inode; 917 - dev_t dev = inode->i_sb->s_dev; 918 - 919 - if (old_valid_dev(dev)) { 920 - mk_fsid(FSID_DEV, fsid, dev, inode->i_ino, 0, NULL); 921 - return exp_set_key(clp, FSID_DEV, fsid, exp); 922 - } 923 - mk_fsid(FSID_ENCODE_DEV, fsid, dev, inode->i_ino, 0, NULL); 924 - return exp_set_key(clp, FSID_ENCODE_DEV, fsid, exp); 925 - } 926 - 927 - static void exp_unhash(struct svc_export *exp) 928 - { 929 - struct svc_expkey *ek; 930 - struct inode *inode = exp->ex_path.dentry->d_inode; 931 - 932 - ek = exp_get_key(exp->ex_client, inode->i_sb->s_dev, inode->i_ino); 933 - if (!IS_ERR(ek)) { 934 - sunrpc_invalidate(&ek->h, &svc_expkey_cache); 935 - cache_put(&ek->h, &svc_expkey_cache); 936 - } 937 - } 938 - 939 - /* 940 - * Export a file system. 941 - */ 942 - int 943 - exp_export(struct nfsctl_export *nxp) 944 - { 945 - svc_client *clp; 946 - struct svc_export *exp = NULL; 947 - struct svc_export new; 948 - struct svc_expkey *fsid_key = NULL; 949 - struct path path; 950 - int err; 951 - 952 - /* Consistency check */ 953 - err = -EINVAL; 954 - if (!exp_verify_string(nxp->ex_path, NFS_MAXPATHLEN) || 955 - !exp_verify_string(nxp->ex_client, NFSCLNT_IDMAX)) 956 - goto out; 957 - 958 - dprintk("exp_export called for %s:%s (%x/%ld fl %x).\n", 959 - nxp->ex_client, nxp->ex_path, 960 - (unsigned)nxp->ex_dev, (long)nxp->ex_ino, 961 - nxp->ex_flags); 962 - 963 - /* Try to lock the export table for update */ 964 - exp_writelock(); 965 - 966 - /* Look up client info */ 967 - if (!(clp = auth_domain_find(nxp->ex_client))) 968 - goto out_unlock; 969 - 970 - 971 - /* Look up the dentry */ 972 - err = kern_path(nxp->ex_path, 0, &path); 973 - if (err) 974 - goto out_put_clp; 975 - err = -EINVAL; 976 - 977 - exp = exp_get_by_name(clp, &path, NULL); 978 - 979 - memset(&new, 0, sizeof(new)); 980 - 981 - /* must make sure there won't be an ex_fsid clash */ 982 - if ((nxp->ex_flags & NFSEXP_FSID) && 983 - (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) && 984 - fsid_key->ek_path.mnt && 985 - (fsid_key->ek_path.mnt != path.mnt || 986 - fsid_key->ek_path.dentry != path.dentry)) 987 - goto finish; 988 - 989 - if (!IS_ERR(exp)) { 990 - /* just a flags/id/fsid update */ 991 - 992 - exp_fsid_unhash(exp); 993 - exp->ex_flags = nxp->ex_flags; 994 - exp->ex_anon_uid = nxp->ex_anon_uid; 995 - exp->ex_anon_gid = nxp->ex_anon_gid; 996 - exp->ex_fsid = nxp->ex_dev; 997 - 998 - err = exp_fsid_hash(clp, exp); 999 - goto finish; 1000 - } 1001 - 1002 - err = check_export(path.dentry->d_inode, &nxp->ex_flags, NULL); 1003 - if (err) goto finish; 1004 - 1005 - err = -ENOMEM; 1006 - 1007 - dprintk("nfsd: creating export entry %p for client %p\n", exp, clp); 1008 - 1009 - new.h.expiry_time = NEVER; 1010 - new.h.flags = 0; 1011 - new.ex_pathname = kstrdup(nxp->ex_path, GFP_KERNEL); 1012 - if (!new.ex_pathname) 1013 - goto finish; 1014 - new.ex_client = clp; 1015 - new.ex_path = path; 1016 - new.ex_flags = nxp->ex_flags; 1017 - new.ex_anon_uid = nxp->ex_anon_uid; 1018 - new.ex_anon_gid = nxp->ex_anon_gid; 1019 - new.ex_fsid = nxp->ex_dev; 1020 - 1021 - exp = svc_export_lookup(&new); 1022 - if (exp) 1023 - exp = svc_export_update(&new, exp); 1024 - 1025 - if (!exp) 1026 - goto finish; 1027 - 1028 - if (exp_hash(clp, exp) || 1029 - exp_fsid_hash(clp, exp)) { 1030 - /* failed to create at least one index */ 1031 - exp_do_unexport(exp); 1032 - cache_flush(); 1033 - } else 1034 - err = 0; 1035 - finish: 1036 - kfree(new.ex_pathname); 1037 - if (!IS_ERR_OR_NULL(exp)) 1038 - exp_put(exp); 1039 - if (!IS_ERR_OR_NULL(fsid_key)) 1040 - cache_put(&fsid_key->h, &svc_expkey_cache); 1041 - path_put(&path); 1042 - out_put_clp: 1043 - auth_domain_put(clp); 1044 - out_unlock: 1045 - exp_writeunlock(); 1046 - out: 1047 - return err; 1048 - } 1049 - 1050 - /* 1051 - * Unexport a file system. The export entry has already 1052 - * been removed from the client's list of exported fs's. 1053 - */ 1054 - static void 1055 - exp_do_unexport(svc_export *unexp) 1056 - { 1057 - sunrpc_invalidate(&unexp->h, &svc_export_cache); 1058 - exp_unhash(unexp); 1059 - exp_fsid_unhash(unexp); 1060 - } 1061 - 1062 - 1063 - /* 1064 - * unexport syscall. 1065 - */ 1066 - int 1067 - exp_unexport(struct nfsctl_export *nxp) 1068 - { 1069 - struct auth_domain *dom; 1070 - svc_export *exp; 1071 - struct path path; 1072 - int err; 1073 - 1074 - /* Consistency check */ 1075 - if (!exp_verify_string(nxp->ex_path, NFS_MAXPATHLEN) || 1076 - !exp_verify_string(nxp->ex_client, NFSCLNT_IDMAX)) 1077 - return -EINVAL; 1078 - 1079 - exp_writelock(); 1080 - 1081 - err = -EINVAL; 1082 - dom = auth_domain_find(nxp->ex_client); 1083 - if (!dom) { 1084 - dprintk("nfsd: unexport couldn't find %s\n", nxp->ex_client); 1085 - goto out_unlock; 1086 - } 1087 - 1088 - err = kern_path(nxp->ex_path, 0, &path); 1089 - if (err) 1090 - goto out_domain; 1091 - 1092 - err = -EINVAL; 1093 - exp = exp_get_by_name(dom, &path, NULL); 1094 - path_put(&path); 1095 - if (IS_ERR(exp)) 1096 - goto out_domain; 1097 - 1098 - exp_do_unexport(exp); 1099 - exp_put(exp); 1100 - err = 0; 1101 - 1102 - out_domain: 1103 - auth_domain_put(dom); 1104 - cache_flush(); 1105 - out_unlock: 1106 - exp_writeunlock(); 1107 - return err; 1108 - } 1109 - #endif /* CONFIG_NFSD_DEPRECATED */ 1110 894 1111 895 /* 1112 896 * Obtain the root fh on behalf of a client. ··· 1047 1367 unsigned hash, export; 1048 1368 struct cache_head *ch; 1049 1369 1050 - exp_readlock(); 1051 1370 read_lock(&svc_export_cache.hash_lock); 1052 1371 if (!n--) 1053 1372 return SEQ_START_TOKEN; ··· 1097 1418 __releases(svc_export_cache.hash_lock) 1098 1419 { 1099 1420 read_unlock(&svc_export_cache.hash_lock); 1100 - exp_readunlock(); 1101 1421 } 1102 1422 1103 1423 static struct flags { ··· 1228 1550 .show = e_show, 1229 1551 }; 1230 1552 1231 - #ifdef CONFIG_NFSD_DEPRECATED 1232 - /* 1233 - * Add or modify a client. 1234 - * Change requests may involve the list of host addresses. The list of 1235 - * exports and possibly existing uid maps are left untouched. 1236 - */ 1237 - int 1238 - exp_addclient(struct nfsctl_client *ncp) 1239 - { 1240 - struct auth_domain *dom; 1241 - int i, err; 1242 - struct in6_addr addr6; 1243 - 1244 - /* First, consistency check. */ 1245 - err = -EINVAL; 1246 - if (! exp_verify_string(ncp->cl_ident, NFSCLNT_IDMAX)) 1247 - goto out; 1248 - if (ncp->cl_naddr > NFSCLNT_ADDRMAX) 1249 - goto out; 1250 - 1251 - /* Lock the hashtable */ 1252 - exp_writelock(); 1253 - 1254 - dom = unix_domain_find(ncp->cl_ident); 1255 - 1256 - err = -ENOMEM; 1257 - if (!dom) 1258 - goto out_unlock; 1259 - 1260 - /* Insert client into hashtable. */ 1261 - for (i = 0; i < ncp->cl_naddr; i++) { 1262 - ipv6_addr_set_v4mapped(ncp->cl_addrlist[i].s_addr, &addr6); 1263 - auth_unix_add_addr(&init_net, &addr6, dom); 1264 - } 1265 - auth_unix_forget_old(dom); 1266 - auth_domain_put(dom); 1267 - 1268 - err = 0; 1269 - 1270 - out_unlock: 1271 - exp_writeunlock(); 1272 - out: 1273 - return err; 1274 - } 1275 - 1276 - /* 1277 - * Delete a client given an identifier. 1278 - */ 1279 - int 1280 - exp_delclient(struct nfsctl_client *ncp) 1281 - { 1282 - int err; 1283 - struct auth_domain *dom; 1284 - 1285 - err = -EINVAL; 1286 - if (!exp_verify_string(ncp->cl_ident, NFSCLNT_IDMAX)) 1287 - goto out; 1288 - 1289 - /* Lock the hashtable */ 1290 - exp_writelock(); 1291 - 1292 - dom = auth_domain_find(ncp->cl_ident); 1293 - /* just make sure that no addresses work 1294 - * and that it will expire soon 1295 - */ 1296 - if (dom) { 1297 - err = auth_unix_forget_old(dom); 1298 - auth_domain_put(dom); 1299 - } 1300 - 1301 - exp_writeunlock(); 1302 - out: 1303 - return err; 1304 - } 1305 - 1306 - /* 1307 - * Verify that string is non-empty and does not exceed max length. 1308 - */ 1309 - static int 1310 - exp_verify_string(char *cp, int max) 1311 - { 1312 - int i; 1313 - 1314 - for (i = 0; i < max; i++) 1315 - if (!cp[i]) 1316 - return i; 1317 - cp[i] = 0; 1318 - printk(KERN_NOTICE "nfsd: couldn't validate string %s\n", cp); 1319 - return 0; 1320 - } 1321 - #endif /* CONFIG_NFSD_DEPRECATED */ 1322 1553 1323 1554 /* 1324 1555 * Initialize the exports module. ··· 1254 1667 void 1255 1668 nfsd_export_flush(void) 1256 1669 { 1257 - exp_writelock(); 1258 1670 cache_purge(&svc_expkey_cache); 1259 1671 cache_purge(&svc_export_cache); 1260 - exp_writeunlock(); 1261 1672 } 1262 1673 1263 1674 /* ··· 1267 1682 1268 1683 dprintk("nfsd: shutting down export module.\n"); 1269 1684 1270 - exp_writelock(); 1271 - 1272 1685 cache_unregister(&svc_expkey_cache); 1273 1686 cache_unregister(&svc_export_cache); 1274 1687 svcauth_unix_purge(); 1275 1688 1276 - exp_writeunlock(); 1277 1689 dprintk("nfsd: export shutdown complete.\n"); 1278 1690 }
-2
fs/nfsd/lockd.c
··· 35 35 memcpy((char*)&fh.fh_handle.fh_base, f->data, f->size); 36 36 fh.fh_export = NULL; 37 37 38 - exp_readlock(); 39 38 nfserr = nfsd_open(rqstp, &fh, S_IFREG, NFSD_MAY_LOCK, filp); 40 39 fh_put(&fh); 41 - exp_readunlock(); 42 40 /* We return nlm error codes as nlm doesn't know 43 41 * about nfsd, but nfsd does know about nlm.. 44 42 */
-343
fs/nfsd/nfsctl.c
··· 24 24 */ 25 25 enum { 26 26 NFSD_Root = 1, 27 - #ifdef CONFIG_NFSD_DEPRECATED 28 - NFSD_Svc, 29 - NFSD_Add, 30 - NFSD_Del, 31 - NFSD_Export, 32 - NFSD_Unexport, 33 - NFSD_Getfd, 34 - NFSD_Getfs, 35 - #endif 36 27 NFSD_List, 37 28 NFSD_Export_features, 38 29 NFSD_Fh, ··· 50 59 /* 51 60 * write() for these nodes. 52 61 */ 53 - #ifdef CONFIG_NFSD_DEPRECATED 54 - static ssize_t write_svc(struct file *file, char *buf, size_t size); 55 - static ssize_t write_add(struct file *file, char *buf, size_t size); 56 - static ssize_t write_del(struct file *file, char *buf, size_t size); 57 - static ssize_t write_export(struct file *file, char *buf, size_t size); 58 - static ssize_t write_unexport(struct file *file, char *buf, size_t size); 59 - static ssize_t write_getfd(struct file *file, char *buf, size_t size); 60 - static ssize_t write_getfs(struct file *file, char *buf, size_t size); 61 - #endif 62 62 static ssize_t write_filehandle(struct file *file, char *buf, size_t size); 63 63 static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size); 64 64 static ssize_t write_unlock_fs(struct file *file, char *buf, size_t size); ··· 65 83 #endif 66 84 67 85 static ssize_t (*write_op[])(struct file *, char *, size_t) = { 68 - #ifdef CONFIG_NFSD_DEPRECATED 69 - [NFSD_Svc] = write_svc, 70 - [NFSD_Add] = write_add, 71 - [NFSD_Del] = write_del, 72 - [NFSD_Export] = write_export, 73 - [NFSD_Unexport] = write_unexport, 74 - [NFSD_Getfd] = write_getfd, 75 - [NFSD_Getfs] = write_getfs, 76 - #endif 77 86 [NFSD_Fh] = write_filehandle, 78 87 [NFSD_FO_UnlockIP] = write_unlock_ip, 79 88 [NFSD_FO_UnlockFS] = write_unlock_fs, ··· 103 130 104 131 static ssize_t nfsctl_transaction_read(struct file *file, char __user *buf, size_t size, loff_t *pos) 105 132 { 106 - #ifdef CONFIG_NFSD_DEPRECATED 107 - static int warned; 108 - if (file->f_dentry->d_name.name[0] == '.' && !warned) { 109 - printk(KERN_INFO 110 - "Warning: \"%s\" uses deprecated NFSD interface: %s." 111 - " This will be removed in 2.6.40\n", 112 - current->comm, file->f_dentry->d_name.name); 113 - warned = 1; 114 - } 115 - #endif 116 133 if (! file->private_data) { 117 134 /* An attempt to read a transaction file without writing 118 135 * causes a 0-byte write so that the file can return ··· 189 226 * payload - write methods 190 227 */ 191 228 192 - #ifdef CONFIG_NFSD_DEPRECATED 193 - /** 194 - * write_svc - Start kernel's NFSD server 195 - * 196 - * Deprecated. /proc/fs/nfsd/threads is preferred. 197 - * Function remains to support old versions of nfs-utils. 198 - * 199 - * Input: 200 - * buf: struct nfsctl_svc 201 - * svc_port: port number of this 202 - * server's listener 203 - * svc_nthreads: number of threads to start 204 - * size: size in bytes of passed in nfsctl_svc 205 - * Output: 206 - * On success: returns zero 207 - * On error: return code is negative errno value 208 - */ 209 - static ssize_t write_svc(struct file *file, char *buf, size_t size) 210 - { 211 - struct nfsctl_svc *data; 212 - int err; 213 - if (size < sizeof(*data)) 214 - return -EINVAL; 215 - data = (struct nfsctl_svc*) buf; 216 - err = nfsd_svc(data->svc_port, data->svc_nthreads); 217 - if (err < 0) 218 - return err; 219 - return 0; 220 - } 221 - 222 - /** 223 - * write_add - Add or modify client entry in auth unix cache 224 - * 225 - * Deprecated. /proc/net/rpc/auth.unix.ip is preferred. 226 - * Function remains to support old versions of nfs-utils. 227 - * 228 - * Input: 229 - * buf: struct nfsctl_client 230 - * cl_ident: '\0'-terminated C string 231 - * containing domain name 232 - * of client 233 - * cl_naddr: no. of items in cl_addrlist 234 - * cl_addrlist: array of client addresses 235 - * cl_fhkeytype: ignored 236 - * cl_fhkeylen: ignored 237 - * cl_fhkey: ignored 238 - * size: size in bytes of passed in nfsctl_client 239 - * Output: 240 - * On success: returns zero 241 - * On error: return code is negative errno value 242 - * 243 - * Note: Only AF_INET client addresses are passed in, since 244 - * nfsctl_client.cl_addrlist contains only in_addr fields for addresses. 245 - */ 246 - static ssize_t write_add(struct file *file, char *buf, size_t size) 247 - { 248 - struct nfsctl_client *data; 249 - if (size < sizeof(*data)) 250 - return -EINVAL; 251 - data = (struct nfsctl_client *)buf; 252 - return exp_addclient(data); 253 - } 254 - 255 - /** 256 - * write_del - Remove client from auth unix cache 257 - * 258 - * Deprecated. /proc/net/rpc/auth.unix.ip is preferred. 259 - * Function remains to support old versions of nfs-utils. 260 - * 261 - * Input: 262 - * buf: struct nfsctl_client 263 - * cl_ident: '\0'-terminated C string 264 - * containing domain name 265 - * of client 266 - * cl_naddr: ignored 267 - * cl_addrlist: ignored 268 - * cl_fhkeytype: ignored 269 - * cl_fhkeylen: ignored 270 - * cl_fhkey: ignored 271 - * size: size in bytes of passed in nfsctl_client 272 - * Output: 273 - * On success: returns zero 274 - * On error: return code is negative errno value 275 - * 276 - * Note: Only AF_INET client addresses are passed in, since 277 - * nfsctl_client.cl_addrlist contains only in_addr fields for addresses. 278 - */ 279 - static ssize_t write_del(struct file *file, char *buf, size_t size) 280 - { 281 - struct nfsctl_client *data; 282 - if (size < sizeof(*data)) 283 - return -EINVAL; 284 - data = (struct nfsctl_client *)buf; 285 - return exp_delclient(data); 286 - } 287 - 288 - /** 289 - * write_export - Export part or all of a local file system 290 - * 291 - * Deprecated. /proc/net/rpc/{nfsd.export,nfsd.fh} are preferred. 292 - * Function remains to support old versions of nfs-utils. 293 - * 294 - * Input: 295 - * buf: struct nfsctl_export 296 - * ex_client: '\0'-terminated C string 297 - * containing domain name 298 - * of client allowed to access 299 - * this export 300 - * ex_path: '\0'-terminated C string 301 - * containing pathname of 302 - * directory in local file system 303 - * ex_dev: fsid to use for this export 304 - * ex_ino: ignored 305 - * ex_flags: export flags for this export 306 - * ex_anon_uid: UID to use for anonymous 307 - * requests 308 - * ex_anon_gid: GID to use for anonymous 309 - * requests 310 - * size: size in bytes of passed in nfsctl_export 311 - * Output: 312 - * On success: returns zero 313 - * On error: return code is negative errno value 314 - */ 315 - static ssize_t write_export(struct file *file, char *buf, size_t size) 316 - { 317 - struct nfsctl_export *data; 318 - if (size < sizeof(*data)) 319 - return -EINVAL; 320 - data = (struct nfsctl_export*)buf; 321 - return exp_export(data); 322 - } 323 - 324 - /** 325 - * write_unexport - Unexport a previously exported file system 326 - * 327 - * Deprecated. /proc/net/rpc/{nfsd.export,nfsd.fh} are preferred. 328 - * Function remains to support old versions of nfs-utils. 329 - * 330 - * Input: 331 - * buf: struct nfsctl_export 332 - * ex_client: '\0'-terminated C string 333 - * containing domain name 334 - * of client no longer allowed 335 - * to access this export 336 - * ex_path: '\0'-terminated C string 337 - * containing pathname of 338 - * directory in local file system 339 - * ex_dev: ignored 340 - * ex_ino: ignored 341 - * ex_flags: ignored 342 - * ex_anon_uid: ignored 343 - * ex_anon_gid: ignored 344 - * size: size in bytes of passed in nfsctl_export 345 - * Output: 346 - * On success: returns zero 347 - * On error: return code is negative errno value 348 - */ 349 - static ssize_t write_unexport(struct file *file, char *buf, size_t size) 350 - { 351 - struct nfsctl_export *data; 352 - 353 - if (size < sizeof(*data)) 354 - return -EINVAL; 355 - data = (struct nfsctl_export*)buf; 356 - return exp_unexport(data); 357 - } 358 - 359 - /** 360 - * write_getfs - Get a variable-length NFS file handle by path 361 - * 362 - * Deprecated. /proc/fs/nfsd/filehandle is preferred. 363 - * Function remains to support old versions of nfs-utils. 364 - * 365 - * Input: 366 - * buf: struct nfsctl_fsparm 367 - * gd_addr: socket address of client 368 - * gd_path: '\0'-terminated C string 369 - * containing pathname of 370 - * directory in local file system 371 - * gd_maxlen: maximum size of returned file 372 - * handle 373 - * size: size in bytes of passed in nfsctl_fsparm 374 - * Output: 375 - * On success: passed-in buffer filled with a knfsd_fh structure 376 - * (a variable-length raw NFS file handle); 377 - * return code is the size in bytes of the file handle 378 - * On error: return code is negative errno value 379 - * 380 - * Note: Only AF_INET client addresses are passed in, since gd_addr 381 - * is the same size as a struct sockaddr_in. 382 - */ 383 - static ssize_t write_getfs(struct file *file, char *buf, size_t size) 384 - { 385 - struct nfsctl_fsparm *data; 386 - struct sockaddr_in *sin; 387 - struct auth_domain *clp; 388 - int err = 0; 389 - struct knfsd_fh *res; 390 - struct in6_addr in6; 391 - 392 - if (size < sizeof(*data)) 393 - return -EINVAL; 394 - data = (struct nfsctl_fsparm*)buf; 395 - err = -EPROTONOSUPPORT; 396 - if (data->gd_addr.sa_family != AF_INET) 397 - goto out; 398 - sin = (struct sockaddr_in *)&data->gd_addr; 399 - if (data->gd_maxlen > NFS3_FHSIZE) 400 - data->gd_maxlen = NFS3_FHSIZE; 401 - 402 - res = (struct knfsd_fh*)buf; 403 - 404 - exp_readlock(); 405 - 406 - ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6); 407 - 408 - clp = auth_unix_lookup(&init_net, &in6); 409 - if (!clp) 410 - err = -EPERM; 411 - else { 412 - err = exp_rootfh(clp, data->gd_path, res, data->gd_maxlen); 413 - auth_domain_put(clp); 414 - } 415 - exp_readunlock(); 416 - if (err == 0) 417 - err = res->fh_size + offsetof(struct knfsd_fh, fh_base); 418 - out: 419 - return err; 420 - } 421 - 422 - /** 423 - * write_getfd - Get a fixed-length NFS file handle by path (used by mountd) 424 - * 425 - * Deprecated. /proc/fs/nfsd/filehandle is preferred. 426 - * Function remains to support old versions of nfs-utils. 427 - * 428 - * Input: 429 - * buf: struct nfsctl_fdparm 430 - * gd_addr: socket address of client 431 - * gd_path: '\0'-terminated C string 432 - * containing pathname of 433 - * directory in local file system 434 - * gd_version: fdparm structure version 435 - * size: size in bytes of passed in nfsctl_fdparm 436 - * Output: 437 - * On success: passed-in buffer filled with nfsctl_res 438 - * (a fixed-length raw NFS file handle); 439 - * return code is the size in bytes of the file handle 440 - * On error: return code is negative errno value 441 - * 442 - * Note: Only AF_INET client addresses are passed in, since gd_addr 443 - * is the same size as a struct sockaddr_in. 444 - */ 445 - static ssize_t write_getfd(struct file *file, char *buf, size_t size) 446 - { 447 - struct nfsctl_fdparm *data; 448 - struct sockaddr_in *sin; 449 - struct auth_domain *clp; 450 - int err = 0; 451 - struct knfsd_fh fh; 452 - char *res; 453 - struct in6_addr in6; 454 - 455 - if (size < sizeof(*data)) 456 - return -EINVAL; 457 - data = (struct nfsctl_fdparm*)buf; 458 - err = -EPROTONOSUPPORT; 459 - if (data->gd_addr.sa_family != AF_INET) 460 - goto out; 461 - err = -EINVAL; 462 - if (data->gd_version < 2 || data->gd_version > NFSSVC_MAXVERS) 463 - goto out; 464 - 465 - res = buf; 466 - sin = (struct sockaddr_in *)&data->gd_addr; 467 - exp_readlock(); 468 - 469 - ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6); 470 - 471 - clp = auth_unix_lookup(&init_net, &in6); 472 - if (!clp) 473 - err = -EPERM; 474 - else { 475 - err = exp_rootfh(clp, data->gd_path, &fh, NFS_FHSIZE); 476 - auth_domain_put(clp); 477 - } 478 - exp_readunlock(); 479 - 480 - if (err == 0) { 481 - memset(res,0, NFS_FHSIZE); 482 - memcpy(res, &fh.fh_base, fh.fh_size); 483 - err = NFS_FHSIZE; 484 - } 485 - out: 486 - return err; 487 - } 488 - #endif /* CONFIG_NFSD_DEPRECATED */ 489 229 490 230 /** 491 231 * write_unlock_ip - Release all locks used by a client ··· 1063 1397 static int nfsd_fill_super(struct super_block * sb, void * data, int silent) 1064 1398 { 1065 1399 static struct tree_descr nfsd_files[] = { 1066 - #ifdef CONFIG_NFSD_DEPRECATED 1067 - [NFSD_Svc] = {".svc", &transaction_ops, S_IWUSR}, 1068 - [NFSD_Add] = {".add", &transaction_ops, S_IWUSR}, 1069 - [NFSD_Del] = {".del", &transaction_ops, S_IWUSR}, 1070 - [NFSD_Export] = {".export", &transaction_ops, S_IWUSR}, 1071 - [NFSD_Unexport] = {".unexport", &transaction_ops, S_IWUSR}, 1072 - [NFSD_Getfd] = {".getfd", &transaction_ops, S_IWUSR|S_IRUSR}, 1073 - [NFSD_Getfs] = {".getfs", &transaction_ops, S_IWUSR|S_IRUSR}, 1074 - #endif 1075 1400 [NFSD_List] = {"exports", &exports_operations, S_IRUGO}, 1076 1401 [NFSD_Export_features] = {"export_features", 1077 1402 &export_features_operations, S_IRUGO},
-7
fs/nfsd/nfssvc.c
··· 528 528 continue; 529 529 } 530 530 531 - 532 - /* Lock the export hash tables for reading. */ 533 - exp_readlock(); 534 - 535 531 validate_process_creds(); 536 532 svc_process(rqstp); 537 533 validate_process_creds(); 538 - 539 - /* Unlock export hash tables */ 540 - exp_readunlock(); 541 534 } 542 535 543 536 /* Clear signals before calling svc_exit_thread() */
-9
include/linux/compat.h
··· 438 438 struct compat_timespec __user *tsp, 439 439 const compat_sigset_t __user *sigmask, 440 440 compat_size_t sigsetsize); 441 - #if (defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)) && \ 442 - !defined(CONFIG_NFSD_DEPRECATED) 443 - union compat_nfsctl_res; 444 - struct compat_nfsctl_arg; 445 - asmlinkage long compat_sys_nfsservctl(int cmd, 446 - struct compat_nfsctl_arg __user *arg, 447 - union compat_nfsctl_res __user *res); 448 - #else 449 441 asmlinkage long compat_sys_nfsservctl(int cmd, void *notused, void *notused2); 450 - #endif 451 442 asmlinkage long compat_sys_signalfd4(int ufd, 452 443 const compat_sigset_t __user *sigmask, 453 444 compat_size_t sigsetsize, int flags);
-2
include/linux/nfsd/export.h
··· 133 133 int nfsd_export_init(void); 134 134 void nfsd_export_shutdown(void); 135 135 void nfsd_export_flush(void); 136 - void exp_readlock(void); 137 - void exp_readunlock(void); 138 136 struct svc_export * rqst_exp_get_by_name(struct svc_rqst *, 139 137 struct path *); 140 138 struct svc_export * rqst_exp_parent(struct svc_rqst *,
-9
include/linux/sunrpc/cache.h
··· 256 256 return rv - boot.tv_sec; 257 257 } 258 258 259 - #ifdef CONFIG_NFSD_DEPRECATED 260 - static inline void sunrpc_invalidate(struct cache_head *h, 261 - struct cache_detail *detail) 262 - { 263 - h->expiry_time = seconds_since_boot() - 1; 264 - detail->nextcheck = seconds_since_boot(); 265 - } 266 - #endif /* CONFIG_NFSD_DEPRECATED */ 267 - 268 259 #endif /* _LINUX_SUNRPC_CACHE_H_ */
-78
net/sunrpc/svcauth_unix.c
··· 30 30 31 31 struct unix_domain { 32 32 struct auth_domain h; 33 - #ifdef CONFIG_NFSD_DEPRECATED 34 - int addr_changes; 35 - #endif /* CONFIG_NFSD_DEPRECATED */ 36 33 /* other stuff later */ 37 34 }; 38 35 ··· 71 74 return NULL; 72 75 } 73 76 new->h.flavour = &svcauth_unix; 74 - #ifdef CONFIG_NFSD_DEPRECATED 75 - new->addr_changes = 0; 76 - #endif /* CONFIG_NFSD_DEPRECATED */ 77 77 rv = auth_domain_lookup(name, &new->h); 78 78 } 79 79 } ··· 89 95 char m_class[8]; /* e.g. "nfsd" */ 90 96 struct in6_addr m_addr; 91 97 struct unix_domain *m_client; 92 - #ifdef CONFIG_NFSD_DEPRECATED 93 - int m_add_change; 94 - #endif /* CONFIG_NFSD_DEPRECATED */ 95 98 }; 96 99 97 100 static void ip_map_put(struct kref *kref) ··· 142 151 143 152 kref_get(&item->m_client->h.ref); 144 153 new->m_client = item->m_client; 145 - #ifdef CONFIG_NFSD_DEPRECATED 146 - new->m_add_change = item->m_add_change; 147 - #endif /* CONFIG_NFSD_DEPRECATED */ 148 154 } 149 155 static struct cache_head *ip_map_alloc(void) 150 156 { ··· 326 338 ip.h.flags = 0; 327 339 if (!udom) 328 340 set_bit(CACHE_NEGATIVE, &ip.h.flags); 329 - #ifdef CONFIG_NFSD_DEPRECATED 330 - else { 331 - ip.m_add_change = udom->addr_changes; 332 - /* if this is from the legacy set_client system call, 333 - * we need m_add_change to be one higher 334 - */ 335 - if (expiry == NEVER) 336 - ip.m_add_change++; 337 - } 338 - #endif /* CONFIG_NFSD_DEPRECATED */ 339 341 ip.h.expiry_time = expiry; 340 342 ch = sunrpc_cache_update(cd, &ip.h, &ipm->h, 341 343 hash_str(ipm->m_class, IP_HASHBITS) ^ ··· 345 367 return __ip_map_update(sn->ip_map_cache, ipm, udom, expiry); 346 368 } 347 369 348 - #ifdef CONFIG_NFSD_DEPRECATED 349 - int auth_unix_add_addr(struct net *net, struct in6_addr *addr, struct auth_domain *dom) 350 - { 351 - struct unix_domain *udom; 352 - struct ip_map *ipmp; 353 - 354 - if (dom->flavour != &svcauth_unix) 355 - return -EINVAL; 356 - udom = container_of(dom, struct unix_domain, h); 357 - ipmp = ip_map_lookup(net, "nfsd", addr); 358 - 359 - if (ipmp) 360 - return ip_map_update(net, ipmp, udom, NEVER); 361 - else 362 - return -ENOMEM; 363 - } 364 - EXPORT_SYMBOL_GPL(auth_unix_add_addr); 365 - 366 - int auth_unix_forget_old(struct auth_domain *dom) 367 - { 368 - struct unix_domain *udom; 369 - 370 - if (dom->flavour != &svcauth_unix) 371 - return -EINVAL; 372 - udom = container_of(dom, struct unix_domain, h); 373 - udom->addr_changes++; 374 - return 0; 375 - } 376 - EXPORT_SYMBOL_GPL(auth_unix_forget_old); 377 - 378 - struct auth_domain *auth_unix_lookup(struct net *net, struct in6_addr *addr) 379 - { 380 - struct ip_map *ipm; 381 - struct auth_domain *rv; 382 - struct sunrpc_net *sn; 383 - 384 - sn = net_generic(net, sunrpc_net_id); 385 - ipm = ip_map_lookup(net, "nfsd", addr); 386 - 387 - if (!ipm) 388 - return NULL; 389 - if (cache_check(sn->ip_map_cache, &ipm->h, NULL)) 390 - return NULL; 391 - 392 - if ((ipm->m_client->addr_changes - ipm->m_add_change) >0) { 393 - sunrpc_invalidate(&ipm->h, sn->ip_map_cache); 394 - rv = NULL; 395 - } else { 396 - rv = &ipm->m_client->h; 397 - kref_get(&rv->ref); 398 - } 399 - cache_put(&ipm->h, sn->ip_map_cache); 400 - return rv; 401 - } 402 - EXPORT_SYMBOL_GPL(auth_unix_lookup); 403 - #endif /* CONFIG_NFSD_DEPRECATED */ 404 370 405 371 void svcauth_unix_purge(void) 406 372 {