2019-11-18 12:13:15

by Luis Henriques

[permalink] [raw]
Subject: [RFC PATCH v3] ceph: add new obj copy OSD Op

Hi,

Before going ahead with a pull-request for ceph I would like to make sure
we're all on the same page regarding the final fix for this problem.
Thus, following this email, I'm sending 2 patches: one for ceph OSDs and
the another for the kernel client.

* osd: add new 'copy-from-notrunc' operation
This patch shall be applied to ceph master after reverting commit
ba152435fd85 ("osd: add flag to prevent truncate_seq copy in copy-from
operation"). It adds a new operation that will be exactly the same as
the original 'copy-from' operation, but with the extra 2 parameters
(truncate_{seq,size})

* ceph: switch copy_file_range to 'copy-from-notrunc' operation
This will make the kernel client use the new OSD op in
copy_file_range. One extra thing that could probably be added is
changing the mount options to NOCOPYFROM if the first call to
ceph_osdc_copy_from() fails.

Does this look good, or did I missed something from the previous
discussion?

(One advantage of this approach: the OSD patch can be easily backported!)

Cheers,
--
Luis

Luis Henriques (1):
osd: add new 'copy-from-notrunc' operation

src/include/rados.h | 1 +
src/osd/OSD.cc | 3 ++-
src/osd/PrimaryLogPG.cc | 24 +++++++++++++++++++-----
3 files changed, 22 insertions(+), 6 deletions(-)

ceph: switch copy_file_range to 'copy-from-notrunc' operation

fs/ceph/file.c | 3 ++-
include/linux/ceph/osd_client.h | 1 +
include/linux/ceph/rados.h | 1 +
net/ceph/osd_client.c | 18 ++++++++++++------
4 files changed, 16 insertions(+), 7 deletions(-)


2019-11-18 13:14:26

by Jeff Layton

[permalink] [raw]
Subject: Re: [RFC PATCH v3] ceph: add new obj copy OSD Op

On Mon, 2019-11-18 at 12:09 +0000, Luis Henriques wrote:
> Hi,
>
> Before going ahead with a pull-request for ceph I would like to make sure
> we're all on the same page regarding the final fix for this problem.
> Thus, following this email, I'm sending 2 patches: one for ceph OSDs and
> the another for the kernel client.
>
> * osd: add new 'copy-from-notrunc' operation
> This patch shall be applied to ceph master after reverting commit
> ba152435fd85 ("osd: add flag to prevent truncate_seq copy in copy-from
> operation"). It adds a new operation that will be exactly the same as
> the original 'copy-from' operation, but with the extra 2 parameters
> (truncate_{seq,size})
>
> * ceph: switch copy_file_range to 'copy-from-notrunc' operation
> This will make the kernel client use the new OSD op in
> copy_file_range. One extra thing that could probably be added is
> changing the mount options to NOCOPYFROM if the first call to
> ceph_osdc_copy_from() fails.
>

I probably wouldn't change the mount options to be different from what
was initially specified. How about just disable copy_file_range
internally for that superblock, and then pr_notice a message that says
that copy_file_range is being autodisabled. If they mount with '-o
nocopyfrom' that will make the warning go away.

> Does this look good, or did I missed something from the previous
> discussion?
>
> (One advantage of this approach: the OSD patch can be easily backported!)
>

Yep, I think this looks like a _much_ simpler approach to the problem.
--
Jeff Layton <[email protected]>

2019-11-18 14:07:30

by Luis Henriques

[permalink] [raw]
Subject: Re: [RFC PATCH v3] ceph: add new obj copy OSD Op

On Mon, Nov 18, 2019 at 08:12:39AM -0500, Jeff Layton wrote:
> On Mon, 2019-11-18 at 12:09 +0000, Luis Henriques wrote:
> > Hi,
> >
> > Before going ahead with a pull-request for ceph I would like to make sure
> > we're all on the same page regarding the final fix for this problem.
> > Thus, following this email, I'm sending 2 patches: one for ceph OSDs and
> > the another for the kernel client.
> >
> > * osd: add new 'copy-from-notrunc' operation
> > This patch shall be applied to ceph master after reverting commit
> > ba152435fd85 ("osd: add flag to prevent truncate_seq copy in copy-from
> > operation"). It adds a new operation that will be exactly the same as
> > the original 'copy-from' operation, but with the extra 2 parameters
> > (truncate_{seq,size})
> >
> > * ceph: switch copy_file_range to 'copy-from-notrunc' operation
> > This will make the kernel client use the new OSD op in
> > copy_file_range. One extra thing that could probably be added is
> > changing the mount options to NOCOPYFROM if the first call to
> > ceph_osdc_copy_from() fails.
> >
>
> I probably wouldn't change the mount options to be different from what
> was initially specified. How about just disable copy_file_range
> internally for that superblock, and then pr_notice a message that says
> that copy_file_range is being autodisabled. If they mount with '-o
> nocopyfrom' that will make the warning go away.

Ok, that makes sense. I'll include this in the next rev, which will
probably be sent only after the pull-request for ceph goes in (assuming
the OSD patch won't need any major rework).

> > Does this look good, or did I missed something from the previous
> > discussion?
> >
> > (One advantage of this approach: the OSD patch can be easily backported!)
> >
>
> Yep, I think this looks like a _much_ simpler approach to the problem.

Agreed!

Cheers,
--
Lu?s

2019-11-20 12:57:35

by Luis Henriques

[permalink] [raw]
Subject: Re: [RFC PATCH v3] ceph: add new obj copy OSD Op

On Mon, Nov 18, 2019 at 02:05:51PM +0000, Luis Henriques wrote:
> On Mon, Nov 18, 2019 at 08:12:39AM -0500, Jeff Layton wrote:
> > On Mon, 2019-11-18 at 12:09 +0000, Luis Henriques wrote:
> > > Hi,
> > >
> > > Before going ahead with a pull-request for ceph I would like to make sure
> > > we're all on the same page regarding the final fix for this problem.
> > > Thus, following this email, I'm sending 2 patches: one for ceph OSDs and
> > > the another for the kernel client.
> > >
> > > * osd: add new 'copy-from-notrunc' operation
> > > This patch shall be applied to ceph master after reverting commit
> > > ba152435fd85 ("osd: add flag to prevent truncate_seq copy in copy-from
> > > operation"). It adds a new operation that will be exactly the same as
> > > the original 'copy-from' operation, but with the extra 2 parameters
> > > (truncate_{seq,size})
> > >
> > > * ceph: switch copy_file_range to 'copy-from-notrunc' operation
> > > This will make the kernel client use the new OSD op in
> > > copy_file_range. One extra thing that could probably be added is
> > > changing the mount options to NOCOPYFROM if the first call to
> > > ceph_osdc_copy_from() fails.
> > >
> >
> > I probably wouldn't change the mount options to be different from what
> > was initially specified. How about just disable copy_file_range
> > internally for that superblock, and then pr_notice a message that says
> > that copy_file_range is being autodisabled. If they mount with '-o
> > nocopyfrom' that will make the warning go away.
>
> Ok, that makes sense. I'll include this in the next rev, which will
> probably be sent only after the pull-request for ceph goes in (assuming
> the OSD patch won't need any major rework).

FYI, yesterday I created the pull-request for this [1]. I thought I had
also sent an email to this thread, but I guess I didn't... so, here it
is :-)

[1] https://github.com/ceph/ceph/pull/31728

Cheers,
--
Lu?s

>
> > > Does this look good, or did I missed something from the previous
> > > discussion?
> > >
> > > (One advantage of this approach: the OSD patch can be easily backported!)
> > >
> >
> > Yep, I think this looks like a _much_ simpler approach to the problem.
>
> Agreed!
>
> Cheers,
> --
> Lu?s