tech-kern archive

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

Re: struct file reference at VFS level

On Fri, Apr 29, 2016 at 10:13:13AM +0200, J. Hannken-Illjes wrote:
> Advertised locks are already implemented inside the file systems and
> we have VOP_ADVLOCK() with ?op == F_GETLK?. What else is needed to
> make the decision here?

In advisory locks, the only place where the filesystem checks locks
status is when you try to acquire a lock. VOP_ADVLOCK has the duty 
to tell you if the region is already locked by someone else. But any
other operation such as VOP_WRITE just proceed without regards for 
locking status. The lock is adivsory and should be enforced by the

With mandatory locks, the filesystems will actually enforce the locks.
VOP_WRITE to a region locked by another process must fail.

> I strongly object against an implementation whose specification starts:
>   The Linux implementation is prey to a number of difficult-to-fix race
>   conditions which in practice make it not dependable:

This warning about the Linux *implementation* status is not actually 
part of the specification. In other words, this specification does not
mandate the implementation to be broken.

Moreover, the only candidate so far to implement mandatory locking
is a filesystem in userspace, which means the broken cases described
do not really apply: you can always recover by killing the userspace

Emmanuel Dreyfus

Home | Main Index | Thread Index | Old Index