Skip to contentSkip to conversation

ceph: introduce 'ceph.all' virtual xattr

RFC In review Venky Shankar 3 participants 9 messages Jul 21, 2016 – Jul 22, 2016 Ceph client

lore
Share & tools
lore
#0 lore raw

RFC 1/2 ceph: introduce 'ceph.all' virtual xattr

As of now listing extended attributes result in ceph dump all of it's internal xattrs thereby confusing tools such as rsync and the likes. This functionality would be removed in the subsequent patch, but there needs to be a way to examine ceph's internal xattr.

Remembering all internal xattrs is cumbersome and error prone, so, we provide a virtual xattr to fetch a list of ceph's internal xattr, obviously excluding itself.

---
 fs/ceph/xattr.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
fs/ceph/xattr.c +54 -0
index 4870b29..d0f59cb 100644
@@ -204,7 +204,45 @@ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
 			(long)ci->i_rctime.tv_nsec);
 }
 
+static struct ceph_vxattr *ceph_inode_vxattrs(struct inode *inode);
+static size_t ceph_vxattrs_name_size(struct ceph_vxattr *vxattrs);
 
+/* list all ceph internal xattrs */
+static size_t ceph_vxattrcb_list_all(struct ceph_inode_info *ci, char *val,
+                                     size_t size)
+{
+        struct inode *inode = &ci->vfs_inode;
+        struct ceph_vxattr *vxattr;
+        struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode);
+        u32 len, namelen;
+        int err = 0;
+
+        if (!vxattrs)
+                goto out;
+
+        namelen = ceph_vxattrs_name_size(vxattrs);
+
+        err = -ERANGE;
+        if (size && (namelen > size))
+                goto out;
+        err = namelen;
+        if (size == 0)
+                goto out;
+
+        /* fill up buffer with virtual xattrs */
+        for (err = 0, vxattr = vxattrs; vxattr->name; vxattr++) {
+                if (!vxattr->hidden && !(vxattr->exists_cb
+                                         && !vxattr->exists_cb(ci))) {
+                        len = snprintf(val + err, size - err, "%s", vxattr->name);
+                        err += len + 1;
+                }
+        }
+
+ out:
+        return err;
+}
+
+#define CEPH_XATTR_LIST_INTERNAL  XATTR_CEPH_PREFIX"all"
 #define CEPH_XATTR_NAME(_type, _name)	XATTR_CEPH_PREFIX #_type "." #_name
 #define CEPH_XATTR_NAME2(_type, _name, _name2)	\
 	XATTR_CEPH_PREFIX #_type "." #_name "." #_name2
@@ -237,6 +275,14 @@ static struct ceph_vxattr ceph_dir_vxattrs[] = {
 		.hidden = true,
 		.exists_cb = ceph_vxattrcb_layout_exists,
 	},
+        {
+                .name = CEPH_XATTR_LIST_INTERNAL,
+                .name_size = sizeof(CEPH_XATTR_LIST_INTERNAL),
+                .getxattr_cb = ceph_vxattrcb_list_all,
+                .readonly = true,
+                .hidden = true,
+                .exists_cb = NULL,
+        },
 	XATTR_LAYOUT_FIELD(dir, layout, stripe_unit),
 	XATTR_LAYOUT_FIELD(dir, layout, stripe_count),
 	XATTR_LAYOUT_FIELD(dir, layout, object_size),
@@ -264,6 +310,14 @@ static struct ceph_vxattr ceph_file_vxattrs[] = {
 		.hidden = true,
 		.exists_cb = ceph_vxattrcb_layout_exists,
 	},
+        {
+                .name = CEPH_XATTR_LIST_INTERNAL,
+                .name_size = sizeof(CEPH_XATTR_LIST_INTERNAL),
+                .getxattr_cb = ceph_vxattrcb_list_all,
+                .readonly = true,
+                .hidden = true,
+                .exists_cb = NULL,
+        },
 	XATTR_LAYOUT_FIELD(file, layout, stripe_unit),
 	XATTR_LAYOUT_FIELD(file, layout, stripe_count),
 	XATTR_LAYOUT_FIELD(file, layout, object_size),
