diff options
-rw-r--r-- | Documentation/kernel-parameters.txt | 7 | ||||
-rw-r--r-- | fs/nfs/dir.c | 3 | ||||
-rw-r--r-- | fs/nfs/inode.c | 27 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 1 |
4 files changed, 36 insertions, 2 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 4d175c751246..83e21045114e 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1073,6 +1073,13 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1073 | [NFS] set the maximum lifetime for idmapper cache | 1073 | [NFS] set the maximum lifetime for idmapper cache |
1074 | entries. | 1074 | entries. |
1075 | 1075 | ||
1076 | nfs.enable_ino64= | ||
1077 | [NFS] enable 64-bit inode numbers. | ||
1078 | If zero, the NFS client will fake up a 32-bit inode | ||
1079 | number for the readdir() and stat() syscalls instead | ||
1080 | of returning the full 64-bit number. | ||
1081 | The default is to return 64-bit inode numbers. | ||
1082 | |||
1076 | nmi_watchdog= [KNL,BUGS=X86-32] Debugging features for SMP kernels | 1083 | nmi_watchdog= [KNL,BUGS=X86-32] Debugging features for SMP kernels |
1077 | 1084 | ||
1078 | no387 [BUGS=X86-32] Tells the kernel to use the 387 maths | 1085 | no387 [BUGS=X86-32] Tells the kernel to use the 387 maths |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index a4fdc4cc306c..8ec7fbd8240c 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -427,7 +427,8 @@ int nfs_do_filldir(nfs_readdir_descriptor_t *desc, void *dirent, | |||
427 | } | 427 | } |
428 | 428 | ||
429 | res = filldir(dirent, entry->name, entry->len, | 429 | res = filldir(dirent, entry->name, entry->len, |
430 | file->f_pos, fileid, d_type); | 430 | file->f_pos, nfs_compat_user_ino64(fileid), |
431 | d_type); | ||
431 | if (res < 0) | 432 | if (res < 0) |
432 | break; | 433 | break; |
433 | file->f_pos++; | 434 | file->f_pos++; |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index cad1246bf575..035c769b715e 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -49,6 +49,11 @@ | |||
49 | 49 | ||
50 | #define NFSDBG_FACILITY NFSDBG_VFS | 50 | #define NFSDBG_FACILITY NFSDBG_VFS |
51 | 51 | ||
52 | #define NFS_64_BIT_INODE_NUMBERS_ENABLED 1 | ||
53 | |||
54 | /* Default is to see 64-bit inode numbers */ | ||
55 | static int enable_ino64 = NFS_64_BIT_INODE_NUMBERS_ENABLED; | ||
56 | |||
52 | static void nfs_invalidate_inode(struct inode *); | 57 | static void nfs_invalidate_inode(struct inode *); |
53 | static int nfs_update_inode(struct inode *, struct nfs_fattr *); | 58 | static int nfs_update_inode(struct inode *, struct nfs_fattr *); |
54 | 59 | ||
@@ -62,6 +67,25 @@ nfs_fattr_to_ino_t(struct nfs_fattr *fattr) | |||
62 | return nfs_fileid_to_ino_t(fattr->fileid); | 67 | return nfs_fileid_to_ino_t(fattr->fileid); |
63 | } | 68 | } |
64 | 69 | ||
70 | /** | ||
71 | * nfs_compat_user_ino64 - returns the user-visible inode number | ||
72 | * @fileid: 64-bit fileid | ||
73 | * | ||
74 | * This function returns a 32-bit inode number if the boot parameter | ||
75 | * nfs.enable_ino64 is zero. | ||
76 | */ | ||
77 | u64 nfs_compat_user_ino64(u64 fileid) | ||
78 | { | ||
79 | int ino; | ||
80 | |||
81 | if (enable_ino64) | ||
82 | return fileid; | ||
83 | ino = fileid; | ||
84 | if (sizeof(ino) < sizeof(fileid)) | ||
85 | ino ^= fileid >> (sizeof(fileid)-sizeof(ino)) * 8; | ||
86 | return ino; | ||
87 | } | ||
88 | |||
65 | int nfs_write_inode(struct inode *inode, int sync) | 89 | int nfs_write_inode(struct inode *inode, int sync) |
66 | { | 90 | { |
67 | int ret; | 91 | int ret; |
@@ -456,7 +480,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
456 | err = nfs_revalidate_inode(NFS_SERVER(inode), inode); | 480 | err = nfs_revalidate_inode(NFS_SERVER(inode), inode); |
457 | if (!err) { | 481 | if (!err) { |
458 | generic_fillattr(inode, stat); | 482 | generic_fillattr(inode, stat); |
459 | stat->ino = NFS_FILEID(inode); | 483 | stat->ino = nfs_compat_user_ino64(NFS_FILEID(inode)); |
460 | } | 484 | } |
461 | return err; | 485 | return err; |
462 | } | 486 | } |
@@ -1235,6 +1259,7 @@ static void __exit exit_nfs_fs(void) | |||
1235 | /* Not quite true; I just maintain it */ | 1259 | /* Not quite true; I just maintain it */ |
1236 | MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>"); | 1260 | MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>"); |
1237 | MODULE_LICENSE("GPL"); | 1261 | MODULE_LICENSE("GPL"); |
1262 | module_param(enable_ino64, bool, 0644); | ||
1238 | 1263 | ||
1239 | module_init(init_nfs_fs) | 1264 | module_init(init_nfs_fs) |
1240 | module_exit(exit_nfs_fs) | 1265 | module_exit(exit_nfs_fs) |
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 0e0c2e0d3aa3..c5164c257f71 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h | |||
@@ -289,6 +289,7 @@ extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); | |||
289 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); | 289 | extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); |
290 | extern void put_nfs_open_context(struct nfs_open_context *ctx); | 290 | extern void put_nfs_open_context(struct nfs_open_context *ctx); |
291 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); | 291 | extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); |
292 | extern u64 nfs_compat_user_ino64(u64 fileid); | ||
292 | 293 | ||
293 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ | 294 | /* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ |
294 | extern __be32 root_nfs_parse_addr(char *name); /*__init*/ | 295 | extern __be32 root_nfs_parse_addr(char *name); /*__init*/ |