These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / fs / ocfs2 / xattr.c
index d03bfbf..e9164f0 100644 (file)
@@ -499,30 +499,24 @@ static int ocfs2_validate_xattr_block(struct super_block *sb,
         */
 
        if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) {
-               ocfs2_error(sb,
-                           "Extended attribute block #%llu has bad "
-                           "signature %.*s",
-                           (unsigned long long)bh->b_blocknr, 7,
-                           xb->xb_signature);
-               return -EINVAL;
+               return ocfs2_error(sb,
+                                  "Extended attribute block #%llu has bad signature %.*s\n",
+                                  (unsigned long long)bh->b_blocknr, 7,
+                                  xb->xb_signature);
        }
 
        if (le64_to_cpu(xb->xb_blkno) != bh->b_blocknr) {
-               ocfs2_error(sb,
-                           "Extended attribute block #%llu has an "
-                           "invalid xb_blkno of %llu",
-                           (unsigned long long)bh->b_blocknr,
-                           (unsigned long long)le64_to_cpu(xb->xb_blkno));
-               return -EINVAL;
+               return ocfs2_error(sb,
+                                  "Extended attribute block #%llu has an invalid xb_blkno of %llu\n",
+                                  (unsigned long long)bh->b_blocknr,
+                                  (unsigned long long)le64_to_cpu(xb->xb_blkno));
        }
 
        if (le32_to_cpu(xb->xb_fs_generation) != OCFS2_SB(sb)->fs_generation) {
-               ocfs2_error(sb,
-                           "Extended attribute block #%llu has an invalid "
-                           "xb_fs_generation of #%u",
-                           (unsigned long long)bh->b_blocknr,
-                           le32_to_cpu(xb->xb_fs_generation));
-               return -EINVAL;
+               return ocfs2_error(sb,
+                                  "Extended attribute block #%llu has an invalid xb_fs_generation of #%u\n",
+                                  (unsigned long long)bh->b_blocknr,
+                                  le32_to_cpu(xb->xb_fs_generation));
        }
 
        return 0;
@@ -3694,11 +3688,10 @@ static int ocfs2_xattr_get_rec(struct inode *inode,
                el = &eb->h_list;
 
                if (el->l_tree_depth) {
-                       ocfs2_error(inode->i_sb,
-                                   "Inode %lu has non zero tree depth in "
-                                   "xattr tree block %llu\n", inode->i_ino,
-                                   (unsigned long long)eb_bh->b_blocknr);
-                       ret = -EROFS;
+                       ret = ocfs2_error(inode->i_sb,
+                                         "Inode %lu has non zero tree depth in xattr tree block %llu\n",
+                                         inode->i_ino,
+                                         (unsigned long long)eb_bh->b_blocknr);
                        goto out;
                }
        }
@@ -3713,11 +3706,10 @@ static int ocfs2_xattr_get_rec(struct inode *inode,
        }
 
        if (!e_blkno) {
-               ocfs2_error(inode->i_sb, "Inode %lu has bad extent "
-                           "record (%u, %u, 0) in xattr", inode->i_ino,
-                           le32_to_cpu(rec->e_cpos),
-                           ocfs2_rec_clusters(el, rec));
-               ret = -EROFS;
+               ret = ocfs2_error(inode->i_sb, "Inode %lu has bad extent record (%u, %u, 0) in xattr\n",
+                                 inode->i_ino,
+                                 le32_to_cpu(rec->e_cpos),
+                                 ocfs2_rec_clusters(el, rec));
                goto out;
        }
 
@@ -7237,9 +7229,10 @@ leave:
 /*
  * 'security' attributes support
  */
-static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list,
+static size_t ocfs2_xattr_security_list(const struct xattr_handler *handler,
+                                       struct dentry *dentry, char *list,
                                        size_t list_size, const char *name,
-                                       size_t name_len, int type)
+                                       size_t name_len)
 {
        const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN;
        const size_t total_len = prefix_len + name_len + 1;
@@ -7252,8 +7245,9 @@ static size_t ocfs2_xattr_security_list(struct dentry *dentry, char *list,
        return total_len;
 }
 
-static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name,
-                                   void *buffer, size_t size, int type)
+static int ocfs2_xattr_security_get(const struct xattr_handler *handler,
+                                   struct dentry *dentry, const char *name,
+                                   void *buffer, size_t size)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -7261,8 +7255,9 @@ static int ocfs2_xattr_security_get(struct dentry *dentry, const char *name,
                               name, buffer, size);
 }
 