Signature · 1 line
2.1.4
#1 lore raw

RFC 2/2 ceph: do not return virtual xattrs in listxattr()

---
 fs/ceph/xattr.c | 27 ++-------------------------
 1 file changed, 2 insertions(+), 25 deletions(-)
fs/ceph/xattr.c +2 -25
index d0f59cb..3b227aa 100644
@@ -848,12 +848,8 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
 {
 	struct inode *inode = d_inode(dentry);
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode);
-	u32 vir_namelen = 0;
 	u32 namelen;
 	int err;
-	u32 len;
-	int i;
 
 	spin_lock(&ci->i_ceph_lock);
 	dout("listxattr %p ver=%lld index_ver=%lld\n", inode,
@@ -871,38 +867,19 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
 	err = __build_xattrs(inode);
 	if (err < 0)
 		goto out;
-	/*
-	 * Start with virtual dir xattr names (if any) (including
-	 * terminating '\0' characters for each).
-	 */
-	vir_namelen = ceph_vxattrs_name_size(vxattrs);
 
 	/* adding 1 byte per each variable due to the null termination */
 	namelen = ci->i_xattrs.names_size + ci->i_xattrs.count;
 	err = -ERANGE;
-	if (size && vir_namelen + namelen > size)
+	if (size && namelen > size)
 		goto out;
 
-	err = namelen + vir_namelen;
+	err = namelen;
 	if (size == 0)
 		goto out;
 
 	names = __copy_xattr_names(ci, names);
 
-	/* virtual xattr names, too */
-	err = namelen;
-	if (vxattrs) {
-		for (i = 0; vxattrs[i].name; i++) {
-			if (!vxattrs[i].hidden &&
-			    !(vxattrs[i].exists_cb &&
-			      !vxattrs[i].exists_cb(ci))) {
-				len = sprintf(names, "%s", vxattrs[i].name);
-				names += len + 1;
-				err += len + 1;
-			}
-		}
-	}
-
 out:
 	spin_unlock(&ci->i_ceph_lock);
 	return err;
Signature · 1 line
2.1.4
#2 lore raw
In reply to Venky Shankar
Quoted 51 lines · Venky Shankar

As of now listing extended attributes result in ceph dump all of it's internal xattrs thereby confusing tools such as rsync and the likes. This functionality would be removed in the subsequent patch, but there needs to be a way to examine ceph's internal xattr.

Remembering all internal xattrs is cumbersome and error prone, so, we provide a virtual xattr to fetch a list of ceph's internal xattr, obviously excluding itself.

---
 fs/ceph/xattr.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
fs/ceph/xattr.c +28 -0
index 4870b29..d0f59cb 100644
@@ -204,7 +204,45 @@ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
                        (long)ci->i_rctime.tv_nsec);
 }
 
+static struct ceph_vxattr *ceph_inode_vxattrs(struct inode *inode);
+static size_t ceph_vxattrs_name_size(struct ceph_vxattr *vxattrs);
 
+/* list all ceph internal xattrs */
+static size_t ceph_vxattrcb_list_all(struct ceph_inode_info *ci, char *val,
+                                     size_t size)
+{
+        struct inode *inode = &ci->vfs_inode;
+        struct ceph_vxattr *vxattr;
+        struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode);
+        u32 len, namelen;
+        int err = 0;
+
+        if (!vxattrs)
+                goto out;
+
+        namelen = ceph_vxattrs_name_size(vxattrs);
+
+        err = -ERANGE;
+        if (size && (namelen > size))
+                goto out;
+        err = namelen;
+        if (size == 0)
+                goto out;
+
+        /* fill up buffer with virtual xattrs */
+        for (err = 0, vxattr = vxattrs; vxattr->name; vxattr++) {
+                if (!vxattr->hidden && !(vxattr->exists_cb
+                                         && !vxattr->exists_cb(ci))) {

fs/ceph/xattr.c static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val, · line 245

Quoted 10 lines
fs/ceph/xattr.c +10 -0
+                        len = snprintf(val + err, size - err, "%s", vxattr->name);
+                        err += len + 1;
+                }
+        }
+
+ out:
+        return err;
+}
+
+#define CEPH_XATTR_LIST_INTERNAL  XATTR_CEPH_PREFIX"all"

