Skip to contentSkip to conversation

ceph/osd_client: GETXATTR support

PATCH New David Disseldorp 2 participants 7 messages Oct 9, 2015 – Oct 15, 2015 Ceph common code (libceph)

lore
Share & tools
lore
#0 lore raw

cover ceph/osd_client: GETXATTR support

The following patch adds support for xattr retrieval via CEPH_OSD_OP_GETXATTR. This allows for future RBD Persistent Reservation support to implemented with state retained in an xattr on the RBD header object.

RBD get/set/cmpset xattr functionality can be tested using the debug DEVICE_ATTR patches found at:
https://git.samba.org/?p=ddiss/linux.git;a=shortlog;h=refs/heads/rbd_xattrs

E.g.

dracut:/# echo "key" > /sys/devices/rbd/0/getxattr
sh: echo: write error: No data available
dracut:/# echo "key val1" > /sys/devices/rbd/0/setxattr
dracut:/# echo "key" > /sys/devices/rbd/0/getxattr
[   95.842774] rbd: rbd0: key: val1
dracut:/# echo "key val1 val2" > /sys/devices/rbd/0/cmpsetxattr
dracut:/# echo "key" > /sys/devices/rbd/0/getxattr
[  129.868432] rbd: rbd0: key: val2
dracut:/# echo "key val1 val2" > /sys/devices/rbd/0/cmpsetxattr
sh: echo: write error: Operation canceled
dracut:/# echo "key val2 val3" > /sys/devices/rbd/0/cmpsetxattr
dracut:/# echo "key" > /sys/devices/rbd/0/getxattr
[  152.532082] rbd: rbd0: key: val3

Cheers, David

#1 lore raw

PATCH 1/1 ceph/osd_client: add support for CEPH_OSD_OP_GETXATTR

Allows for xattr retrieval. Response data buffer allocation is the responsibility of the osd_req_op_xattr_init() caller.

---
 include/linux/ceph/osd_client.h |  8 +++++-
 net/ceph/osd_client.c           | 55 ++++++++++++++++++++++++++++++++---------
 2 files changed, 50 insertions(+), 13 deletions(-)
