All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: xiubli@redhat.com, idryomov@gmail.com
Cc: pdonnell@redhat.com, ceph-devel@vger.kernel.org
Subject: Re: [PATCH] ceph: set osdmap epoch for setxattr.
Date: Wed, 09 Dec 2020 06:55:44 -0500	[thread overview]
Message-ID: <532b2ccda1ed7d424cf7ebd9869b755a3d998c45.camel@kernel.org> (raw)
In-Reply-To: <20201209025220.2563698-1-xiubli@redhat.com>

On Wed, 2020-12-09 at 10:52 +0800, xiubli@redhat.com wrote:
> From: Xiubo Li <xiubli@redhat.com>
> 
> 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>
> ---
>  fs/ceph/mds_client.c         | 2 +-
>  fs/ceph/xattr.c              | 3 +++
>  include/linux/ceph/ceph_fs.h | 1 +
>  3 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 4fab37d858ce..9b5e3975b3ad 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -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;
> diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
> index e89750a1f039..a8597cae0ed7 100644
> --- a/fs/ceph/xattr.c
> +++ b/fs/ceph/xattr.c
> @@ -995,6 +995,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;
> @@ -1033,6 +1034,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;
>  	}
> diff --git a/include/linux/ceph/ceph_fs.h b/include/linux/ceph/ceph_fs.h
> index 455e9b9e2adf..c0f1b921ec69 100644
> --- a/include/linux/ceph/ceph_fs.h
> +++ b/include/linux/ceph/ceph_fs.h
> @@ -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;

Thanks, Xiubo. Merged.
-- 
Jeff Layton <jlayton@kernel.org>


      reply	other threads:[~2020-12-09 11:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09  2:52 [PATCH] ceph: set osdmap epoch for setxattr xiubli
2020-12-09 11:55 ` Jeff Layton [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=532b2ccda1ed7d424cf7ebd9869b755a3d998c45.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=pdonnell@redhat.com \
    --cc=xiubli@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.