Dave Grothe <[EMAIL PROTECTED]> wrote:
>Good point about clearing the IOCWAIT flag before destoying the
>semaphore.
I started to think that even that may not be enough.
Shouldn't we use spinlocks to protect the pairs like these: ?
spinlock(smth for hd->sd_flag )
if (F_ISSET(hd->sd_flag,IOCWAIT))
lis_wake_up_wiocing(hd);
spinunlock(smth for hd->sd_flag )
spinlock(smth for hd->sd_flag )
CLR_SD_FLAG(hd,IOCWAIT);
SEM_DESTROY(&hd->sd_wiocing) ;
spinunlock(smth for hd->sd_flag )
Say, if in lis_strdoioctl()
1. The IOCWAIT flag is set.
2. The lis_wait_for_wiocing()
is called and immediately exited due to error.
3. Flag is cleared
4. SEM_DESTROY is about to be executed
Meanwhile, in lis_strrput() (running on another CPU)
1. Flag is checked and confirmed
(right at the time between steps (2) and (3) of lis_strdoioctl)
2. The lis_wake_up_wiocing(hd) is started on the semaphore
that is being destroyed.
Looks like this is possible.
Am I missing something?
--
Eugene
Do we really need to call SEM_DESTROY(&hd->sd_wiocing) ?
__________________________________________________________________
Introducing the New Netscape Internet Service.
Only $9.95 a month -- Sign up today at http://isp.netscape.com/register
Netscape. Just the Net You Need.
New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp
_______________________________________________
Linux-streams mailing list
[EMAIL PROTECTED]
http://gsyc.escet.urjc.es/mailman/listinfo/linux-streams