I prefer name ceph.list

Quoted 23 lines
fs/ceph/xattr.c +9 -0
 #define CEPH_XATTR_NAME(_type, _name)  XATTR_CEPH_PREFIX #_type "." #_name
 #define CEPH_XATTR_NAME2(_type, _name, _name2) \
        XATTR_CEPH_PREFIX #_type "." #_name "." #_name2
@@ -237,6 +275,14 @@ static struct ceph_vxattr ceph_dir_vxattrs[] = {
                .hidden = true,
                .exists_cb = ceph_vxattrcb_layout_exists,
        },
+        {
+                .name = CEPH_XATTR_LIST_INTERNAL,
+                .name_size = sizeof(CEPH_XATTR_LIST_INTERNAL),
+                .getxattr_cb = ceph_vxattrcb_list_all,
+                .readonly = true,
+                .hidden = true,
+                .exists_cb = NULL,
+        },
        XATTR_LAYOUT_FIELD(dir, layout, stripe_unit),
        XATTR_LAYOUT_FIELD(dir, layout, stripe_count),
        XATTR_LAYOUT_FIELD(dir, layout, object_size),
@@ -264,6 +310,14 @@ static struct ceph_vxattr ceph_file_vxattrs[] = {
                .hidden = true,
                .exists_cb = ceph_vxattrcb_layout_exists,
        },
+        {

fs/ceph/xattr.c static struct ceph_vxattr ceph_file_vxattrs[] = { · line 323

Quoted 10 lines
fs/ceph/xattr.c +7 -0
+                .name = CEPH_XATTR_LIST_INTERNAL,
+                .name_size = sizeof(CEPH_XATTR_LIST_INTERNAL),
+                .getxattr_cb = ceph_vxattrcb_list_all,
+                .readonly = true,
+                .hidden = true,
+                .exists_cb = NULL,
+        },
        XATTR_LAYOUT_FIELD(file, layout, stripe_unit),
        XATTR_LAYOUT_FIELD(file, layout, stripe_count),
        XATTR_LAYOUT_FIELD(file, layout, object_size),

Need to change the 'hidden' attribute of all other vxattrs to false.

Regards
Yan, Zheng

Quoted 7 lines

--
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

cover ceph: virtual xattr handling

In reply to Venky Shankar

v2: vxattrs 'hidden' attribute defaults to false

Venky Shankar (2):
ceph: introduce 'ceph.all' virtual xattr
ceph: do not return virtual xattrs in listxattr()

 fs/ceph/xattr.c | 83 +++++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 57 insertions(+), 26 deletions(-)
Signature · 1 line
2.1.4
#4 lore raw

PATCH 1/2 ceph: introduce 'ceph.all' virtual xattr

As of now listing extended attributes result in ceph dump all of it's internal xattrs thereby confusing tools such as rsync and the likes. This functionality would be removed in the subsequent patch, but there needs to be a way to examine ceph's internal xattr.

Remembering all internal xattrs is cumbersome and error prone, so, we provide a virtual xattr to fetch a list of ceph's internal xattr, obviously excluding itself.

---
 fs/ceph/xattr.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)
fs/ceph/xattr.c +55 -1
index 4870b29..019f784 100644
@@ -204,7 +204,45 @@ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
 			(long)ci->i_rctime.tv_nsec);
 }
 