-static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+static int ocfs2_xattr_security_set(const struct xattr_handler *handler,
+                                   struct dentry *dentry, const char *name,
+                                   const void *value, size_t size, int flags)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -7271,7 +7266,7 @@ static int ocfs2_xattr_security_set(struct dentry *dentry, const char *name,
                               name, value, size, flags);
 }
 
-int ocfs2_initxattrs(struct inode *inode, const struct xattr *xattr_array,
+static int ocfs2_initxattrs(struct inode *inode, const struct xattr *xattr_array,
                     void *fs_info)
 {
        const struct xattr *xattr;
@@ -7327,13 +7322,17 @@ const struct xattr_handler ocfs2_xattr_security_handler = {
 /*
  * 'trusted' attributes support
  */
-static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list,
+static size_t ocfs2_xattr_trusted_list(const struct xattr_handler *handler,
+                                      struct dentry *dentry, char *list,
                                       size_t list_size, const char *name,
-                                      size_t name_len, int type)
+                                      size_t name_len)
 {
        const size_t prefix_len = XATTR_TRUSTED_PREFIX_LEN;
        const size_t total_len = prefix_len + name_len + 1;
 
+       if (!capable(CAP_SYS_ADMIN))
+               return 0;
+
        if (list && total_len <= list_size) {
                memcpy(list, XATTR_TRUSTED_PREFIX, prefix_len);
                memcpy(list + prefix_len, name, name_len);
@@ -7342,8 +7341,9 @@ static size_t ocfs2_xattr_trusted_list(struct dentry *dentry, char *list,
        return total_len;
 }
 
-static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name,
-               void *buffer, size_t size, int type)
+static int ocfs2_xattr_trusted_get(const struct xattr_handler *handler,
+                                  struct dentry *dentry, const char *name,
+                                  void *buffer, size_t size)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -7351,8 +7351,9 @@ static int ocfs2_xattr_trusted_get(struct dentry *dentry, const char *name,
                               name, buffer, size);
 }
 
-static int ocfs2_xattr_trusted_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+static int ocfs2_xattr_trusted_set(const struct xattr_handler *handler,
+                                  struct dentry *dentry, const char *name,
+                                  const void *value, size_t size, int flags)
 {
        if (strcmp(name, "") == 0)
                return -EINVAL;
@@ -7371,9 +7372,10 @@ const struct xattr_handler ocfs2_xattr_trusted_handler = {
 /*
  * 'user' attributes support
  */
-static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list,
+static size_t ocfs2_xattr_user_list(const struct xattr_handler *handler,
+                                   struct dentry *dentry, char *list,
                                    size_t list_size, const char *name,
-                                   size_t name_len, int type)
+                                   size_t name_len)
 {
        const size_t prefix_len = XATTR_USER_PREFIX_LEN;
        const size_t total_len = prefix_len + name_len + 1;
@@ -7390,8 +7392,9 @@ static size_t ocfs2_xattr_user_list(struct dentry *dentry, char *list,
        return total_len;
 }
 
-static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name,
-               void *buffer, size_t size, int type)
+static int ocfs2_xattr_user_get(const struct xattr_handler *handler,
+                               struct dentry *dentry, const char *name,
+                               void *buffer, size_t size)
 {
        struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
 
@@ -7403,8 +7406,9 @@ static int ocfs2_xattr_user_get(struct dentry *dentry, const char *name,
                               buffer, size);
 }
 
-static int ocfs2_xattr_user_set(struct dentry *dentry, const char *name,
-               const void *value, size_t size, int flags, int type)
+static int ocfs2_xattr_user_set(const struct xattr_handler *handler,
+                               struct dentry *dentry, const char *name,
+                               const void *value, size_t size, int flags)
 {
        struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);