All of lore.kernel.org
 help / color / mirror / Atom feed
From: "avagin@gmail.com" <avagin@gmail.com>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: Andrew Vagin <avagin@openvz.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-hotplug@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] uevent: send events in correct order according to seqnum
Date: Tue, 06 Mar 2012 21:14:04 +0000	[thread overview]
Message-ID: <4F567E1C.80003@gmail.com> (raw)
In-Reply-To: <CAPXgP10qwPn2-QeyPpDy3GiEqvU6jB-wVuUOUXwcGBvOWOUA1Q@mail.gmail.com>

On 03/07/2012 01:03 AM, Kay Sievers wrote:
> On Tue, Mar 6, 2012 at 21:06, Andrew Vagin<avagin@openvz.org>  wrote:
>>
>> The queue handling in the udev daemon assumes that the events are
>> ordered.
>>
>> Before this patch uevent_seqnum is incremented under sequence_lock,
>> than an event is send uner uevent_sock_mutex. I want to say that code
>> contained a window between incrementing seqnum and sending an event.
>>
>> This patch locks uevent_sock_mutex before incrementing uevent_seqnum.
>
> I think we can remove the spin_lock(&sequence_lock); entirely now, right?

I thought about that too. sequence_lock is used when CONFIG_NET isn't 
defined. I've looked on this code one more time and we may leave only 
uevent_sock_mutex and use it even when CONFIG_NET isn't defined.
Thanks for the comment.

Greg, do you have other objections about this patch?

>
> Also the section with:
>    seq = ++uevent_seqnum;
> can just be:
>    add_uevent_var(env, "SEQNUM=%llu", (unsigned long long) ++uevent_seqnum);
> right?
>
> And the:
>    mutex_lock(&uevent_sock_mutex);
> can just move outside of the _NET ifdef and we always use the mutex
> instead of the spinlock?
>
> That could look much simpler than the current code, I think.
>
> Thanks,
> Kay


WARNING: multiple messages have this Message-ID (diff)
From: "avagin@gmail.com" <avagin@gmail.com>
To: Kay Sievers <kay.sievers@vrfy.org>
Cc: Andrew Vagin <avagin@openvz.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-hotplug@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] uevent: send events in correct order according to seqnum
Date: Wed, 07 Mar 2012 01:14:04 +0400	[thread overview]
Message-ID: <4F567E1C.80003@gmail.com> (raw)
In-Reply-To: <CAPXgP10qwPn2-QeyPpDy3GiEqvU6jB-wVuUOUXwcGBvOWOUA1Q@mail.gmail.com>

On 03/07/2012 01:03 AM, Kay Sievers wrote:
> On Tue, Mar 6, 2012 at 21:06, Andrew Vagin<avagin@openvz.org>  wrote:
>>
>> The queue handling in the udev daemon assumes that the events are
>> ordered.
>>
>> Before this patch uevent_seqnum is incremented under sequence_lock,
>> than an event is send uner uevent_sock_mutex. I want to say that code
>> contained a window between incrementing seqnum and sending an event.
>>
>> This patch locks uevent_sock_mutex before incrementing uevent_seqnum.
>
> I think we can remove the spin_lock(&sequence_lock); entirely now, right?

I thought about that too. sequence_lock is used when CONFIG_NET isn't 
defined. I've looked on this code one more time and we may leave only 
uevent_sock_mutex and use it even when CONFIG_NET isn't defined.
Thanks for the comment.

Greg, do you have other objections about this patch?

>
> Also the section with:
>    seq = ++uevent_seqnum;
> can just be:
>    add_uevent_var(env, "SEQNUM=%llu", (unsigned long long) ++uevent_seqnum);
> right?
>
> And the:
>    mutex_lock(&uevent_sock_mutex);
> can just move outside of the _NET ifdef and we always use the mutex
> instead of the spinlock?
>
> That could look much simpler than the current code, I think.
>
> Thanks,
> Kay


  reply	other threads:[~2012-03-06 21:14 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-06  8:48 [PATCH] udev: fix problem due to unsorted events Andrey Vagin
2012-03-06 11:06 ` Kay Sievers
2012-03-06 12:43 ` Kay Sievers
2012-03-06 20:06   ` [PATCH] uevent: send events in correct order according to seqnum Andrew Vagin
2012-03-06 20:06     ` Andrew Vagin
2012-03-06 21:03     ` Kay Sievers
2012-03-06 21:03       ` Kay Sievers
2012-03-06 21:14       ` avagin [this message]
2012-03-06 21:14         ` avagin
2012-03-07  5:52         ` Greg Kroah-Hartman
2012-03-07  5:52           ` Greg Kroah-Hartman
2012-03-07  9:59     ` [PATCH] uevent: send events in correct order according to seqnum (v2) Andrew Vagin
2012-03-07  9:59       ` Andrew Vagin
2012-03-07 10:18       ` Kay Sievers
2012-03-07 10:18         ` Kay Sievers
2012-03-07 10:49     ` [PATCH] uevent: send events in correct order according to seqnum (v3) Andrew Vagin
2012-03-07 10:49       ` Andrew Vagin
2012-03-07 11:03       ` Kay Sievers
2012-03-07 11:03         ` Kay Sievers
2012-03-07 15:45       ` Greg Kroah-Hartman
2012-03-07 15:45         ` Greg Kroah-Hartman
2012-03-07 17:34         ` Andrew Wagin
2012-03-07 17:34           ` Andrew Wagin
2012-03-07 17:47           ` Greg Kroah-Hartman
2012-03-07 17:47             ` Greg Kroah-Hartman

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=4F567E1C.80003@gmail.com \
    --to=avagin@gmail.com \
    --cc=avagin@openvz.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.