+static struct ceph_vxattr *ceph_inode_vxattrs(struct inode *inode);
+static size_t ceph_vxattrs_name_size(struct ceph_vxattr *vxattrs);
 
+/* list all ceph internal xattrs */
+static size_t ceph_vxattrcb_list_all(struct ceph_inode_info *ci, char *val,
+                                     size_t size)
+{
+        struct inode *inode = &ci->vfs_inode;
+        struct ceph_vxattr *vxattr;
+        struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode);
+        u32 len, namelen;
+        int err = 0;
+
+        if (!vxattrs)
+                goto out;
+
+        namelen = ceph_vxattrs_name_size(vxattrs);
+
+        err = -ERANGE;
+        if (size && (namelen > size))
+                goto out;
+        err = namelen;
+        if (size == 0)
+                goto out;
+
+        /* fill up buffer with virtual xattrs */
+        for (err = 0, vxattr = vxattrs; vxattr->name; vxattr++) {
+                if (!vxattr->hidden && !(vxattr->exists_cb
+                                         && !vxattr->exists_cb(ci))) {
+                        len = snprintf(val + err, size - err, "%s", vxattr->name);
+                        err += len + 1;
+                }
+        }
+
+ out:
+        return err;
+}
+
+#define CEPH_XATTR_LIST_INTERNAL  XATTR_CEPH_PREFIX"all"
 #define CEPH_XATTR_NAME(_type, _name)	XATTR_CEPH_PREFIX #_type "." #_name
 #define CEPH_XATTR_NAME2(_type, _name, _name2)	\
 	XATTR_CEPH_PREFIX #_type "." #_name "." #_name2
@@ -224,7 +262,7 @@ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
 		.name_size = sizeof (CEPH_XATTR_NAME2(_type, _name, _field)), \
 		.getxattr_cb = ceph_vxattrcb_ ## _name ## _ ## _field, \
 		.readonly = false,				\
-		.hidden = true,			\
+		.hidden = false,			\
 		.exists_cb = ceph_vxattrcb_layout_exists,	\
 	}
 
@@ -237,6 +275,14 @@ static struct ceph_vxattr ceph_dir_vxattrs[] = {
 		.hidden = true,
 		.exists_cb = ceph_vxattrcb_layout_exists,
 	},
+        {
+                .name = CEPH_XATTR_LIST_INTERNAL,
+                .name_size = sizeof(CEPH_XATTR_LIST_INTERNAL),
+                .getxattr_cb = ceph_vxattrcb_list_all,
+                .readonly = true,
+                .hidden = true,
+                .exists_cb = NULL,
+        },
 	XATTR_LAYOUT_FIELD(dir, layout, stripe_unit),
 	XATTR_LAYOUT_FIELD(dir, layout, stripe_count),
 	XATTR_LAYOUT_FIELD(dir, layout, object_size),
@@ -264,6 +310,14 @@ static struct ceph_vxattr ceph_file_vxattrs[] = {
 		.hidden = true,
 		.exists_cb = ceph_vxattrcb_layout_exists,
 	},
+        {
+                .name = CEPH_XATTR_LIST_INTERNAL,
+                .name_size = sizeof(CEPH_XATTR_LIST_INTERNAL),
+                .getxattr_cb = ceph_vxattrcb_list_all,
+                .readonly = true,
+                .hidden = true,
+                .exists_cb = NULL,
+        },
 	XATTR_LAYOUT_FIELD(file, layout, stripe_unit),
 	XATTR_LAYOUT_FIELD(file, layout, stripe_count),
 	XATTR_LAYOUT_FIELD(file, layout, object_size),
Signature · 1 line
2.1.4
#5 lore raw
Quoted 94 lines · Venky Shankar

As of now listing extended attributes result in ceph dump all of it's internal xattrs thereby confusing tools such as rsync and the likes. This functionality would be removed in the subsequent patch, but there needs to be a way to examine ceph's internal xattr.

