Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1438224 > unrolled thread
| Started by | "Jan Beulich" <JBeulich@suse.com> |
|---|---|
| First post | 2016-07-07 09:30 +0200 |
| Last post | 2016-07-08 13:00 +0200 |
| Articles | 12 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/2] xenbus: xenbus_dev_request_and_reply() adjustments "Jan Beulich" <JBeulich@suse.com> - 2016-07-07 09:30 +0200
[PATCH 2/2] xenbus: simplify xenbus_dev_request_and_reply() "Jan Beulich" <JBeulich@suse.com> - 2016-07-07 09:40 +0200
[PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() "Jan Beulich" <JBeulich@suse.com> - 2016-07-07 09:40 +0200
Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() David Vrabel <david.vrabel@citrix.com> - 2016-07-07 13:40 +0200
Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() "Jan Beulich" <JBeulich@suse.com> - 2016-07-07 14:10 +0200
Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() David Vrabel <david.vrabel@citrix.com> - 2016-07-07 14:20 +0200
Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() "Jan Beulich" <JBeulich@suse.com> - 2016-07-07 14:30 +0200
Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() David Vrabel <david.vrabel@citrix.com> - 2016-07-07 15:20 +0200
Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() David Vrabel <david.vrabel@citrix.com> - 2016-07-07 15:30 +0200
Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() "Jan Beulich" <JBeulich@suse.com> - 2016-07-07 16:00 +0200
Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() David Vrabel <david.vrabel@citrix.com> - 2016-07-08 12:20 +0200
Re: [Xen-devel] [PATCH 0/2] xenbus: xenbus_dev_request_and_reply() adjustments David Vrabel <david.vrabel@citrix.com> - 2016-07-08 13:00 +0200
| From | "Jan Beulich" <JBeulich@suse.com> |
|---|---|
| Date | 2016-07-07 09:30 +0200 |
| Subject | [PATCH 0/2] xenbus: xenbus_dev_request_and_reply() adjustments |
| Message-ID | <rSbUZ-3OW-25@gated-at.bofh.it> |
1: don't bail early from xenbus_dev_request_and_reply() 2: simplify xenbus_dev_request_and_reply() Signed-off-by: Jan Beulich <jbeulich@suse.com>
[toc] | [next] | [standalone]
| From | "Jan Beulich" <JBeulich@suse.com> |
|---|---|
| Date | 2016-07-07 09:40 +0200 |
| Subject | [PATCH 2/2] xenbus: simplify xenbus_dev_request_and_reply() |
| Message-ID | <rSc4G-3S8-19@gated-at.bofh.it> |
| In reply to | #1438224 |
No need to retain a local copy of the full request message, only the
type is really needed.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
drivers/xen/xenbus/xenbus_xs.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
--- 4.7-rc6-xen.orig/drivers/xen/xenbus/xenbus_xs.c
+++ 4.7-rc6-xen/drivers/xen/xenbus/xenbus_xs.c
@@ -232,10 +232,10 @@ static void transaction_resume(void)
void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg)
{
void *ret;
- struct xsd_sockmsg req_msg = *msg;
+ enum xsd_sockmsg_type type = msg->type;
int err;
- if (req_msg.type == XS_TRANSACTION_START)
+ if (type == XS_TRANSACTION_START)
transaction_start();
mutex_lock(&xs_state.request_mutex);
@@ -250,8 +250,7 @@ void *xenbus_dev_request_and_reply(struc
mutex_unlock(&xs_state.request_mutex);
if ((msg->type == XS_TRANSACTION_END) ||
- ((req_msg.type == XS_TRANSACTION_START) &&
- (msg->type == XS_ERROR)))
+ ((type == XS_TRANSACTION_START) && (msg->type == XS_ERROR)))
transaction_end();
return ret;
[toc] | [prev] | [next] | [standalone]
| From | "Jan Beulich" <JBeulich@suse.com> |
|---|---|
| Date | 2016-07-07 09:40 +0200 |
| Subject | [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() |
| Message-ID | <rSc4G-3S8-25@gated-at.bofh.it> |
| In reply to | #1438224 |
We must not skip the transaction_end() call for a failed
XS_TRANSACTION_START. The removed code fragment got introduced by
commit 027bd7e899 ("xen/xenbus: Avoid synchronous wait on XenBus
stalling shutdown/restart") without its description really indicating
why it was added (and hence I can't identify whether a more complex
change might be needed here).
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
drivers/xen/xenbus/xenbus_xs.c | 3 ---
1 file changed, 3 deletions(-)
--- 4.7-rc6-xen.orig/drivers/xen/xenbus/xenbus_xs.c
+++ 4.7-rc6-xen/drivers/xen/xenbus/xenbus_xs.c
@@ -249,9 +249,6 @@ void *xenbus_dev_request_and_reply(struc
mutex_unlock(&xs_state.request_mutex);
- if (IS_ERR(ret))
- return ret;
-
if ((msg->type == XS_TRANSACTION_END) ||
((req_msg.type == XS_TRANSACTION_START) &&
(msg->type == XS_ERROR)))
[toc] | [prev] | [next] | [standalone]
| From | David Vrabel <david.vrabel@citrix.com> |
|---|---|
| Date | 2016-07-07 13:40 +0200 |
| Subject | Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() |
| Message-ID | <rSfOW-6im-9@gated-at.bofh.it> |
| In reply to | #1438233 |
On 07/07/16 08:32, Jan Beulich wrote:
> We must not skip the transaction_end() call for a failed
> XS_TRANSACTION_START. The removed code fragment got introduced by
> commit 027bd7e899 ("xen/xenbus: Avoid synchronous wait on XenBus
> stalling shutdown/restart") without its description really indicating
> why it was added (and hence I can't identify whether a more complex
> change might be needed here).
If sending the XS_TRANSACTION_END message failed, then the transaction
is still open and transaction_end() should not be called.
However, if sending an XS_TRANSACTION_START failed, then
transaction_end() should be called.
So, yes a more complex fix is needed here.
David
[toc] | [prev] | [next] | [standalone]
| From | "Jan Beulich" <JBeulich@suse.com> |
|---|---|
| Date | 2016-07-07 14:10 +0200 |
| Subject | Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() |
| Message-ID | <rSghY-6Ik-29@gated-at.bofh.it> |
| In reply to | #1438539 |
>>> On 07.07.16 at 13:36, <david.vrabel@citrix.com> wrote:
> On 07/07/16 08:32, Jan Beulich wrote:
>> We must not skip the transaction_end() call for a failed
>> XS_TRANSACTION_START. The removed code fragment got introduced by
>> commit 027bd7e899 ("xen/xenbus: Avoid synchronous wait on XenBus
>> stalling shutdown/restart") without its description really indicating
>> why it was added (and hence I can't identify whether a more complex
>> change might be needed here).
>
> If sending the XS_TRANSACTION_END message failed, then the transaction
> is still open and transaction_end() should not be called.
>
> However, if sending an XS_TRANSACTION_START failed, then
> transaction_end() should be called.
>
> So, yes a more complex fix is needed here.
Well, both of the things you name are what happens with the patch
in place. So if those two conditions are all that needs to be satisfied,
then no more complex change is needed afaict (and was the behavior
before the cross referenced commit) - the question really is whether
that other commit meant to deal with something _beyond_ those two
things.
Jan
[toc] | [prev] | [next] | [standalone]
| From | David Vrabel <david.vrabel@citrix.com> |
|---|---|
| Date | 2016-07-07 14:20 +0200 |
| Subject | Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() |
| Message-ID | <rSgrF-6LS-61@gated-at.bofh.it> |
| In reply to | #1438548 |
On 07/07/16 13:09, Jan Beulich wrote:
>>>> On 07.07.16 at 13:36, <david.vrabel@citrix.com> wrote:
>> On 07/07/16 08:32, Jan Beulich wrote:
>>> We must not skip the transaction_end() call for a failed
>>> XS_TRANSACTION_START. The removed code fragment got introduced by
>>> commit 027bd7e899 ("xen/xenbus: Avoid synchronous wait on XenBus
>>> stalling shutdown/restart") without its description really indicating
>>> why it was added (and hence I can't identify whether a more complex
>>> change might be needed here).
>>
>> If sending the XS_TRANSACTION_END message failed, then the transaction
>> is still open and transaction_end() should not be called.
>>
>> However, if sending an XS_TRANSACTION_START failed, then
>> transaction_end() should be called.
>>
>> So, yes a more complex fix is needed here.
>
> Well, both of the things you name are what happens with the patch
> in place. So if those two conditions are all that needs to be satisfied,
> then no more complex change is needed afaict (and was the behavior
> before the cross referenced commit) - the question really is whether
> that other commit meant to deal with something _beyond_ those two
> things.
You call transaction_end() if msg->type == XS_TRANSACTION_END, even if
xb_write() returned an error.
David
[toc] | [prev] | [next] | [standalone]
| From | "Jan Beulich" <JBeulich@suse.com> |
|---|---|
| Date | 2016-07-07 14:30 +0200 |
| Subject | Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() |
| Message-ID | <rSgBk-6Qy-21@gated-at.bofh.it> |
| In reply to | #1438552 |
>>> On 07.07.16 at 14:17, <david.vrabel@citrix.com> wrote:
> On 07/07/16 13:09, Jan Beulich wrote:
>>>>> On 07.07.16 at 13:36, <david.vrabel@citrix.com> wrote:
>>> On 07/07/16 08:32, Jan Beulich wrote:
>>>> We must not skip the transaction_end() call for a failed
>>>> XS_TRANSACTION_START. The removed code fragment got introduced by
>>>> commit 027bd7e899 ("xen/xenbus: Avoid synchronous wait on XenBus
>>>> stalling shutdown/restart") without its description really indicating
>>>> why it was added (and hence I can't identify whether a more complex
>>>> change might be needed here).
>>>
>>> If sending the XS_TRANSACTION_END message failed, then the transaction
>>> is still open and transaction_end() should not be called.
>>>
>>> However, if sending an XS_TRANSACTION_START failed, then
>>> transaction_end() should be called.
>>>
>>> So, yes a more complex fix is needed here.
>>
>> Well, both of the things you name are what happens with the patch
>> in place. So if those two conditions are all that needs to be satisfied,
>> then no more complex change is needed afaict (and was the behavior
>> before the cross referenced commit) - the question really is whether
>> that other commit meant to deal with something _beyond_ those two
>> things.
>
> You call transaction_end() if msg->type == XS_TRANSACTION_END, even if
> xb_write() returned an error.
When xb_write() returns an error, msg->type gets set to XS_ERROR.
Jan
[toc] | [prev] | [next] | [standalone]
| From | David Vrabel <david.vrabel@citrix.com> |
|---|---|
| Date | 2016-07-07 15:20 +0200 |
| Subject | Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() |
| Message-ID | <rShnI-7n8-19@gated-at.bofh.it> |
| In reply to | #1438561 |
On 07/07/16 13:23, Jan Beulich wrote:
>>>> On 07.07.16 at 14:17, <david.vrabel@citrix.com> wrote:
>> On 07/07/16 13:09, Jan Beulich wrote:
>>>>>> On 07.07.16 at 13:36, <david.vrabel@citrix.com> wrote:
>>>> On 07/07/16 08:32, Jan Beulich wrote:
>>>>> We must not skip the transaction_end() call for a failed
>>>>> XS_TRANSACTION_START. The removed code fragment got introduced by
>>>>> commit 027bd7e899 ("xen/xenbus: Avoid synchronous wait on XenBus
>>>>> stalling shutdown/restart") without its description really indicating
>>>>> why it was added (and hence I can't identify whether a more complex
>>>>> change might be needed here).
>>>>
>>>> If sending the XS_TRANSACTION_END message failed, then the transaction
>>>> is still open and transaction_end() should not be called.
>>>>
>>>> However, if sending an XS_TRANSACTION_START failed, then
>>>> transaction_end() should be called.
>>>>
>>>> So, yes a more complex fix is needed here.
>>>
>>> Well, both of the things you name are what happens with the patch
>>> in place. So if those two conditions are all that needs to be satisfied,
>>> then no more complex change is needed afaict (and was the behavior
>>> before the cross referenced commit) - the question really is whether
>>> that other commit meant to deal with something _beyond_ those two
>>> things.
>>
>> You call transaction_end() if msg->type == XS_TRANSACTION_END, even if
>> xb_write() returned an error.
>
> When xb_write() returns an error, msg->type gets set to XS_ERROR.
So?
if ((msg->type == XS_TRANSACTION_END) ||
(...))
transaction_end();
We don't check msg->type for XS_TRANSACTION_END messages.
David
[toc] | [prev] | [next] | [standalone]
| From | David Vrabel <david.vrabel@citrix.com> |
|---|---|
| Date | 2016-07-07 15:30 +0200 |
| Subject | Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() |
| Message-ID | <rShxo-7rQ-21@gated-at.bofh.it> |
| In reply to | #1438614 |
On 07/07/16 14:13, David Vrabel wrote:
> On 07/07/16 13:23, Jan Beulich wrote:
>>>>> On 07.07.16 at 14:17, <david.vrabel@citrix.com> wrote:
>>> On 07/07/16 13:09, Jan Beulich wrote:
>>>>>>> On 07.07.16 at 13:36, <david.vrabel@citrix.com> wrote:
>>>>> On 07/07/16 08:32, Jan Beulich wrote:
>>>>>> We must not skip the transaction_end() call for a failed
>>>>>> XS_TRANSACTION_START. The removed code fragment got introduced by
>>>>>> commit 027bd7e899 ("xen/xenbus: Avoid synchronous wait on XenBus
>>>>>> stalling shutdown/restart") without its description really indicating
>>>>>> why it was added (and hence I can't identify whether a more complex
>>>>>> change might be needed here).
>>>>>
>>>>> If sending the XS_TRANSACTION_END message failed, then the transaction
>>>>> is still open and transaction_end() should not be called.
>>>>>
>>>>> However, if sending an XS_TRANSACTION_START failed, then
>>>>> transaction_end() should be called.
>>>>>
>>>>> So, yes a more complex fix is needed here.
>>>>
>>>> Well, both of the things you name are what happens with the patch
>>>> in place. So if those two conditions are all that needs to be satisfied,
>>>> then no more complex change is needed afaict (and was the behavior
>>>> before the cross referenced commit) - the question really is whether
>>>> that other commit meant to deal with something _beyond_ those two
>>>> things.
>>>
>>> You call transaction_end() if msg->type == XS_TRANSACTION_END, even if
>>> xb_write() returned an error.
>>
>> When xb_write() returns an error, msg->type gets set to XS_ERROR.
>
> So?
>
> if ((msg->type == XS_TRANSACTION_END) ||
> (...))
> transaction_end();
>
> We don't check msg->type for XS_TRANSACTION_END messages.
Sorry, being stupid. Yeah, the change is fine but it needs a better
commit message.
David
[toc] | [prev] | [next] | [standalone]
| From | "Jan Beulich" <JBeulich@suse.com> |
|---|---|
| Date | 2016-07-07 16:00 +0200 |
| Subject | Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() |
| Message-ID | <rSi0q-7C9-35@gated-at.bofh.it> |
| In reply to | #1438619 |
>>> On 07.07.16 at 15:22, <david.vrabel@citrix.com> wrote:
> On 07/07/16 14:13, David Vrabel wrote:
>> On 07/07/16 13:23, Jan Beulich wrote:
>>>>>> On 07.07.16 at 14:17, <david.vrabel@citrix.com> wrote:
>>>> On 07/07/16 13:09, Jan Beulich wrote:
>>>>>>>> On 07.07.16 at 13:36, <david.vrabel@citrix.com> wrote:
>>>>>> On 07/07/16 08:32, Jan Beulich wrote:
>>>>>>> We must not skip the transaction_end() call for a failed
>>>>>>> XS_TRANSACTION_START. The removed code fragment got introduced by
>>>>>>> commit 027bd7e899 ("xen/xenbus: Avoid synchronous wait on XenBus
>>>>>>> stalling shutdown/restart") without its description really indicating
>>>>>>> why it was added (and hence I can't identify whether a more complex
>>>>>>> change might be needed here).
>>>>>>
>>>>>> If sending the XS_TRANSACTION_END message failed, then the transaction
>>>>>> is still open and transaction_end() should not be called.
>>>>>>
>>>>>> However, if sending an XS_TRANSACTION_START failed, then
>>>>>> transaction_end() should be called.
>>>>>>
>>>>>> So, yes a more complex fix is needed here.
>>>>>
>>>>> Well, both of the things you name are what happens with the patch
>>>>> in place. So if those two conditions are all that needs to be satisfied,
>>>>> then no more complex change is needed afaict (and was the behavior
>>>>> before the cross referenced commit) - the question really is whether
>>>>> that other commit meant to deal with something _beyond_ those two
>>>>> things.
>>>>
>>>> You call transaction_end() if msg->type == XS_TRANSACTION_END, even if
>>>> xb_write() returned an error.
>>>
>>> When xb_write() returns an error, msg->type gets set to XS_ERROR.
>>
>> So?
>>
>> if ((msg->type == XS_TRANSACTION_END) ||
>> (...))
>> transaction_end();
>>
>> We don't check msg->type for XS_TRANSACTION_END messages.
>
> Sorry, being stupid. Yeah, the change is fine but it needs a better
> commit message.
I can certainly omit the part in parentheses. I don't think I should
omit the reference to the original commit having introduced the issue.
And without a more specific hint I also don't know what else may
need changing. I'm sorry, I know I'm not doing very well in writing
commit messages to your liking.
Jan
[toc] | [prev] | [next] | [standalone]
| From | David Vrabel <david.vrabel@citrix.com> |
|---|---|
| Date | 2016-07-08 12:20 +0200 |
| Subject | Re: [Xen-devel] [PATCH 1/2] xenbus: don't bail early from xenbus_dev_request_and_reply() |
| Message-ID | <rSB35-3r2-69@gated-at.bofh.it> |
| In reply to | #1438638 |
On 07/07/16 14:35, Jan Beulich wrote:
>>>> On 07.07.16 at 15:22, <david.vrabel@citrix.com> wrote:
>> On 07/07/16 14:13, David Vrabel wrote:
>>> On 07/07/16 13:23, Jan Beulich wrote:
>>>>>>> On 07.07.16 at 14:17, <david.vrabel@citrix.com> wrote:
>>>>> On 07/07/16 13:09, Jan Beulich wrote:
>>>>>>>>> On 07.07.16 at 13:36, <david.vrabel@citrix.com> wrote:
>>>>>>> On 07/07/16 08:32, Jan Beulich wrote:
>>>>>>>> We must not skip the transaction_end() call for a failed
>>>>>>>> XS_TRANSACTION_START. The removed code fragment got introduced by
>>>>>>>> commit 027bd7e899 ("xen/xenbus: Avoid synchronous wait on XenBus
>>>>>>>> stalling shutdown/restart") without its description really indicating
>>>>>>>> why it was added (and hence I can't identify whether a more complex
>>>>>>>> change might be needed here).
>>>>>>>
>>>>>>> If sending the XS_TRANSACTION_END message failed, then the transaction
>>>>>>> is still open and transaction_end() should not be called.
>>>>>>>
>>>>>>> However, if sending an XS_TRANSACTION_START failed, then
>>>>>>> transaction_end() should be called.
>>>>>>>
>>>>>>> So, yes a more complex fix is needed here.
>>>>>>
>>>>>> Well, both of the things you name are what happens with the patch
>>>>>> in place. So if those two conditions are all that needs to be satisfied,
>>>>>> then no more complex change is needed afaict (and was the behavior
>>>>>> before the cross referenced commit) - the question really is whether
>>>>>> that other commit meant to deal with something _beyond_ those two
>>>>>> things.
>>>>>
>>>>> You call transaction_end() if msg->type == XS_TRANSACTION_END, even if
>>>>> xb_write() returned an error.
>>>>
>>>> When xb_write() returns an error, msg->type gets set to XS_ERROR.
>>>
>>> So?
>>>
>>> if ((msg->type == XS_TRANSACTION_END) ||
>>> (...))
>>> transaction_end();
>>>
>>> We don't check msg->type for XS_TRANSACTION_END messages.
>>
>> Sorry, being stupid. Yeah, the change is fine but it needs a better
>> commit message.
>
> I can certainly omit the part in parentheses. I don't think I should
> omit the reference to the original commit having introduced the issue.
> And without a more specific hint I also don't know what else may
> need changing. I'm sorry, I know I'm not doing very well in writing
> commit messages to your liking.
I rewrote it as:
xenbus: don't bail early from xenbus_dev_request_and_reply()
xenbus_dev_request_and_reply() needs to track whether a transaction is
open. For XS_TRANSACTION_START messages it calls transaction_start()
and for XS_TRANSACTION_END messages it calls transaction_end().
If sending an XS_TRANSACTION_START message fails or responds with an
an error, the transaction is not open and transaction_end() must be
called.
If sending an XS_TRANSACTION_END message fails, the transaction is
still open, but if an error response is returned the transaction is
closed.
Commit 027bd7e89906 ("xen/xenbus: Avoid synchronous wait on XenBus
stalling shutdown/restart") introduced a regression where failed
XS_TRANSACTION_START messages were leaving the transaction open. This
can cause problems with suspend (and migration) as all transaction must
be closed before suspending.
It appears that the problematic change was added accidentally, so just
remove it.
David
[toc] | [prev] | [next] | [standalone]
| From | David Vrabel <david.vrabel@citrix.com> |
|---|---|
| Date | 2016-07-08 13:00 +0200 |
| Subject | Re: [Xen-devel] [PATCH 0/2] xenbus: xenbus_dev_request_and_reply() adjustments |
| Message-ID | <rSBFM-3Gr-21@gated-at.bofh.it> |
| In reply to | #1438224 |
On 07/07/16 08:25, Jan Beulich wrote: > 1: don't bail early from xenbus_dev_request_and_reply() > 2: simplify xenbus_dev_request_and_reply() Applied to for-linus-4.7b, thanks. David
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web