2005-02-27 19:20:49

by Neil Horman

[permalink] [raw]
Subject: [RFC] implementing BSD style locks on NLM (flocks)

Hey all-
I was wondering, how much interest there might be in the addition of
support for BSD style locks (flocks) over NLM. I was thinking that a bit could
be added to differentiate the two namespaces. Any thoughts appreciated.

Regards,
Neil
--
/***************************************************
*Neil Horman
*Software Engineer
*Red Hat, Inc.
*[email protected]
*gpg keyid: 1024D / 0x92A74FA1
*http://pgp.mit.edu
***************************************************/


Attachments:
(No filename) (484.00 B)
(No filename) (189.00 B)
Download all attachments

2005-03-03 18:24:27

by Neil Horman

[permalink] [raw]
Subject: Re: [RFC] implementing BSD style locks on NLM (flocks)

On Wed, Mar 02, 2005 at 10:10:34AM -0800, Trond Myklebust wrote:
> su den 27.02.2005 Klokka 14:21 (-0500) skreiv [email protected]:
> > Hey all-
> > I was wondering, how much interest there might be in the addition of
> > support for BSD style locks (flocks) over NLM. I was thinking that a bit could
> > be added to differentiate the two namespaces. Any thoughts appreciated.
>
> http://client.linux-nfs.org/Linux-2.6.x/2.6.11-rc5/linux-2.6.11-17-flock.dif
>
> Cheers,
> Trond
>
> --
> Trond Myklebust <[email protected]>
>
Do you know when this will get merged with the mainline kernel?
Thanks!
Neil

--
/***************************************************
*Neil Horman
*Software Engineer
*Red Hat, Inc.
*[email protected]
*gpg keyid: 1024D / 0x92A74FA1
*http://pgp.mit.edu
***************************************************/


Attachments:
(No filename) (860.00 B)
(No filename) (189.00 B)
Download all attachments

2005-03-04 15:03:10

by G. Allen Morris III

[permalink] [raw]
Subject: statd -o change

Trond,

I would think that statd should fail if the outgoing port can't be bound
to. The main reason to bind to a particular outgoing port is because of
a firewall. If the is the reasond the statd is not going to work on if
it uses a random port.

Allen <[email protected]>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2005-03-04 15:34:51

by G. Allen Morris III

[permalink] [raw]
Subject: statd -o change

Trond,

I would think that statd should fail if the requested outgoing port (-o)
can't be bound to. The main reason to bind to a particular outgoing port
is because of a firewall. If a random port is used statd will not make
it through the firewall, but the log file will have to be checked to
find out why statd is not working (falling back on randomly chosen port).

Not starting statd seems to be the failure mode if the rpc.statd port
(-p) can't be bound to.

Allen <[email protected]>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2005-03-14 15:29:32

by Trond Myklebust

[permalink] [raw]
Subject: Re: [RFC] implementing BSD style locks on NLM (flocks)

to den 03.03.2005 Klokka 13:24 (-0500) skreiv [email protected]:
> On Wed, Mar 02, 2005 at 10:10:34AM -0800, Trond Myklebust wrote:
> > su den 27.02.2005 Klokka 14:21 (-0500) skreiv [email protected]:
> > > Hey all-
> > > I was wondering, how much interest there might be in the addition of
> > > support for BSD style locks (flocks) over NLM. I was thinking that a bit could
> > > be added to differentiate the two namespaces. Any thoughts appreciated.
> >
> > http://client.linux-nfs.org/Linux-2.6.x/2.6.11-rc5/linux-2.6.11-17-flock.dif
> >
> > Cheers,
> > Trond
> >
> > --
> > Trond Myklebust <[email protected]>
> >
> Do you know when this will get merged with the mainline kernel?
> Thanks!
> Neil

I'm pretty sure, yes. The date for merging was last Thursday. ;-)

Cheers,
Trond
--
Trond Myklebust <[email protected]>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2005-03-02 15:56:49

by Olaf Kirch

[permalink] [raw]
Subject: Re: [RFC] implementing BSD style locks on NLM (flocks)

Hi,

> I was wondering, how much interest there might be in the addition of
> support for BSD style locks (flocks) over NLM. I was thinking that a bit could
> be added to differentiate the two namespaces. Any thoughts appreciated.

I looked into this before, and it's not just two "name spaces". The major
difference is that BSD flocks are associated with an open file handle,
while POSIX locks are associated with a PID.

You could possibly encode the notion of a struct file in the owner
handle that's passed in every lock request, and change the server side
lockd when comparing lock owners.

But I dimly remember there were other issues that could not be mapped
easily to the NLM protocol... don't remember the details: I'd have to
check my archives. These mails may even be in the nfs list archive.