Remembering all internal xattrs is cumbersome and error prone, so, we provide a virtual xattr to fetch a list of ceph's internal xattr, obviously excluding itself.

---
 fs/ceph/xattr.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)
fs/ceph/xattr.c +49 -1
index 4870b29..019f784 100644
@@ -204,7 +204,45 @@ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
                        (long)ci->i_rctime.tv_nsec);
 }
 
+static struct ceph_vxattr *ceph_inode_vxattrs(struct inode *inode);
+static size_t ceph_vxattrs_name_size(struct ceph_vxattr *vxattrs);
 
+/* list all ceph internal xattrs */
+static size_t ceph_vxattrcb_list_all(struct ceph_inode_info *ci, char *val,
+                                     size_t size)
+{
+        struct inode *inode = &ci->vfs_inode;
+        struct ceph_vxattr *vxattr;
+        struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode);
+        u32 len, namelen;
+        int err = 0;
+
+        if (!vxattrs)
+                goto out;
+
+        namelen = ceph_vxattrs_name_size(vxattrs);
+
+        err = -ERANGE;
+        if (size && (namelen > size))
+                goto out;
+        err = namelen;
+        if (size == 0)
+                goto out;
+
+        /* fill up buffer with virtual xattrs */
+        for (err = 0, vxattr = vxattrs; vxattr->name; vxattr++) {
+                if (!vxattr->hidden && !(vxattr->exists_cb
+                                         && !vxattr->exists_cb(ci))) {
+                        len = snprintf(val + err, size - err, "%s", vxattr->name);
+                        err += len + 1;
+                }
+        }
+
+ out:
+        return err;
+}
+
+#define CEPH_XATTR_LIST_INTERNAL  XATTR_CEPH_PREFIX"all"
 #define CEPH_XATTR_NAME(_type, _name)  XATTR_CEPH_PREFIX #_type "." #_name
 #define CEPH_XATTR_NAME2(_type, _name, _name2) \
        XATTR_CEPH_PREFIX #_type "." #_name "." #_name2
@@ -224,7 +262,7 @@ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
                .name_size = sizeof (CEPH_XATTR_NAME2(_type, _name, _field)), \
                .getxattr_cb = ceph_vxattrcb_ ## _name ## _ ## _field, \
                .readonly = false,                              \
-               .hidden = true,                 \
+               .hidden = false,                        \
                .exists_cb = ceph_vxattrcb_layout_exists,       \
        }
 
@@ -237,6 +275,14 @@ static struct ceph_vxattr ceph_dir_vxattrs[] = {
                .hidden = true,
                .exists_cb = ceph_vxattrcb_layout_exists,
        },
+        {
+                .name = CEPH_XATTR_LIST_INTERNAL,
+                .name_size = sizeof(CEPH_XATTR_LIST_INTERNAL),
+                .getxattr_cb = ceph_vxattrcb_list_all,
+                .readonly = true,
+                .hidden = true,
+                .exists_cb = NULL,
+        },
        XATTR_LAYOUT_FIELD(dir, layout, stripe_unit),
        XATTR_LAYOUT_FIELD(dir, layout, stripe_count),
        XATTR_LAYOUT_FIELD(dir, layout, object_size),
@@ -264,6 +310,14 @@ static struct ceph_vxattr ceph_file_vxattrs[] = {
                .hidden = true,
                .exists_cb = ceph_vxattrcb_layout_exists,
        },
