Question about leases
Hello all,
Please can anyone throw a bit light on file leases (fcntl F_SETLEASE command) or at least point me to some documentation? I can't find any.
As far as I figured out process holding a lease is notified when other process opens the leased file. But I am still not sure how the leases should then be released and how the process knows which lease was broken (struct siginfo does not seem to have union member for that case).
-------------------------------------------------------------------------------
Jan 'Bulb' Hudec <[email protected]>
Quoted 3 lines · On Tue, 27 Aug 2002 03:06:16 +0200 Jan Hudec <[email protected]> wrote:
Please can anyone throw a bit light on file leases (fcntl
F_SETLEASEcommand) or at least point me to some documentation? I can't find any.
There isn't any (except maybe the talk I gave at Linux Kongress last year (http://www.canb.auug.org.au/~sfr/idle.html).
Quoted 4 lines
As far as I figured out process holding a lease is notified when other process opens the leased file. But I am still not sure how the leases should then be released and how the process knows which lease was broken (struct siginfo does not seem to have union member for that case).
To release a lease, you use fcntl(fd, F_SETLEASE, F_UNLCK). The file descriptor of the file that the lease is on is returned in the siginfo structure.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Hi again,
Quoted 9 lines · On Tue, 27 Aug 2002 14:35:17 +1000 Stephen Rothwell <[email protected]>…
Quoted 3 lines · On Tue, 27 Aug 2002 03:06:16 +0200 Jan Hudec <[email protected]> wrote:
Please can anyone throw a bit light on file leases (fcntl
F_SETLEASEcommand) or at least point me to some documentation? I can't find any.There isn't any (except maybe the talk I gave at Linux Kongress last year (http://www.canb.auug.org.au/~sfr/idle.html).
Quoted 8 lines
Quoted 4 lines
As far as I figured out process holding a lease is notified when other process opens the leased file. But I am still not sure how the leases should then be released and how the process knows which lease was broken (struct siginfo does not seem to have union member for that case).
To release a lease, you use
fcntl(fd, F_SETLEASE, F_UNLCK). The file descriptor of the file that the lease is on is returned in the siginfo structure.
You should also be aware that there are lots of bugs with file leases before 2.4.20-pre3 and in early 2.5 kernels.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Quoted 11 lines
Quoted 2 lines · On Tue, 27 Aug 2002 14:35:17 +1000 Stephen Rothwell <[email protected]>…
On Tue, 27 Aug 2002 03:06:16 +0200 Jan Hudec <[email protected]>
Quoted 6 lines · wrote:
Quoted 3 lines
Please can anyone throw a bit light on file leases (fcntl
F_SETLEASEcommand) or at least point me to some documentation? I can't find any.There isn't any (except maybe the talk I gave at Linux Kongress last year (http://www.canb.auug.org.au/~sfr/idle.html).
Not quite true. I wrote some additions to the fcntl(2) manual page describing leases. Download a recent copy of the man pages from tldp.org.
Cheers
Michael
Signature · 2 lines
GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net
Quoted 8 lines · Stephen Rothwell
Quoted 4 lines
As far as I figured out process holding a lease is notified when other process opens the leased file. But I am still not sure how the leases should then be released and how the process knows which lease was broken (struct siginfo does not seem to have union member for that case).
To release a lease, you use
fcntl(fd, F_SETLEASE, F_UNLCK). The file descriptor of the file that the lease is on is returned in the siginfo structure.
One more question. Does the siginfo contain information weather is's read or write that the other process attempted? And does it contain the operation type for directory notifications?
-------------------------------------------------------------------------------
Jan 'Bulb' Hudec <[email protected]>
Hi Jan,
Quoted 3 lines · On Tue, 27 Aug 2002 10:42:44 +0200 Jan Hudec <[email protected]> wrote:
One more question. Does the siginfo contain information weather is's read or write that the other process attempted? And does it contain the
No, you need to do fcntl(fd, F_GETLEASE) to find out what kind of lease you need to set to satisfy the other process i.e. if the other process does an open for reading then GETLEASE will return F_RDLCK and if they attempt an open for writing the GETLEASE will return F_UNLCK.
Quoted 1 line
operation type for directory notifications?
No, sorry.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/