tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: struct file reference at VFS level



Emmanuel Dreyfus <manu%netbsd.org@localhost> writes:

>> (...) proposed mandatory lock feature checks for locks during
>> every data modifying fops. And hence we make use of fd flags too. Let
>> me explain the scenario from my test case:
>>
>> Process 1 opens file 'foo' with O_RDWR and acquires a shared byte range
>> lock. Process 2 opens the same file 'foo' with O_RDWR|O_NONBLOCK so as
>> to fail the next write in case a conflicting lock is found. Both
>> processes are acting on the same mount point and hence we have the
>> issue of reusing the previous open which does not contain O_NONBLOCK
>> flag. As a result instead of failing the write fop it will continue to
>> wait until the conflicting byte range lock is released.

I still don't understand why this is about FUSE.  What if a file were
opened without O_NONBLOCK and then the same file were opened with?  Why
isn't that the same situation, and the same bug?   It seems that either

  NONBLOCK has to be passed to VOP_OPEN, and then vnodes cannot be
  reused for other fd access to the same file, or

  all these flags need to be passed in per operation

and a middle ground is unsound.  But maybe I'm missing something.

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index