+        {
+                .name = CEPH_XATTR_LIST_INTERNAL,

fs/ceph/xattr.c static struct ceph_vxattr ceph_file_vxattrs[] = {

Quoted 10 lines
fs/ceph/xattr.c +6 -1
+                .name_size = sizeof(CEPH_XATTR_LIST_INTERNAL),
+                .getxattr_cb = ceph_vxattrcb_list_all,
+                .readonly = true,
+                .hidden = true,
+                .exists_cb = NULL,
+        },
        XATTR_LAYOUT_FIELD(file, layout, stripe_unit),
        XATTR_LAYOUT_FIELD(file, layout, stripe_count),
        XATTR_LAYOUT_FIELD(file, layout, object_size),
--

ceph.dir.layout is still hidden?

Quoted 6 lines

2.1.4

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 99 lines · Zheng
Quoted 98 lines · Venky Shankar

As of now listing extended attributes result in ceph dump all of it's internal xattrs thereby confusing tools such as rsync and the likes. This functionality would be removed in the subsequent patch, but there needs to be a way to examine ceph's internal xattr.

Remembering all internal xattrs is cumbersome and error prone, so, we provide a virtual xattr to fetch a list of ceph's internal xattr, obviously excluding itself.

---
 fs/ceph/xattr.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)
fs/ceph/xattr.c +53 -1
index 4870b29..019f784 100644
@@ -204,7 +204,45 @@ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
                        (long)ci->i_rctime.tv_nsec);
 }
 
+static struct ceph_vxattr *ceph_inode_vxattrs(struct inode *inode);
+static size_t ceph_vxattrs_name_size(struct ceph_vxattr *vxattrs);
 
+/* list all ceph internal xattrs */
+static size_t ceph_vxattrcb_list_all(struct ceph_inode_info *ci, char *val,
+                                     size_t size)
+{
+        struct inode *inode = &ci->vfs_inode;
+        struct ceph_vxattr *vxattr;
+        struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode);
+        u32 len, namelen;
+        int err = 0;
+
+        if (!vxattrs)
+                goto out;
+
+        namelen = ceph_vxattrs_name_size(vxattrs);
+
+        err = -ERANGE;
+        if (size && (namelen > size))
+                goto out;
+        err = namelen;
+        if (size == 0)
+                goto out;
+
+        /* fill up buffer with virtual xattrs */
+        for (err = 0, vxattr = vxattrs; vxattr->name; vxattr++) {
+                if (!vxattr->hidden && !(vxattr->exists_cb
+                                         && !vxattr->exists_cb(ci))) {
+                        len = snprintf(val + err, size - err, "%s", vxattr->name);
+                        err += len + 1;
+                }
+        }
+
+ out:
+        return err;
+}
+
+#define CEPH_XATTR_LIST_INTERNAL  XATTR_CEPH_PREFIX"all"
 #define CEPH_XATTR_NAME(_type, _name)  XATTR_CEPH_PREFIX #_type "." #_name
 #define CEPH_XATTR_NAME2(_type, _name, _name2) \
        XATTR_CEPH_PREFIX #_type "." #_name "." #_name2
@@ -224,7 +262,7 @@ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
                .name_size = sizeof (CEPH_XATTR_NAME2(_type, _name, _field)), \
                .getxattr_cb = ceph_vxattrcb_ ## _name ## _ ## _field, \
                .readonly = false,                              \
-               .hidden = true,                 \
+               .hidden = false,                        \
                .exists_cb = ceph_vxattrcb_layout_exists,       \
        }
 
@@ -237,6 +275,14 @@ static struct ceph_vxattr ceph_dir_vxattrs[] = {
                .hidden = true,
                .exists_cb = ceph_vxattrcb_layout_exists,
        },
+        {
+                .name = CEPH_XATTR_LIST_INTERNAL,
+                .name_size = sizeof(CEPH_XATTR_LIST_INTERNAL),
+                .getxattr_cb = ceph_vxattrcb_list_all,
+                .readonly = true,
+                .hidden = true,
+                .exists_cb = NULL,
+        },
        XATTR_LAYOUT_FIELD(dir, layout, stripe_unit),
        XATTR_LAYOUT_FIELD(dir, layout, stripe_count),
        XATTR_LAYOUT_FIELD(dir, layout, object_size),
