Lease support?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Lease support?

Stef Bon-2
Hi,

I've been looking at lease support, and I know there are already some
locking methods available.

The getlk and setlk ops are about byte locks, and the flock is about
file locks. Is the latest called when some application wants to set a
lease?

Stef

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: Lease support?

Christopher R. Hertel
Stef, et. al.,

See fcntl(2) for information on Linux kernel leases.  There is a section describing how they work.

One key reason that the Linux kernel supports leases is so that Samba can provide OpLock and Lease support to SMB clients.  Samba has to perform a "break" on SMB leases and OpLocks whenever a local process opens the leased file, and it can only do this if the kernel signals the Samba server.  The semantics of SMB leases and OpLocks is fairly complex, but the Linux kernel leases are sufficient for Samba.

Chris -)-----


On Tue, Oct 11, 2016 at 5:07 AM, Stef Bon <[hidden email]> wrote:
Hi,

I've been looking at lease support, and I know there are already some
locking methods available.

The getlk and setlk ops are about byte locks, and the flock is about
file locks. Is the latest called when some application wants to set a
lease?

Stef

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel



--
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   [hidden email]
OnLineBook -- http://ubiqx.org/cifs/    -)-----   [hidden email]


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: Lease support?

Stef Bon-2
Hi Chris,

I know this. I've already described in my question FUSE supports leases.
There are two different locks FUSE already supports (posix type byte
range locks and file locks).
Now my question is is the latest called when an application tries to
set a lease (indeed with fcntl).

Stef

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: Lease support?

Christopher R. Hertel
I'm not sure what you mean by "the latest" in this context.  Can you help me understand the question?

Chris -)-----

On Tue, Oct 11, 2016 at 12:10 PM, Stef Bon <[hidden email]> wrote:
Hi Chris,

I know this. I've already described in my question FUSE supports leases.
There are two different locks FUSE already supports (posix type byte
range locks and file locks).
Now my question is is the latest called when an application tries to
set a lease (indeed with fcntl).

Stef



--
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   [hidden email]
OnLineBook -- http://ubiqx.org/cifs/    -)-----   [hidden email]


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: Lease support?

Stef Bon-2
Ok,

when an app wants to set a lock, a request is send to userspace with
opcode 32 or 33.
First only byte range locks were supported, later also file locks.  In
that case the bit FUSE_LK_FLOCK
is set in fuse_lk_in.lk_flags.

In the lowlevel interface this results in two different lock methods
(getlk and setlk for byte range locks) and
flock for file locks.

Now my question is will a lease set by an app result in a call of flock?

Stef

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: Lease support?

Stef Bon-2
Well maybe someone has a fast answer. Otherwise I'll test it myself.

Stef

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: Lease support?

Christopher R. Hertel
I don't have the quick answer, but my *guess* is that it won't use flock().

Also, I'd be curious to know how you'll handle the signal sent when the lease is broken.

Looking forward to seeing your results.

Chris -)-----


On Tue, Oct 11, 2016 at 1:19 PM, Stef Bon <[hidden email]> wrote:
Well maybe someone has a fast answer. Otherwise I'll test it myself.

Stef



--
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   [hidden email]
OnLineBook -- http://ubiqx.org/cifs/    -)-----   [hidden email]


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel
Reply | Threaded
Open this post in threaded view
|

Re: Lease support?

Stef Bon-2
2016-10-11 21:19 GMT+02:00 Christopher R. Hertel <[hidden email]>:
> I don't have the quick answer, but my *guess* is that it won't use flock().
>
> Also, I'd be curious to know how you'll handle the signal sent when the
> lease is broken.

Yes that's very interesting. I'm working on a ssh/sftp filesystem
writing all the required ssh/sftp functions
myself using libgcrypt.

Now it's very interesting to make leases work with the sftp fs. It
provides a way to cooperate with a network fs with others.
I'm still busy making fsnotif work with fuse, which is also very nice
with a network fs.

Now when looking at a lease and the breaking of a lease, there is an
interesting situation:

- file is "leased" by another user on another host also using the same
ssh/sftp server.
When someone is trying to open the file a SIGIO signal should be send
over the network. The fuse fs should recieve the signal in the first
place.

It would be very nice when the lease is not released/downgraded within
a certain period, the application wanting to open a file (and failing
because of the remote lease)
should be able to query somehow who on what host is holding the lease
(to give the user for example this information).
Here I get lost. I do not know how to do this. How?

Stef


>
> Looking forward to seeing your results.
>
> Chris -)-----
>
>
> On Tue, Oct 11, 2016 at 1:19 PM, Stef Bon <[hidden email]> wrote:
>>
>> Well maybe someone has a fast answer. Otherwise I'll test it myself.
>>
>> Stef
>
>
>
>
> --
> "Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
> Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
> jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
> ubiqx Team -- http://www.ubiqx.org/     -)-----   [hidden email]
> OnLineBook -- http://ubiqx.org/cifs/    -)-----   [hidden email]
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--
fuse-devel mailing list
To unsubscribe or subscribe, visit https://lists.sourceforge.net/lists/listinfo/fuse-devel