aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/dir.c3
-rw-r--r--fs/nfs/nfs4_fs.h7
-rw-r--r--fs/nfs/nfs4proc.c39
3 files changed, 48 insertions, 1 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index dffa21abd3e..5720537bffd 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -91,6 +91,9 @@ struct inode_operations nfs4_dir_inode_operations = {
91 .permission = nfs_permission, 91 .permission = nfs_permission,
92 .getattr = nfs_getattr, 92 .getattr = nfs_getattr,
93 .setattr = nfs_setattr, 93 .setattr = nfs_setattr,
94 .getxattr = nfs4_getxattr,
95 .setxattr = nfs4_setxattr,
96 .listxattr = nfs4_listxattr,
94}; 97};
95 98
96#endif /* CONFIG_NFS_V4 */ 99#endif /* CONFIG_NFS_V4 */
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 85cf3bd3692..d71f416bd9e 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -176,6 +176,13 @@ struct nfs4_state_recovery_ops {
176 176
177extern struct dentry_operations nfs4_dentry_operations; 177extern struct dentry_operations nfs4_dentry_operations;
178extern struct inode_operations nfs4_dir_inode_operations; 178extern struct inode_operations nfs4_dir_inode_operations;
179extern struct inode_operations nfs4_file_inode_operations;
180
181/* inode.c */
182extern ssize_t nfs4_getxattr(struct dentry *, const char *, void *, size_t);
183extern int nfs4_setxattr(struct dentry *, const char *, const void *, size_t, int);
184extern ssize_t nfs4_listxattr(struct dentry *, char *, size_t);
185
179 186
180/* nfs4proc.c */ 187/* nfs4proc.c */
181extern int nfs4_map_errors(int err); 188extern int nfs4_map_errors(int err);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index a5a8cb3159a..1b14d17ae9a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2732,6 +2732,34 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request)
2732 return status; 2732 return status;
2733} 2733}
2734 2734
2735
2736int nfs4_setxattr(struct dentry *dentry, const char *key, const void *buf,
2737 size_t buflen, int flags)
2738{
2739 return -EOPNOTSUPP;
2740}
2741
2742/* The getxattr man page suggests returning -ENODATA for unknown attributes,
2743 * and that's what we'll do for e.g. user attributes that haven't been set.
2744 * But we'll follow ext2/ext3's lead by returning -EOPNOTSUPP for unsupported
2745 * attributes in kernel-managed attribute namespaces. */
2746ssize_t nfs4_getxattr(struct dentry *dentry, const char *key, void *buf,
2747 size_t buflen)
2748{
2749 return -EOPNOTSUPP;
2750}
2751
2752ssize_t nfs4_listxattr(struct dentry *dentry, char *buf, size_t buflen)
2753{
2754 ssize_t len = 0;
2755
2756 if (buf && buflen < len)
2757 return -ERANGE;
2758 if (buf)
2759 memcpy(buf, "", 0);
2760 return 0;
2761}
2762
2735struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops = { 2763struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops = {
2736 .recover_open = nfs4_open_reclaim, 2764 .recover_open = nfs4_open_reclaim,
2737 .recover_lock = nfs4_lock_reclaim, 2765 .recover_lock = nfs4_lock_reclaim,
@@ -2742,11 +2770,20 @@ struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops = {
2742 .recover_lock = nfs4_lock_expired, 2770 .recover_lock = nfs4_lock_expired,
2743}; 2771};
2744 2772
2773static struct inode_operations nfs4_file_inode_operations = {
2774 .permission = nfs_permission,
2775 .getattr = nfs_getattr,
2776 .setattr = nfs_setattr,
2777 .getxattr = nfs4_getxattr,
2778 .setxattr = nfs4_setxattr,
2779 .listxattr = nfs4_listxattr,
2780};
2781
2745struct nfs_rpc_ops nfs_v4_clientops = { 2782struct nfs_rpc_ops nfs_v4_clientops = {
2746 .version = 4, /* protocol version */ 2783 .version = 4, /* protocol version */
2747 .dentry_ops = &nfs4_dentry_operations, 2784 .dentry_ops = &nfs4_dentry_operations,
2748 .dir_inode_ops = &nfs4_dir_inode_operations, 2785 .dir_inode_ops = &nfs4_dir_inode_operations,
2749 .file_inode_ops = &nfs_file_inode_operations, 2786 .file_inode_ops = &nfs4_file_inode_operations,
2750 .getroot = nfs4_proc_get_root, 2787 .getroot = nfs4_proc_get_root,
2751 .getattr = nfs4_proc_getattr, 2788 .getattr = nfs4_proc_getattr,
2752 .setattr = nfs4_proc_setattr, 2789 .setattr = nfs4_proc_setattr,