From 6c6ef9f26e598fb977f60935e109cd5b266c941a Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Thu, 29 Sep 2016 17:48:44 +0200 Subject: xattr: Stop calling {get,set,remove}xattr inode operations All filesystems that support xattrs by now do so via xattr handlers. They all define sb->s_xattr, and their getxattr, setxattr, and removexattr inode operations use the generic inode operations. On filesystems that don't support xattrs, the xattr inode operations are all NULL, and sb->s_xattr is also NULL. This means that we can remove the getxattr, setxattr, and removexattr inode operations and directly call the generic handlers, or better, inline expand those handlers into fs/xattr.c. Filesystems that do not support xattrs on some inodes should clear the IOP_XATTR i_opflags flag in those inodes. (Right now, some filesystems have checks to disable xattrs on some inodes in the ->list, ->get, and ->set xattr handler operations instead.) The IOP_XATTR flag is automatically cleared in inodes of filesystems that don't have xattr support. In orangefs, symlinks do have a setxattr iop but no getxattr iop. Add a check for symlinks to orangefs_inode_getxattr to preserve the current, weird behavior; that check may not be necessary though. Signed-off-by: Andreas Gruenbacher Signed-off-by: Al Viro --- fs/orangefs/xattr.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fs/orangefs') diff --git a/fs/orangefs/xattr.c b/fs/orangefs/xattr.c index 2a9f07f06d10..74a81b1daaac 100644 --- a/fs/orangefs/xattr.c +++ b/fs/orangefs/xattr.c @@ -73,6 +73,9 @@ ssize_t orangefs_inode_getxattr(struct inode *inode, const char *name, "%s: name %s, buffer_size %zd\n", __func__, name, size); + if (S_ISLNK(inode->i_mode)) + return -EOPNOTSUPP; + if (strlen(name) >= ORANGEFS_MAX_XATTR_NAMELEN) { gossip_err("Invalid key length (%d)\n", (int)strlen(name)); -- cgit v1.2.3 From fd50ecaddf8372a1d96e0daeaac0f93cf04e4d42 Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Thu, 29 Sep 2016 17:48:45 +0200 Subject: vfs: Remove {get,set,remove}xattr inode operations These inode operations are no longer used; remove them. Signed-off-by: Andreas Gruenbacher Signed-off-by: Al Viro --- fs/orangefs/inode.c | 3 --- fs/orangefs/namei.c | 3 --- fs/orangefs/symlink.c | 1 - 3 files changed, 7 deletions(-) (limited to 'fs/orangefs') diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 28a0557a69be..a9407eeecb21 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -296,10 +296,7 @@ const struct inode_operations orangefs_file_inode_operations = { .set_acl = orangefs_set_acl, .setattr = orangefs_setattr, .getattr = orangefs_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, .listxattr = orangefs_listxattr, - .removexattr = generic_removexattr, .permission = orangefs_permission, }; diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c index 62c525936ee8..ccca5186d5cd 100644 --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c @@ -462,9 +462,6 @@ const struct inode_operations orangefs_dir_inode_operations = { .rename = orangefs_rename, .setattr = orangefs_setattr, .getattr = orangefs_getattr, - .setxattr = generic_setxattr, - .getxattr = generic_getxattr, - .removexattr = generic_removexattr, .listxattr = orangefs_listxattr, .permission = orangefs_permission, }; diff --git a/fs/orangefs/symlink.c b/fs/orangefs/symlink.c index 8fecf823f5ba..10b0b06e075e 100644 --- a/fs/orangefs/symlink.c +++ b/fs/orangefs/symlink.c @@ -14,6 +14,5 @@ const struct inode_operations orangefs_symlink_inode_operations = { .setattr = orangefs_setattr, .getattr = orangefs_getattr, .listxattr = orangefs_listxattr, - .setxattr = generic_setxattr, .permission = orangefs_permission, }; -- cgit v1.2.3