Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Apr 2014 16:48:14 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Kohji Okuno <okuno.kohji@jp.panasonic.com>
Cc:        freebsd-current@freebsd.org
Subject:   Re: kevent has bug?
Message-ID:  <20140403134814.GT21331@kib.kiev.ua>
In-Reply-To: <20140403.182656.1696050559410663288.okuno.kohji@jp.panasonic.com>
References:  <20140402120745.GN21331@kib.kiev.ua> <20140402164542.GC3270@funkthat.com> <20140402174400.GR21331@kib.kiev.ua> <20140403.182656.1696050559410663288.okuno.kohji@jp.panasonic.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--u+HAydxlPP+oPOdi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Apr 03, 2014 at 06:26:56PM +0900, Kohji Okuno wrote:
> > The done_ev_add case is indeed missed in my patch, thank you for noting.
> > The case of EV_ADD does not need the KN_SCAN workaround, IMO, since the
> > race is possible just by the nature of adding the knote.

> I think, we should add KN_SCAN after knote_attach() in
> kqueue_register(), too. What do you think about this?
See above, I noted this case in the previous mail.  This may be elaborated.

First, I think it is technically incorrect to allow the event
notification before the f_attach() method is finished. So the KN_SCAN
flag could be set only after f_attach() call, but due to both kq and
knlist not locked there, we still have the same race. And this race is
in fact acceptable, since it is the race between application calling
EV_ADD, and external event occuring, which cannot be avoided. Until the
kevent(EV_ADD) syscall returned, we do not have an obligation to report
the event from the kqfd. Having the race somewhat bigger by not setting
KN_SCAN is fine in my opinion.

--u+HAydxlPP+oPOdi
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)

iQIcBAEBAgAGBQJTPWaeAAoJEJDCuSvBvK1BDRwP/2L0d3i4RjQSopdNcrnoo+tl
W+ITV0PYmSLDQ9T98Mq9uSsLhB/e2HQgnwg9dY7oJ0GNvOaNOSVxn3ntutsd2jeT
JvIy/8fEGsKpFbhLxjbU7aTlBHsAPadFVBCuwpQQs20nCUcK7kuEbYjvMfIu3/kO
ycGjM25YMgeFlmSkmngcehWziHhRe0oJ195ftl1ThL3KwX5rKHTDfZ9SSny8PdqN
c7DHP+aBL/r3jxgbNMrrZ3NIPnQsXGXo4UYymgsAedKeNr3K0pgUzyhdQnL775Y8
sHtgPk4oq76Bt4F28LVSm7AzPlyMALRnvfe7j/fz3jmSEVCMOxqFXtHhITQS52Ze
H1K55fy8HvzrxqnzEBWLFN6sN8YVZPzDD6n3+5C69RdOPWORxIp8Adx/tePClTme
F9wx99dGd8caFUvoKBDC9uaX06fltvTZ3ovB8es0HE8kQS2pI29+egC9d8UgFLIc
lHPmwyds7RxITUjS1PudE5K4jqwi0ujWxQeHNrgdxm5hgDtuP0d+Gvi3bgPLQXoz
ImhkShtkG2StOS18GIoneWFfQHP7TZab5ayQBDn546LfJDAiAy0UJCZYWJ/I1XKW
shHBXNy+2OdUErAPekLSbu0BimsBRn3kp3vnGchW5SOj/xHEt9FofO7P9JoYRrlO
xoEI0KYN4tb44Nst6cy4
=g7Ji
-----END PGP SIGNATURE-----

--u+HAydxlPP+oPOdi--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140403134814.GT21331>