include/linux/ceph/osd_client.h +7 -1
index 7506b48..062efc3 100644
@@ -91,7 +91,8 @@ struct ceph_osd_req_op {
 			u32 value_len;
 			__u8 cmp_op;       /* CEPH_OSD_CMPXATTR_OP_* */
 			__u8 cmp_mode;     /* CEPH_OSD_CMPXATTR_MODE_* */
-			struct ceph_osd_data osd_data;
+			struct ceph_osd_data request_data;
+			struct ceph_osd_data response_data;
 		} xattr;
 		struct {
 			const char *class_name;
@@ -298,6 +299,11 @@ extern void osd_req_op_cls_response_data_pages(struct ceph_osd_request *,
 					struct page **pages, u64 length,
 					u32 alignment, bool pages_from_pool,
 					bool own_pages);
+extern void osd_req_op_xattr_response_data_pages(struct ceph_osd_request *,
+					unsigned int which,
+					struct page **pages, u64 length,
+					u32 alignment, bool pages_from_pool,
+					bool own_pages);
 
 extern void osd_req_op_cls_init(struct ceph_osd_request *osd_req,
 					unsigned int which, u16 opcode,
net/ceph/osd_client.c +43 -12

100 lines not on this page · raw message

Signature · 1 line
2.1.4
#2 lore raw

Re: [PATCH] ceph/osd_client: add support for CEPH_OSD_OP_GETXATTR

Quoted 2 lines · David Disseldorp

Allows for xattr retrieval. Response data buffer allocation is the responsibility of the osd_req_op_xattr_init() caller.

Ping, any feedback on the patch?

Cheers, David

maintainer
#3 lore raw

Re: [PATCH] ceph/osd_client: add support for CEPH_OSD_OP_GETXATTR

Quoted 6 lines · David Disseldorp
Quoted 2 lines · David Disseldorp

Allows for xattr retrieval. Response data buffer allocation is the responsibility of the osd_req_op_xattr_init() caller.

Ping, any feedback on the patch?

The patch itself looks OK, except for the part where you rename a local variable for no reason, AFACT.

We've discussed some of this last week. As it is, all rbd image properties are stored in omap, so PR info strings stored in xattrs is something different, but it should be fine for now. I'd rather not merge any kernel patches related to rbd-target work until we see a complete patchset though. There's been a lot of back and forth between Mike, Christoph and target people and the general approach had changed at least twice, so I'd like to wait for things to settle down.

Thanks,

Ilya

#4 lore raw

Re: [PATCH] ceph/osd_client: add support for CEPH_OSD_OP_GETXATTR

Quoted 1 line · Ilya Dryomov

On Wed, Oct 14, 2015 at 7:37 PM, David Disseldorp <[email protected]> wrote:

...

Quoted 4 lines
Quoted 1 line

Ping, any feedback on the patch?

The patch itself looks OK, except for the part where you rename a local variable for no reason, AFACT.

Thanks for the feedback Ilya. I presume you're referring to the pagelist -> req_pagelist rename - I'll drop that change and send an update.

Quoted 7 lines

We've discussed some of this last week. As it is, all rbd image properties are stored in omap, so PR info strings stored in xattrs is something different, but it should be fine for now. I'd rather not merge any kernel patches related to rbd-target work until we see a complete patchset though. There's been a lot of back and forth between Mike, Christoph and target people and the general approach had changed at least twice, so I'd like to wait for things to settle down.

I understand the desire to wait on any RBD-target changes until upstream consensus has been reached, but I'd argue that this change is isolated, and complementary to the existing SETXATTR / CMPXATTR support.

Cheers, David

maintainer
#5 lore raw

Re: [PATCH] ceph/osd_client: add support for CEPH_OSD_OP_GETXATTR

Quoted 11 lines · David Disseldorp
Quoted 1 line · Ilya Dryomov

On Wed, Oct 14, 2015 at 7:37 PM, David Disseldorp <[email protected]> wrote:

...

Quoted 4 lines
Quoted 1 line

Ping, any feedback on the patch?

The patch itself looks OK, except for the part where you rename a local variable for no reason, AFACT.

Thanks for the feedback Ilya. I presume you're referring to the pagelist -> req_pagelist rename - I'll drop that change and send an update.

Also, the prefix for net/ceph patches is libceph.

Quoted 9 lines
Quoted 8 lines

We've discussed some of this last week. As it is, all rbd image properties are stored in omap, so PR info strings stored in xattrs is something different, but it should be fine for now. I'd rather not merge any kernel patches related to rbd-target work until we see a complete patchset though. There's been a lot of back and forth between Mike, Christoph and target people and the general approach had changed at least twice, so I'd like to wait for things to settle down.

Quoted 3 lines

I understand the desire to wait on any RBD-target changes until upstream consensus has been reached, but I'd argue that this change is isolated, and complementary to the existing SETXATTR / CMPXATTR support.

That's true, but we already have a bunch of unused code in net/ceph, which was added using precisely this reasoning, so I'm a bit hesitant.

Thanks,

Ilya

#6 lore raw

PATCH v2 1/1 libceph: add support for CEPH_OSD_OP_GETXATTR

In reply to David Disseldorp

Allows for xattr retrieval. Response data buffer allocation is the responsibility of the osd_req_op_xattr_init() caller.

---
 include/linux/ceph/osd_client.h |  8 ++++++-
 net/ceph/osd_client.c           | 47 ++++++++++++++++++++++++++++++++++-------
 2 files changed, 46 insertions(+), 9 deletions(-)
include/linux/ceph/osd_client.h +7 -1
index 7506b48..062efc3 100644
@@ -91,7 +91,8 @@ struct ceph_osd_req_op {
 			u32 value_len;
 			__u8 cmp_op;       /* CEPH_OSD_CMPXATTR_OP_* */
 			__u8 cmp_mode;     /* CEPH_OSD_CMPXATTR_MODE_* */
-			struct ceph_osd_data osd_data;
+			struct ceph_osd_data request_data;
+			struct ceph_osd_data response_data;
 		} xattr;
 		struct {
 			const char *class_name;
@@ -298,6 +299,11 @@ extern void osd_req_op_cls_response_data_pages(struct ceph_osd_request *,
 					struct page **pages, u64 length,
 					u32 alignment, bool pages_from_pool,
 					bool own_pages);
+extern void osd_req_op_xattr_response_data_pages(struct ceph_osd_request *,
+					unsigned int which,
+					struct page **pages, u64 length,
+					u32 alignment, bool pages_from_pool,
+					bool own_pages);
 
 extern void osd_req_op_cls_init(struct ceph_osd_request *osd_req,
 					unsigned int which, u16 opcode,
net/ceph/osd_client.c +39 -8

91 lines not on this page · raw message

Signature · 1 line
2.1.4