Whamcloud - gitweb
LU-13465 vfs: make ll_vfs_setxattr return -EOPNOTSUPP 01/38301/5
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 21 Apr 2020 07:28:20 +0000 (09:28 +0200)
committerOleg Drokin <green@whamcloud.com>
Thu, 7 May 2020 05:45:41 +0000 (05:45 +0000)
New compat macros ll_vfs_setxattr/ll_vfs_removexattr need to return
-EOPNOTSUPP instead of -ENOTSUPP. Indeed, the llapi_layout_get_by_fd()
code checks for "-EOPNOTSUPP" and handles this specially.

Also, the case of missing i_op->setxattr() and i_op->getxattr() can be
considered unlikely.

Test-Parameters: clientversion=2.12 envdefinitions=SANITY_EXCEPT="27M 56ra 151 156 802"
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I2474c184a1597979971881de84638fb8d281f704
Reviewed-on: https://review.whamcloud.com/38301
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_compat.h

index b9e5ca8..3db844c 100644 (file)
@@ -521,7 +521,7 @@ static inline int ll_vfs_getxattr(struct dentry *dentry, struct inode *inode,
                                  void *value, size_t size)
 {
 #ifndef HAVE_VFS_SETXATTR
-       if (!inode->i_op->getxattr)
+       if (unlikely(!inode->i_op->getxattr))
                return -ENODATA;
 
        return inode->i_op->getxattr(dentry, name, value, size);
@@ -535,8 +535,8 @@ static inline int ll_vfs_setxattr(struct dentry *dentry, struct inode *inode,
                                  const void *value, size_t size, int flags)
 {
 #ifndef HAVE_VFS_SETXATTR
-       if (!inode->i_op->setxattr)
-               return -ENOTSUPP;
+       if (unlikely(!inode->i_op->setxattr))
+               return -EOPNOTSUPP;
 
        return inode->i_op->setxattr(dentry, name, value, size, flags);
 #else
@@ -548,8 +548,8 @@ static inline int ll_vfs_removexattr(struct dentry *dentry, struct inode *inode,
                                     const char *name)
 {
 #ifndef HAVE_VFS_SETXATTR
-       if (!inode->i_op->setxattr)
-               return -ENOTSUPP;
+       if (unlikely(!inode->i_op->setxattr))
+               return -EOPNOTSUPP;
 
        return inode->i_op->removexattr(dentry, name);
 #else