@@ -264,6 +310,14 @@ static struct ceph_vxattr ceph_file_vxattrs[] = {
                .hidden = true,
                .exists_cb = ceph_vxattrcb_layout_exists,
        },
+        {
+                .name = CEPH_XATTR_LIST_INTERNAL,
+                .name_size = sizeof(CEPH_XATTR_LIST_INTERNAL),
+                .getxattr_cb = ceph_vxattrcb_list_all,
+                .readonly = true,
+                .hidden = true,
Quoted 8 lines

fs/ceph/xattr.c static struct ceph_vxattr ceph_file_vxattrs[] = {

Quoted 6 lines
fs/ceph/xattr.c +2 -1
+                .exists_cb = NULL,
+        },
        XATTR_LAYOUT_FIELD(file, layout, stripe_unit),
        XATTR_LAYOUT_FIELD(file, layout, stripe_count),
        XATTR_LAYOUT_FIELD(file, layout, object_size),
--

ceph.dir.layout is still hidden?

I left that as hidden as ceph.all returns stripe_unit, count etc. (only keys)

Should we make ceph.dir.layout unhidden and hide stripe_unit etc as we get that from the layout itself?

Quoted 9 lines
Quoted 9 lines

2.1.4

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Venky
#overclk [freenode, oftc]
#7 lore raw

PATCH 2/2 ceph: do not return virtual xattrs in listxattr()

In reply to Venky Shankar
---
 fs/ceph/xattr.c | 27 ++-------------------------
 1 file changed, 2 insertions(+), 25 deletions(-)
fs/ceph/xattr.c +2 -25
index 019f784..816c4ef 100644
@@ -848,12 +848,8 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
 {
 	struct inode *inode = d_inode(dentry);
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct ceph_vxattr *vxattrs = ceph_inode_vxattrs(inode);
-	u32 vir_namelen = 0;
 	u32 namelen;
 	int err;
-	u32 len;
-	int i;
 
 	spin_lock(&ci->i_ceph_lock);
 	dout("listxattr %p ver=%lld index_ver=%lld\n", inode,
@@ -871,38 +867,19 @@ ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
 	err = __build_xattrs(inode);
 	if (err < 0)
 		goto out;
-	/*
-	 * Start with virtual dir xattr names (if any) (including
-	 * terminating '\0' characters for each).
-	 */
-	vir_namelen = ceph_vxattrs_name_size(vxattrs);
 
 	/* adding 1 byte per each variable due to the null termination */
 	namelen = ci->i_xattrs.names_size + ci->i_xattrs.count;
 	err = -ERANGE;
-	if (size && vir_namelen + namelen > size)
+	if (size && namelen > size)
 		goto out;
 
-	err = namelen + vir_namelen;
+	err = namelen;
 	if (size == 0)
 		goto out;
 
 	names = __copy_xattr_names(ci, names);
 
-	/* virtual xattr names, too */
-	err = namelen;
-	if (vxattrs) {
-		for (i = 0; vxattrs[i].name; i++) {
-			if (!vxattrs[i].hidden &&
-			    !(vxattrs[i].exists_cb &&
-			      !vxattrs[i].exists_cb(ci))) {
-				len = sprintf(names, "%s", vxattrs[i].name);
-				names += len + 1;
-				err += len + 1;
-			}
-		}
-	}
-
 out:
 	spin_unlock(&ci->i_ceph_lock);
 	return err;
Signature · 1 line
2.1.4
#8 lore raw

Re: [PATCH 0/2] ceph: virtual xattr handling

In reply to Venky Shankar
Quoted 5 lines · Venky Shankar

v2: vxattrs 'hidden' attribute defaults to false

Venky Shankar (2):
ceph: introduce 'ceph.all' virtual xattr
ceph: do not return virtual xattrs in listxattr()

NAK. No new magic namespaces outside the documented systems ones, please. And especially no 'magic' attributes in 'magic' namespaces.