Whamcloud - gitweb
LU-10788 llite: pass flags through __vfs_setxattr() 93/31593/3
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 8 Mar 2018 19:23:34 +0000 (13:23 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 9 Apr 2018 19:49:52 +0000 (19:49 +0000)
In the compat definition of __vfs_setxattr() pass the flags we
received down to the handler. For consistency with upstream return
-EOPNOTSUPP if no handler could be found.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I78b88d1521dd000e328f1add1a6159c70d16f5a7
Reviewed-on: https://review.whamcloud.com/31593
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
lustre/include/lustre_compat.h

index 37cca5a..937935d 100644 (file)
@@ -468,37 +468,30 @@ int ll_removexattr(struct dentry *dentry, const char *name);
 #ifndef HAVE_VFS_SETXATTR
 const struct xattr_handler *get_xattr_type(const char *name);
 
-#ifdef HAVE_XATTR_HANDLER_FLAGS
 static inline int
 __vfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
               const void *value, size_t size, int flags)
 {
+# ifdef HAVE_XATTR_HANDLER_FLAGS
        const struct xattr_handler *handler;
        int rc;
 
        handler = get_xattr_type(name);
        if (!handler)
-               return -ENXIO;
-
-#if defined(HAVE_XATTR_HANDLER_INODE_PARAM)
-       rc = handler->set(handler, dentry, inode, name, value, size,
-                         XATTR_CREATE);
-#elif defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
-       rc = handler->set(handler, dentry, name, value, size, XATTR_CREATE);
-#else
-       rc = handler->set(dentry, name, value, size, XATTR_CREATE,
-                         handler->flags);
-#endif /* !HAVE_XATTR_HANDLER_INODE_PARAM */
+               return -EOPNOTSUPP;
+
+#  if defined(HAVE_XATTR_HANDLER_INODE_PARAM)
+       rc = handler->set(handler, dentry, inode, name, value, size, flags);
+#  elif defined(HAVE_XATTR_HANDLER_SIMPLIFIED)
+       rc = handler->set(handler, dentry, name, value, size, flags);
+#  else
+       rc = handler->set(dentry, name, value, size, flags, handler->flags);
+#  endif /* !HAVE_XATTR_HANDLER_INODE_PARAM */
        return rc;
-}
-#else /* !HAVE_XATTR_HANDLER_FLAGS */
-static inline int
-__vfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name,
-              const void *value, size_t size, int flags)
-{
+# else /* !HAVE_XATTR_HANDLER_FLAGS */
        return ll_setxattr(dentry, name, value, size, flags);
+# endif /* HAVE_XATTR_HANDLER_FLAGS */
 }
-#endif /* HAVE_XATTR_HANDLER_FLAGS */
 #endif /* HAVE_VFS_SETXATTR */
 
 #ifdef HAVE_IOP_SET_ACL