Re: [PATCH v2] sg: O_EXCL and other lock handling

2013-11-07 Thread Christoph Hellwig
On Wed, Nov 06, 2013 at 02:30:40PM -0500, Douglas Gilbert wrote: > >during sg_open and sg_release, which are guranteed not to migrate > >to a different process during their run time. > > True. What I stated would be a problem if a mutex tried > to do something similar to Vaughan's patch that was >

Re: [PATCH v2] sg: O_EXCL and other lock handling

2013-11-06 Thread Douglas Gilbert
On 13-11-06 10:50 AM, Christoph Hellwig wrote: On Thu, Oct 31, 2013 at 03:20:32PM -0400, Douglas Gilbert wrote: Yes, it is being used as a mutex. However looking at their semantics (mutex.h versus semaphore.h), a mutex takes into account the task owner. If the user space wants to pass around a s

Re: [PATCH v2] sg: O_EXCL and other lock handling

2013-11-06 Thread Christoph Hellwig
On Thu, Oct 31, 2013 at 03:20:32PM -0400, Douglas Gilbert wrote: > Yes, it is being used as a mutex. However looking at > their semantics (mutex.h versus semaphore.h), a mutex > takes into account the task owner. If the user space > wants to pass around a sg file descriptor in a Unix > domain socke

Re: [PATCH v2] sg: O_EXCL and other lock handling

2013-11-02 Thread Vaughan Cao
On 2013年11月03日 02:22, Douglas Gilbert wrote: On 13-11-01 01:16 AM, vaughan wrote: I do not follow the last point but that is not important. For reasons that I listed in a private post I think that my patch presented in this thread is closer to our goals than your patch (2013/6/17/319). Timing

Re: [PATCH v2] sg: O_EXCL and other lock handling

2013-11-02 Thread Douglas Gilbert
On 13-11-01 01:16 AM, vaughan wrote: On 11/01/2013 03:20 AM, Douglas Gilbert wrote: On 13-10-31 11:56 AM, Christoph Hellwig wrote: +struct semaphore or_sem; /* protect co-incident opens and releases */ Seems like this should be a mutex. Yes, it is being used as a mutex. However looking

Re: [PATCH v2] sg: O_EXCL and other lock handling

2013-10-31 Thread vaughan
On 11/01/2013 03:20 AM, Douglas Gilbert wrote: > On 13-10-31 11:56 AM, Christoph Hellwig wrote: >>> +struct semaphore or_sem; /* protect co-incident opens and >>> releases */ >> >> Seems like this should be a mutex. > > Yes, it is being used as a mutex. However looking at > their semantics (mu

Re: [PATCH v2] sg: O_EXCL and other lock handling

2013-10-31 Thread vaughan
On 11/01/2013 03:20 AM, Douglas Gilbert wrote: > On 13-10-31 11:56 AM, Christoph Hellwig wrote: >>> +struct semaphore or_sem; /* protect co-incident opens and >>> releases */ >> >> Seems like this should be a mutex. > > Yes, it is being used as a mutex. However looking at > their semantics (mu

Re: [PATCH v2] sg: O_EXCL and other lock handling

2013-10-31 Thread Douglas Gilbert
On 13-10-31 11:56 AM, Christoph Hellwig wrote: + struct semaphore or_sem; /* protect co-incident opens and releases */ Seems like this should be a mutex. Yes, it is being used as a mutex. However looking at their semantics (mutex.h versus semaphore.h), a mutex takes into account the ta

Re: [PATCH v2] sg: O_EXCL and other lock handling

2013-10-31 Thread Christoph Hellwig
> + struct semaphore or_sem; /* protect co-incident opens and releases */ Seems like this should be a mutex. > sfds_list_empty(Sg_device *sdp) > { > unsigned long flags; > int ret; > > + spin_lock_irqsave(&sdp->sfd_lock, flags); > + ret = list_empty(&sdp->sfds); > +