Commit 92cfc62c authored by J. Bruce Fields's avatar J. Bruce Fields Committed by Trond Myklebust

[PATCH] NFS: Allow NFS versions to support different sets of inode operations.

 ACL support will require supporting additional inode operations in v4
 (getxattr, setxattr, listxattr).  This patch allows different protocol versions
 to support different inode operations by adding a file_inode_ops to the
 nfs_rpc_ops (to match the existing dir_inode_ops).
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 464a98bd
...@@ -686,7 +686,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) ...@@ -686,7 +686,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
/* Why so? Because we want revalidate for devices/FIFOs, and /* Why so? Because we want revalidate for devices/FIFOs, and
* that's precisely what we have in nfs_file_inode_operations. * that's precisely what we have in nfs_file_inode_operations.
*/ */
inode->i_op = &nfs_file_inode_operations; inode->i_op = NFS_SB(sb)->rpc_ops->file_inode_ops;
if (S_ISREG(inode->i_mode)) { if (S_ISREG(inode->i_mode)) {
inode->i_fop = &nfs_file_operations; inode->i_fop = &nfs_file_operations;
inode->i_data.a_ops = &nfs_file_aops; inode->i_data.a_ops = &nfs_file_aops;
......
...@@ -826,6 +826,7 @@ struct nfs_rpc_ops nfs_v3_clientops = { ...@@ -826,6 +826,7 @@ struct nfs_rpc_ops nfs_v3_clientops = {
.version = 3, /* protocol version */ .version = 3, /* protocol version */
.dentry_ops = &nfs_dentry_operations, .dentry_ops = &nfs_dentry_operations,
.dir_inode_ops = &nfs_dir_inode_operations, .dir_inode_ops = &nfs_dir_inode_operations,
.file_inode_ops = &nfs_file_inode_operations,
.getroot = nfs3_proc_get_root, .getroot = nfs3_proc_get_root,
.getattr = nfs3_proc_getattr, .getattr = nfs3_proc_getattr,
.setattr = nfs3_proc_setattr, .setattr = nfs3_proc_setattr,
......
...@@ -2746,6 +2746,7 @@ struct nfs_rpc_ops nfs_v4_clientops = { ...@@ -2746,6 +2746,7 @@ struct nfs_rpc_ops nfs_v4_clientops = {
.version = 4, /* protocol version */ .version = 4, /* protocol version */
.dentry_ops = &nfs4_dentry_operations, .dentry_ops = &nfs4_dentry_operations,
.dir_inode_ops = &nfs4_dir_inode_operations, .dir_inode_ops = &nfs4_dir_inode_operations,
.file_inode_ops = &nfs_file_inode_operations,
.getroot = nfs4_proc_get_root, .getroot = nfs4_proc_get_root,
.getattr = nfs4_proc_getattr, .getattr = nfs4_proc_getattr,
.setattr = nfs4_proc_setattr, .setattr = nfs4_proc_setattr,
......
...@@ -622,6 +622,7 @@ struct nfs_rpc_ops nfs_v2_clientops = { ...@@ -622,6 +622,7 @@ struct nfs_rpc_ops nfs_v2_clientops = {
.version = 2, /* protocol version */ .version = 2, /* protocol version */
.dentry_ops = &nfs_dentry_operations, .dentry_ops = &nfs_dentry_operations,
.dir_inode_ops = &nfs_dir_inode_operations, .dir_inode_ops = &nfs_dir_inode_operations,
.file_inode_ops = &nfs_file_inode_operations,
.getroot = nfs_proc_get_root, .getroot = nfs_proc_get_root,
.getattr = nfs_proc_getattr, .getattr = nfs_proc_getattr,
.setattr = nfs_proc_setattr, .setattr = nfs_proc_setattr,
......
...@@ -667,6 +667,7 @@ struct nfs_rpc_ops { ...@@ -667,6 +667,7 @@ struct nfs_rpc_ops {
int version; /* Protocol version */ int version; /* Protocol version */
struct dentry_operations *dentry_ops; struct dentry_operations *dentry_ops;
struct inode_operations *dir_inode_ops; struct inode_operations *dir_inode_ops;
struct inode_operations *file_inode_ops;
int (*getroot) (struct nfs_server *, struct nfs_fh *, int (*getroot) (struct nfs_server *, struct nfs_fh *,
struct nfs_fsinfo *); struct nfs_fsinfo *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment