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

NFS: Convert v2 into a module

The module (nfs2.ko) will be created in the same directory as nfs.ko and
will be automatically loaded the first time you try to mount over NFS v2.

Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

authored by

Bryan Schumaker and committed by
Trond Myklebust
ddda8e0a fac1e8e4

+50 -24
+1 -1
fs/nfs/Kconfig
··· 30 30 If unsure, say N. 31 31 32 32 config NFS_V2 33 - bool "NFS client support for NFS version 2" 33 + tristate "NFS client support for NFS version 2" 34 34 depends on NFS_FS 35 35 default y 36 36 help
+3 -1
fs/nfs/Makefile
··· 9 9 write.o namespace.o mount_clnt.o \ 10 10 dns_resolve.o cache_lib.o 11 11 nfs-$(CONFIG_ROOT_NFS) += nfsroot.o 12 - nfs-$(CONFIG_NFS_V2) += nfs2super.o proc.o nfs2xdr.o 13 12 nfs-$(CONFIG_NFS_V3) += nfs3super.o nfs3client.o nfs3proc.o nfs3xdr.o 14 13 nfs-$(CONFIG_NFS_V3_ACL) += nfs3acl.o 15 14 nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \ ··· 23 24 endif 24 25 25 26 nfs-$(CONFIG_NFS_FSCACHE) += fscache.o fscache-index.o 27 + 28 + obj-$(CONFIG_NFS_V2) += nfs2.o 29 + nfs2-y := nfs2super.o proc.o nfs2xdr.o 26 30 27 31 obj-$(CONFIG_PNFS_FILE_LAYOUT) += nfs_layout_nfsv41_files.o 28 32 nfs_layout_nfsv41_files-y := nfs4filelayout.o nfs4filelayoutdev.o
+6 -6
fs/nfs/client.c
··· 149 149 */ 150 150 int __init nfs_register_versions(void) 151 151 { 152 - int err = init_nfs_v2(); 153 - if (err) 154 - return err; 155 - 156 - err = init_nfs_v3(); 152 + int err = init_nfs_v3(); 157 153 if (err) 158 154 return err; 159 155 ··· 161 165 */ 162 166 void nfs_unregister_versions(void) 163 167 { 164 - exit_nfs_v2(); 165 168 exit_nfs_v3(); 166 169 exit_nfs_v4(); 167 170 } ··· 217 222 error_0: 218 223 return ERR_PTR(err); 219 224 } 225 + EXPORT_SYMBOL_GPL(nfs_alloc_client); 220 226 221 227 #ifdef CONFIG_NFS_V4 222 228 /* idr_remove_all is not needed as all id's are removed by nfs_put_client */ ··· 280 284 281 285 dprintk("<-- nfs_free_client()\n"); 282 286 } 287 + EXPORT_SYMBOL_GPL(nfs_free_client); 283 288 284 289 /* 285 290 * Release a reference to a shared client record ··· 750 753 dprintk("<-- nfs_init_client() = xerror %d\n", error); 751 754 return ERR_PTR(error); 752 755 } 756 + EXPORT_SYMBOL_GPL(nfs_init_client); 753 757 754 758 /* 755 759 * Create a version 2 or 3 client ··· 1120 1122 nfs_free_server(server); 1121 1123 return ERR_PTR(error); 1122 1124 } 1125 + EXPORT_SYMBOL_GPL(nfs_create_server); 1123 1126 1124 1127 /* 1125 1128 * Clone an NFS2, NFS3 or NFS4 server record ··· 1190 1191 dprintk("<-- nfs_clone_server() = error %d\n", error); 1191 1192 return ERR_PTR(error); 1192 1193 } 1194 + EXPORT_SYMBOL_GPL(nfs_clone_server); 1193 1195 1194 1196 void nfs_clients_init(struct net *net) 1195 1197 {
+13
fs/nfs/dir.c
··· 17 17 * 6 Jun 1999 Cache readdir lookups in the page cache. -DaveM 18 18 */ 19 19 20 + #include <linux/module.h> 20 21 #include <linux/time.h> 21 22 #include <linux/errno.h> 22 23 #include <linux/stat.h> ··· 1197 1196 .d_automount = nfs_d_automount, 1198 1197 .d_release = nfs_d_release, 1199 1198 }; 1199 + EXPORT_SYMBOL_GPL(nfs_dentry_operations); 1200 1200 1201 1201 struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags) 1202 1202 { ··· 1265 1263 nfs_free_fhandle(fhandle); 1266 1264 return res; 1267 1265 } 1266 + EXPORT_SYMBOL_GPL(nfs_lookup); 1268 1267 1269 1268 #ifdef CONFIG_NFS_V4 1270 1269 static int nfs4_lookup_revalidate(struct dentry *, unsigned int); ··· 1511 1508 dput(parent); 1512 1509 return error; 1513 1510 } 1511 + EXPORT_SYMBOL_GPL(nfs_instantiate); 1514 1512 1515 1513 /* 1516 1514 * Following a failed create operation, we drop the dentry rather ··· 1540 1536 d_drop(dentry); 1541 1537 return error; 1542 1538 } 1539 + EXPORT_SYMBOL_GPL(nfs_create); 1543 1540 1544 1541 /* 1545 1542 * See comments for nfs_proc_create regarding failed operations. ··· 1568 1563 d_drop(dentry); 1569 1564 return status; 1570 1565 } 1566 + EXPORT_SYMBOL_GPL(nfs_mknod); 1571 1567 1572 1568 /* 1573 1569 * See comments for nfs_proc_create regarding failed operations. ··· 1592 1586 d_drop(dentry); 1593 1587 return error; 1594 1588 } 1589 + EXPORT_SYMBOL_GPL(nfs_mkdir); 1595 1590 1596 1591 static void nfs_dentry_handle_enoent(struct dentry *dentry) 1597 1592 { ··· 1616 1609 1617 1610 return error; 1618 1611 } 1612 + EXPORT_SYMBOL_GPL(nfs_rmdir); 1619 1613 1620 1614 /* 1621 1615 * Remove a file after making sure there are no pending writes, ··· 1688 1680 d_rehash(dentry); 1689 1681 return error; 1690 1682 } 1683 + EXPORT_SYMBOL_GPL(nfs_unlink); 1691 1684 1692 1685 /* 1693 1686 * To create a symbolic link, most file systems instantiate a new inode, ··· 1759 1750 1760 1751 return 0; 1761 1752 } 1753 + EXPORT_SYMBOL_GPL(nfs_symlink); 1762 1754 1763 1755 int 1764 1756 nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) ··· 1781 1771 } 1782 1772 return error; 1783 1773 } 1774 + EXPORT_SYMBOL_GPL(nfs_link); 1784 1775 1785 1776 /* 1786 1777 * RENAME ··· 1880 1869 dput(dentry); 1881 1870 return error; 1882 1871 } 1872 + EXPORT_SYMBOL_GPL(nfs_rename); 1883 1873 1884 1874 static DEFINE_SPINLOCK(nfs_access_lru_lock); 1885 1875 static LIST_HEAD(nfs_access_lru_list); ··· 2200 2188 res = generic_permission(inode, mask); 2201 2189 goto out; 2202 2190 } 2191 + EXPORT_SYMBOL_GPL(nfs_permission); 2203 2192 2204 2193 /* 2205 2194 * Local variables:
+2
fs/nfs/file.c
··· 16 16 * nfs regular file handling functions 17 17 */ 18 18 19 + #include <linux/module.h> 19 20 #include <linux/time.h> 20 21 #include <linux/kernel.h> 21 22 #include <linux/errno.h> ··· 866 865 .check_flags = nfs_check_flags, 867 866 .setlease = nfs_setlease, 868 867 }; 868 + EXPORT_SYMBOL_GPL(nfs_file_operations);
+10
fs/nfs/inode.c
··· 193 193 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATIME; 194 194 spin_unlock(&inode->i_lock); 195 195 } 196 + EXPORT_SYMBOL_GPL(nfs_invalidate_atime); 196 197 197 198 /* 198 199 * Invalidate, but do not unhash, the inode. ··· 439 438 out: 440 439 return error; 441 440 } 441 + EXPORT_SYMBOL_GPL(nfs_setattr); 442 442 443 443 /** 444 444 * nfs_vmtruncate - unmap mappings "freed" by truncate() syscall ··· 498 496 nfs_vmtruncate(inode, attr->ia_size); 499 497 } 500 498 } 499 + EXPORT_SYMBOL_GPL(nfs_setattr_update_inode); 501 500 502 501 int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 503 502 { ··· 538 535 out: 539 536 return err; 540 537 } 538 + EXPORT_SYMBOL_GPL(nfs_getattr); 541 539 542 540 static void nfs_init_lock_context(struct nfs_lock_context *l_ctx) 543 541 { ··· 627 623 return; 628 624 nfs_revalidate_inode(server, inode); 629 625 } 626 + EXPORT_SYMBOL_GPL(nfs_close_context); 630 627 631 628 struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode) 632 629 { ··· 1033 1028 fattr->owner_name = NULL; 1034 1029 fattr->group_name = NULL; 1035 1030 } 1031 + EXPORT_SYMBOL_GPL(nfs_fattr_init); 1036 1032 1037 1033 struct nfs_fattr *nfs_alloc_fattr(void) 1038 1034 { ··· 1044 1038 nfs_fattr_init(fattr); 1045 1039 return fattr; 1046 1040 } 1041 + EXPORT_SYMBOL_GPL(nfs_alloc_fattr); 1047 1042 1048 1043 struct nfs_fh *nfs_alloc_fhandle(void) 1049 1044 { ··· 1055 1048 fh->size = 0; 1056 1049 return fh; 1057 1050 } 1051 + EXPORT_SYMBOL_GPL(nfs_alloc_fhandle); 1058 1052 1059 1053 #ifdef NFS_DEBUG 1060 1054 /* ··· 1176 1168 1177 1169 return status; 1178 1170 } 1171 + EXPORT_SYMBOL_GPL(nfs_refresh_inode); 1179 1172 1180 1173 static int nfs_post_op_update_inode_locked(struct inode *inode, struct nfs_fattr *fattr) 1181 1174 { ··· 1264 1255 spin_unlock(&inode->i_lock); 1265 1256 return status; 1266 1257 } 1258 + EXPORT_SYMBOL_GPL(nfs_post_op_update_inode_force_wcc); 1267 1259 1268 1260 /* 1269 1261 * Many nfs protocol calls return the new file attributes after
+2
fs/nfs/namespace.c
··· 7 7 * NFS namespace 8 8 */ 9 9 10 + #include <linux/module.h> 10 11 #include <linux/dcache.h> 11 12 #include <linux/gfp.h> 12 13 #include <linux/mount.h> ··· 256 255 257 256 return nfs_do_submount(dentry, fh, fattr, server->client->cl_auth->au_flavor); 258 257 } 258 + EXPORT_SYMBOL_GPL(nfs_submount);
-14
fs/nfs/nfs.h
··· 24 24 int nfs_register_versions(void); 25 25 void nfs_unregister_versions(void); 26 26 27 - #ifdef CONFIG_NFS_V2 28 - int init_nfs_v2(void); 29 - void exit_nfs_v2(void); 30 - #else /* CONFIG_NFS_V2 */ 31 - static inline int __init init_nfs_v2(void) 32 - { 33 - return 0; 34 - } 35 - 36 - static inline void exit_nfs_v2(void) 37 - { 38 - } 39 - #endif /* CONFIG_NFS_V2 */ 40 - 41 27 #ifdef CONFIG_NFS_V3 42 28 int init_nfs_v3(void); 43 29 void exit_nfs_v3(void);
+7 -2
fs/nfs/nfs2super.c
··· 14 14 .sops = &nfs_sops, 15 15 }; 16 16 17 - int __init init_nfs_v2(void) 17 + static int __init init_nfs_v2(void) 18 18 { 19 19 register_nfs_version(&nfs_v2); 20 20 return 0; 21 21 } 22 22 23 - void exit_nfs_v2(void) 23 + static void __exit exit_nfs_v2(void) 24 24 { 25 25 unregister_nfs_version(&nfs_v2); 26 26 } 27 + 28 + MODULE_LICENSE("GPL"); 29 + 30 + module_init(init_nfs_v2); 31 + module_exit(exit_nfs_v2);
+1
fs/nfs/read.c
··· 113 113 nfs_pageio_init(pgio, inode, &nfs_pageio_read_ops, compl_ops, 114 114 NFS_SERVER(inode)->rsize, 0); 115 115 } 116 + EXPORT_SYMBOL_GPL(nfs_pageio_init_read); 116 117 117 118 void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio) 118 119 {
+3
fs/nfs/super.c
··· 289 289 .kill_sb = nfs_kill_super, 290 290 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 291 291 }; 292 + EXPORT_SYMBOL_GPL(nfs_fs_type); 292 293 293 294 struct file_system_type nfs_xdev_fs_type = { 294 295 .owner = THIS_MODULE, ··· 313 312 .show_stats = nfs_show_stats, 314 313 .remount_fs = nfs_remount, 315 314 }; 315 + EXPORT_SYMBOL_GPL(nfs_sops); 316 316 317 317 #ifdef CONFIG_NFS_V4 318 318 static void nfs4_validate_mount_flags(struct nfs_parsed_mount_data *); ··· 1672 1670 1673 1671 return nfs_fs_mount_common(server, flags, dev_name, mount_info, nfs_mod); 1674 1672 } 1673 + EXPORT_SYMBOL_GPL(nfs_try_mount); 1675 1674 1676 1675 /* 1677 1676 * Split "dev_name" into "hostname:export_path".
+2
fs/nfs/write.c
··· 1210 1210 nfs_pageio_init(pgio, inode, &nfs_pageio_write_ops, compl_ops, 1211 1211 NFS_SERVER(inode)->wsize, ioflags); 1212 1212 } 1213 + EXPORT_SYMBOL_GPL(nfs_pageio_init_write); 1213 1214 1214 1215 void nfs_pageio_reset_write_mds(struct nfs_pageio_descriptor *pgio) 1215 1216 { ··· 1689 1688 1690 1689 return sync_inode(inode, &wbc); 1691 1690 } 1691 + EXPORT_SYMBOL_GPL(nfs_wb_all); 1692 1692 1693 1693 int nfs_wb_page_cancel(struct inode *inode, struct page *page) 1694 1694 {