aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2016-09-29 11:48:44 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-10-07 20:10:44 -0400
commit6c6ef9f26e598fb977f60935e109cd5b266c941a (patch)
treeee583d1c81a7f2e3380cc71108f033ff961649eb /Documentation/filesystems
parentbf3ee71363c0b44acb62f375aea470262ac4210a (diff)
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 <agruenba@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r--Documentation/filesystems/Locking24
-rw-r--r--Documentation/filesystems/vfs.txt45
2 files changed, 48 insertions, 21 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index d30fb2cb5066..f56b39ee2e54 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -61,10 +61,7 @@ prototypes:
61 int (*get_acl)(struct inode *, int); 61 int (*get_acl)(struct inode *, int);
62 int (*setattr) (struct dentry *, struct iattr *); 62 int (*setattr) (struct dentry *, struct iattr *);
63 int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *); 63 int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *);
64 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
65 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
66 ssize_t (*listxattr) (struct dentry *, char *, size_t); 64 ssize_t (*listxattr) (struct dentry *, char *, size_t);
67 int (*removexattr) (struct dentry *, const char *);
68 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len); 65 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len);
69 void (*update_time)(struct inode *, struct timespec *, int); 66 void (*update_time)(struct inode *, struct timespec *, int);
70 int (*atomic_open)(struct inode *, struct dentry *, 67 int (*atomic_open)(struct inode *, struct dentry *,
@@ -91,15 +88,13 @@ setattr: yes
91permission: no (may not block if called in rcu-walk mode) 88permission: no (may not block if called in rcu-walk mode)
92get_acl: no 89get_acl: no
93getattr: no 90getattr: no
94setxattr: yes
95getxattr: no
96listxattr: no 91listxattr: no
97removexattr: yes
98fiemap: no 92fiemap: no
99update_time: no 93update_time: no
100atomic_open: yes 94atomic_open: yes
101tmpfile: no 95tmpfile: no
102 96
97
103 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on 98 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
104victim. 99victim.
105 cross-directory ->rename() and rename2() has (per-superblock) 100 cross-directory ->rename() and rename2() has (per-superblock)
@@ -108,6 +103,23 @@ victim.
108See Documentation/filesystems/directory-locking for more detailed discussion 103See Documentation/filesystems/directory-locking for more detailed discussion
109of the locking scheme for directory operations. 104of the locking scheme for directory operations.
110 105
106----------------------- xattr_handler operations -----------------------
107prototypes:
108 bool (*list)(struct dentry *dentry);
109 int (*get)(const struct xattr_handler *handler, struct dentry *dentry,
110 struct inode *inode, const char *name, void *buffer,
111 size_t size);
112 int (*set)(const struct xattr_handler *handler, struct dentry *dentry,
113 struct inode *inode, const char *name, const void *buffer,
114 size_t size, int flags);
115
116locking rules:
117 all may block
118 i_mutex(inode)
119list: no
120get: no
121set: yes
122
111--------------------------- super_operations --------------------------- 123--------------------------- super_operations ---------------------------
112prototypes: 124prototypes:
113 struct inode *(*alloc_inode)(struct super_block *sb); 125 struct inode *(*alloc_inode)(struct super_block *sb);
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 9ace359d6cc5..2c9b29e5b09d 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -323,6 +323,35 @@ Whoever sets up the inode is responsible for filling in the "i_op" field. This
323is a pointer to a "struct inode_operations" which describes the methods that 323is a pointer to a "struct inode_operations" which describes the methods that
324can be performed on individual inodes. 324can be performed on individual inodes.
325 325
326struct xattr_handlers
327---------------------
328
329On filesystems that support extended attributes (xattrs), the s_xattr
330superblock field points to a NULL-terminated array of xattr handlers. Extended
331attributes are name:value pairs.
332
333 name: Indicates that the handler matches attributes with the specified name
334 (such as "system.posix_acl_access"); the prefix field must be NULL.
335
336 prefix: Indicates that the handler matches all attributes with the specified
337 name prefix (such as "user."); the name field must be NULL.
338
339 list: Determine if attributes matching this xattr handler should be listed
340 for a particular dentry. Used by some listxattr implementations like
341 generic_listxattr.
342
343 get: Called by the VFS to get the value of a particular extended attribute.
344 This method is called by the getxattr(2) system call.
345
346 set: Called by the VFS to set the value of a particular extended attribute.
347 When the new value is NULL, called to remove a particular extended
348 attribute. This method is called by the the setxattr(2) and
349 removexattr(2) system calls.
350
351When none of the xattr handlers of a filesystem match the specified attribute
352name or when a filesystem doesn't support extended attributes, the various
353*xattr(2) system calls return -EOPNOTSUPP.
354
326 355
327The Inode Object 356The Inode Object
328================ 357================
@@ -356,10 +385,7 @@ struct inode_operations {
356 int (*get_acl)(struct inode *, int); 385 int (*get_acl)(struct inode *, int);
357 int (*setattr) (struct dentry *, struct iattr *); 386 int (*setattr) (struct dentry *, struct iattr *);
358 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *); 387 int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
359 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
360 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
361 ssize_t (*listxattr) (struct dentry *, char *, size_t); 388 ssize_t (*listxattr) (struct dentry *, char *, size_t);
362 int (*removexattr) (struct dentry *, const char *);
363 void (*update_time)(struct inode *, struct timespec *, int); 389 void (*update_time)(struct inode *, struct timespec *, int);
364 int (*atomic_open)(struct inode *, struct dentry *, struct file *, 390 int (*atomic_open)(struct inode *, struct dentry *, struct file *,
365 unsigned open_flag, umode_t create_mode, int *opened); 391 unsigned open_flag, umode_t create_mode, int *opened);
@@ -463,19 +489,8 @@ otherwise noted.
463 getattr: called by the VFS to get attributes of a file. This method 489 getattr: called by the VFS to get attributes of a file. This method
464 is called by stat(2) and related system calls. 490 is called by stat(2) and related system calls.
465 491
466 setxattr: called by the VFS to set an extended attribute for a file.
467 Extended attribute is a name:value pair associated with an
468 inode. This method is called by setxattr(2) system call.
469
470 getxattr: called by the VFS to retrieve the value of an extended
471 attribute name. This method is called by getxattr(2) function
472 call.
473
474 listxattr: called by the VFS to list all extended attributes for a 492 listxattr: called by the VFS to list all extended attributes for a
475 given file. This method is called by listxattr(2) system call. 493 given file. This method is called by the listxattr(2) system call.
476
477 removexattr: called by the VFS to remove an extended attribute from
478 a file. This method is called by removexattr(2) system call.
479 494
480 update_time: called by the VFS to update a specific time or the i_version of 495 update_time: called by the VFS to update a specific time or the i_version of
481 an inode. If this is not defined the VFS will update the inode itself 496 an inode. If this is not defined the VFS will update the inode itself