Olaf
--
Olaf Kirch | --- o --- Nous sommes du soleil we love when we play
[email protected] | / | \ sol.dhoop.naytheet.ah kin.ir.samse.qurax


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2005-03-02 18:10:53

by Trond Myklebust

[permalink] [raw]
Subject: Re: [RFC] implementing BSD style locks on NLM (flocks)

su den 27.02.2005 Klokka 14:21 (-0500) skreiv [email protected]:
> Hey all-
> I was wondering, how much interest there might be in the addition of
> support for BSD style locks (flocks) over NLM. I was thinking that a bit could
> be added to differentiate the two namespaces. Any thoughts appreciated.

http://client.linux-nfs.org/Linux-2.6.x/2.6.11-rc5/linux-2.6.11-17-flock.dif

Cheers,
Trond

--
Trond Myklebust <[email protected]>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2005-03-02 18:44:45

by Olaf Kirch

[permalink] [raw]
Subject: Re: [RFC] implementing BSD style locks on NLM (flocks)

On Wed, Mar 02, 2005 at 10:10:34AM -0800, Trond Myklebust wrote:
> http://client.linux-nfs.org/Linux-2.6.x/2.6.11-rc5/linux-2.6.11-17-flock.dif

+ /* We're simulating flock() locks using posix locks on the server */
+ fl->fl_owner = (fl_owner_t)filp;
+ fl->fl_start = 0;
+ fl->fl_end = OFFSET_MAX;

Will this work as expected? Right now, the code sets fl_pid to the thread
group ID (tgid) - but every forked process gets a new tgid, unless you
use CLONE_THREAD, right? So the standard BSD behavior of opening a file
in process A, calling flock, forking and doing the final close in process
B will leave a stale lock, because the unlock call with have a different
pid value.

Olaf
--
Olaf Kirch | --- o --- Nous sommes du soleil we love when we play
[email protected] | / | \ sol.dhoop.naytheet.ah kin.ir.samse.qurax


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2005-03-02 18:55:26

by Trond Myklebust

[permalink] [raw]
Subject: Re: [RFC] implementing BSD style locks on NLM (flocks)

on den 02.03.2005 Klokka 19:44 (+0100) skreiv Olaf Kirch:
> On Wed, Mar 02, 2005 at 10:10:34AM -0800, Trond Myklebust wrote:
> > http://client.linux-nfs.org/Linux-2.6.x/2.6.11-rc5/linux-2.6.11-17-flock.dif
>
> + /* We're simulating flock() locks using posix locks on the server */
> + fl->fl_owner = (fl_owner_t)filp;
> + fl->fl_start = 0;
> + fl->fl_end = OFFSET_MAX;
>
> Will this work as expected? Right now, the code sets fl_pid to the thread
> group ID (tgid) - but every forked process gets a new tgid, unless you
> use CLONE_THREAD, right? So the standard BSD behavior of opening a file
> in process A, calling flock, forking and doing the final close in process
> B will leave a stale lock, because the unlock call with have a different
> pid value.

Ah, but we don't actually send the fl->fl_pid on the wire anywhere. That
causes problems even with standard POSIX locks when people do wierd
things with the CLONE_ flags.
Instead we only use the fl_owner field to emulate a "pid".

Cheers,
Trond

--
Trond Myklebust <[email protected]>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2005-03-03 21:21:39

by Trond Myklebust

[permalink] [raw]
Subject: Re: [RFC] implementing BSD style locks on NLM (flocks)

to den 03.03.2005 Klokka 13:24 (-0500) skreiv [email protected]:
>
> Do you know when this will get merged with the mainline kernel?
> Thanks!
> Neil

akpm claims that 2.6.12 is meant to be a quick bugfix release, so I'd
guess that we're going to have to wait for 2.6.13 before we can get it
in.

Cheers,
Trond
--
Trond Myklebust <[email protected]>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2005-03-04 19:48:30

by Trond Myklebust

[permalink] [raw]
Subject: Re: statd -o change

fr den 04.03.2005 Klokka 10:34 (-0500) skreiv G. Allen Morris III:
> Trond,
>
> I would think that statd should fail if the requested outgoing port (-o)
> can't be bound to. The main reason to bind to a particular outgoing port
> is because of a firewall. If a random port is used statd will not make
> it through the firewall, but the log file will have to be checked to
> find out why statd is not working (falling back on randomly chosen port).
>
> Not starting statd seems to be the failure mode if the rpc.statd port
> (-p) can't be bound to.

I'm not against doing this, but it would be a change w.r.t. existing
behaviour, so it warrants some discussion first.

Anyone have an opinion on this?

Cheers,
Trond
--
Trond Myklebust <[email protected]>



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs