Re: How NLM support posix threads?

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

 



On Fri, 2017-02-10 at 14:51 +0530, Pankaj Singh wrote:
> Hi,
> 
> I am getting a strange problem where locks are denied by NFSv3 server
> even though no locks on same file where taken.
> 
> While looking at the code it seems like NLM compares a lock by using
> "pid" and other options like form - to file offset, type of lock etc.
> But we are interested in "pid" because other comparison can be same
> for different file_locks.
> 
>  As we know posix threads use tgid as pid for all its thread hence
> NFSv3 server will can get lock request from different posix thread
> but
> with same pid. Hence NLM  will treat the locking request as they are
> coming from same process. This may result in following problems

Threads that share the same process id belong, by definition, to the
same process.

> 1. Different threads of same process can get lock on same file.

That is precisely how POSIX locks are expected to work in threaded
environments.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
"An exclusive lock shall prevent any other process from setting a
shared lock or an exclusive lock on any portion of the protected area."


> 2. During "fl_grant" callback wrong "block" will be compared hence
> this will result in lock failure even if lock is actually granted.

How so?

> Is this a limitation of NLM?
> 


-- 
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@xxxxxxxxxxxxxxx
��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux