Whamcloud - gitweb
LU-15811 llite: Unify range unlock
[fs/lustre-release.git] / lustre / llite / xattr_security.c
index f1c1ed9..3993700 100644 (file)
@@ -75,7 +75,13 @@ int ll_dentry_init_security(struct dentry *dentry, int mode, struct qstr *name,
 
        rc = security_dentry_init_security(dentry, mode, name, secctx,
                                           secctx_size);
-       if (rc == -EOPNOTSUPP)
+       /* Usually, security_dentry_init_security() returns -EOPNOTSUPP when
+        * SELinux is disabled.
+        * But on some kernels (e.g. rhel 8.5) it returns 0 when SELinux is
+        * disabled, and in this case the security context is empty.
+        */
+       if (rc == -EOPNOTSUPP || (rc == 0 && *secctx_size == 0))
+               /* do nothing */
                return 0;
        if (rc < 0)
                return rc;
@@ -115,8 +121,8 @@ ll_initxattrs(struct inode *inode, const struct xattr *xattr_array,
                        break;
                }
 
-               err = __vfs_setxattr(dentry, inode, full_name, xattr->value,
-                                    xattr->value_len, XATTR_CREATE);
+               err = ll_vfs_setxattr(dentry, inode, full_name, xattr->value,
+                                     xattr->value_len, XATTR_CREATE);
                kfree(full_name);
                if (err < 0)
                        break;