Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

messages/MOSDOp: a fixes of encode_payload #16836

Merged
merged 1 commit into from Aug 22, 2017

Conversation

heyingstar
Copy link
Contributor

@heyingstar heyingstar commented Aug 5, 2017

If we set config ms_dump_on_send,the function encode may run twice.Then data will double of normal data.
the function SimpleMessenger::submit_message or AsyncMessenger::submit_message may run m->encode(-1, MSG_CRC_ALL).This code can run MOSDOp::encode_payload.
when the function of encode run twice.the code OSDOp::merge_osd_op_vector_in_data will run twice.
so we should add data.clear() at begin of encode_payload.

Signed-off-by: Ying He heyingbj@inspur.com

@heyingstar
Copy link
Contributor Author

@joscollin make check failed?why?please give me some help.Thinks.

@joscollin
Copy link
Member

Jenkins retest this please

@joscollin
Copy link
Member

@heyingstar I have given a retest.

@heyingstar
Copy link
Contributor Author

heyingstar commented Aug 5, 2017

@yuyuyu101 please help me for review this.Thanks.

@heyingstar
Copy link
Contributor Author

heyingstar commented Aug 5, 2017

@liewegas can you help me for review this?Thanks.

`

Copy link
Member

@gregsfortytwo gregsfortytwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned about this. MOSDOp has other functions which write directly into the data bufferlist, although I'm not sure they're actually used — can you remove them if they're not? If they are in use, we'll need to do something to prevent them causing issues.
You did catch the only user of get_data() which seems to break this though, so good job there! :)

@heyingstar
Copy link
Contributor Author

heyingstar commented Aug 9, 2017

@gregsfortytwo Yes,I know it.we should make sure the data is private.if someone hope to add data to msg,who must add it to ops[0].indata.
For example the code ::encode(map, subop->get_data()); replace of ::encode(map, scrub[0].indata);.
BTW,I don't have better idea of this mistake.Please send me a message when you have another idea.Thank you.

If i could modify more codes,I can do this:
const bufferlist& get_data() { return data; },

@gregsfortytwo
Copy link
Member

Sounds like you've identified the basic possibilities. I think I'd prefer making get_data() return a const bufferlist& and making data a private member? Not sure though.

@heyingstar
Copy link
Contributor Author

heyingstar commented Aug 12, 2017

@gregsfortytwo If i fix this mistake with const bufferlist& get_data();.I should modify many many code,and modify many many modules. I think this will be a new feature,not a bug fix.
Can I fix this bug with data.clear(); ?
And I will pull a new feature with const bufferlist& get_data(); in next weak or next next weak.
what is your mean?
thanks.

@gregsfortytwo
Copy link
Member

My concern is that this is a very high-risk change. If anybody adds direct data bufferlist manipulation, or we missed some obtuse way it happens, then it breaks horribly and it won't be clear why.

@gregsfortytwo
Copy link
Member

Couldn't we also just mark a flag for if the op vector has already been merged into the data bl, and not do it repeatedly? That seems like a much simpler, smaller fix!

@heyingstar
Copy link
Contributor Author

@gregsfortytwo Yes,I see.
I think you are right.If we fix this bug with much simpler,smaller code.Someone else can use this code as before.
I will modify this PR with your mind.Thank you. :)

And I will pull a new feature with const bufferlist& get_data().We can talk about this in new PR.

@@ -244,7 +244,7 @@ class MOSDOp : public MOSDFastDispatchOp {

// marshalling
void encode_payload(uint64_t features) override {

data.clear();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heyingstar tab space left

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.
I update code now.

@@ -154,7 +154,7 @@ class MOSDOpReply : public Message {

public:
void encode_payload(uint64_t features) override {

data.clear();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heyingstar Tab space left

@heyingstar
Copy link
Contributor Author

@gregsfortytwo I update the code now with your mind.
I think your are very right.This is the best choice of the bug fix now.
Thanks.

@gregsfortytwo
Copy link
Member

Can you squash this down to a single commit? We don't want both of them and the master merge in patch history. :)

@heyingstar
Copy link
Contributor Author

Ok.
Wait a moment.

@heyingstar heyingstar force-pushed the bug-ms_dump_on_send-doubledata branch 4 times, most recently from d077b8e to d96f2a8 Compare August 15, 2017 23:23
@heyingstar heyingstar closed this Aug 15, 2017
@heyingstar heyingstar force-pushed the bug-ms_dump_on_send-doubledata branch from d96f2a8 to 4e6487c Compare August 15, 2017 23:29
@heyingstar heyingstar reopened this Aug 15, 2017
@heyingstar heyingstar closed this Aug 15, 2017
@heyingstar heyingstar force-pushed the bug-ms_dump_on_send-doubledata branch from 5447f8d to c834140 Compare August 15, 2017 23:41
@heyingstar heyingstar reopened this Aug 15, 2017
If we set config ms_dump_on_send,the function encode may run twice.
Then data will double of normal data.

Signed-off-by: Ying He <heyingbj@inspur.com>
@heyingstar heyingstar force-pushed the bug-ms_dump_on_send-doubledata branch from 05b080d to a36ee8c Compare August 15, 2017 23:54
@heyingstar
Copy link
Contributor Author

@gregsfortytwo I squash this PR to a single commit.

Copy link
Member

@gregsfortytwo gregsfortytwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed-by: Greg Farnum gfarnum@redhat.com

This still needs to get run through an integration branch test suite before merge; it may be a few days but will happen eventually.

@yuriw
Copy link
Contributor

yuriw commented Aug 22, 2017

jenkins test docs

1 similar comment
@alfredodeza
Copy link
Contributor

jenkins test docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants