Re: [RFC,PATCH] use rcu for fasync_lock

OGAWA Hirofumi
2003-12-25T15:12:54Z

Manfred Spraul <manfred@colorfullife.com> writes:

> --- 2.6/fs/fcntl.c 2003-12-04 19:44:38.000000000 +0100
> +++ build-2.6/fs/fcntl.c 2003-12-24 00:15:16.000000000 +0100
> @@ -609,9 +609,15 @@
>
> void kill_fasync(struct fasync_struct **fp, int sig, int band)
> {
> - read_lock(&fasync_lock);
> - __kill_fasync(*fp, sig, band);
> - read_unlock(&fasync_lock);
> + /* First a quick test without locking: usually
> + * the list is empty.
> + */
> + if (*fp) {
> + read_lock(&fasync_lock);
> + /* reread *fp after obtaining the lock */
> + __kill_fasync(*fp, sig, band);
> + read_unlock(&fasync_lock);
> + }
> }

Looks good to me. This should be the enough effect for usual path.

Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>