]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ceph: set osdmap epoch for setxattr
authorXiubo Li <xiubli@redhat.com>
Wed, 9 Dec 2020 02:52:20 +0000 (10:52 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 14 Dec 2020 22:21:48 +0000 (23:21 +0100)
When setting the file/dir layout, it may need data pool info. So
in mds server, it needs to check the osdmap. At present, if mds
doesn't find the data pool specified, it will try to get the latest
osdmap. Now if pass the osd epoch for setxattr, the mds server can
only check this epoch of osdmap.

URL: https://tracker.ceph.com/issues/48504
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/mds_client.c
fs/ceph/xattr.c
include/linux/ceph/ceph_fs.h

index 70d3479896036e0def3cad042253adedb02548e4..75034f7d8f467276537475ee553a6741e6c9e19b 100644 (file)
@@ -2533,7 +2533,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
                goto out_free2;
        }
 
-       msg->hdr.version = cpu_to_le16(2);
+       msg->hdr.version = cpu_to_le16(3);
        msg->hdr.tid = cpu_to_le64(req->r_tid);
 
        head = msg->front.iov_base;
index cd8c7aaa23a077c9b5dfb3f4bc8cc851f977b56b..24997982de0164cce8ea2945df25c23c83795cf0 100644 (file)
@@ -1022,6 +1022,7 @@ static int ceph_sync_setxattr(struct inode *inode, const char *name,
        struct ceph_inode_info *ci = ceph_inode(inode);
        struct ceph_mds_request *req;
        struct ceph_mds_client *mdsc = fsc->mdsc;
+       struct ceph_osd_client *osdc = &fsc->client->osdc;
        struct ceph_pagelist *pagelist = NULL;
        int op = CEPH_MDS_OP_SETXATTR;
        int err;
@@ -1060,6 +1061,8 @@ static int ceph_sync_setxattr(struct inode *inode, const char *name,
 
        if (op == CEPH_MDS_OP_SETXATTR) {
                req->r_args.setxattr.flags = cpu_to_le32(flags);
+               req->r_args.setxattr.osdmap_epoch =
+                       cpu_to_le32(osdc->osdmap->epoch);
                req->r_pagelist = pagelist;
                pagelist = NULL;
        }
index 455e9b9e2adf538d53ba1efcfccde2c96671f010..c0f1b921ec69bc683e15ef528bc6313c3e4fd11e 100644 (file)
@@ -424,6 +424,7 @@ union ceph_mds_request_args {
        } __attribute__ ((packed)) open;
        struct {
                __le32 flags;
+               __le32 osdmap_epoch; /* used for setting file/dir layouts */
        } __attribute__ ((packed)) setxattr;
        struct {
                struct ceph_file_layout_legacy layout;