* Pavel's Lock cleanup
@ 2011-10-13 22:23 Steve French
[not found] ` <CAH2r5mtNGd-+YUXJwU2USPN_7XnQYdSaYh_HJrzyaM3g6o9szw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 8+ messages in thread
From: Steve French @ 2011-10-13 22:23 UTC (permalink / raw)
To: linux-cifs-u79uwXL29TY76Z2rM5mHXA
I like Pavel's lock cleanup (1st patch of series) so far, am
continuing to review it, but I also noticed a few things that we need
to do in the future. This line of code:
if (flock->fl_flags & FL_LEASE)
cFYI(1, "Lease on file - not implemented yet");
reminded me that we should check if we need to implement this (in cifs
we can return yes if we have a lease already (oplock), but in smb2.1
and later we can request a lease or an upgrade to an existing one, on
the fly).
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 8+ messages in thread[parent not found: <CAH2r5mtNGd-+YUXJwU2USPN_7XnQYdSaYh_HJrzyaM3g6o9szw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Pavel's Lock cleanup [not found] ` <CAH2r5mtNGd-+YUXJwU2USPN_7XnQYdSaYh_HJrzyaM3g6o9szw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2011-10-14 21:12 ` J. Bruce Fields [not found] ` <20111014211214.GA15319-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: J. Bruce Fields @ 2011-10-14 21:12 UTC (permalink / raw) To: Steve French; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA On Thu, Oct 13, 2011 at 05:23:52PM -0500, Steve French wrote: > I like Pavel's lock cleanup (1st patch of series) so far, am > continuing to review it, but I also noticed a few things that we need > to do in the future. This line of code: > > if (flock->fl_flags & FL_LEASE) > cFYI(1, "Lease on file - not implemented yet"); > > reminded me that we should check if we need to implement this (in cifs > we can return yes if we have a lease already (oplock), but in smb2.1 > and later we can request a lease or an upgrade to an existing one, on > the fly). And you'll also need to make sure you call break_lease() when you find out it's broken. A description of the smb (1/2/2.1) oplock and lease semantics would be useful--I'm curious whether they're really a good fit for the linux vfs's lease semantics. --b. ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20111014211214.GA15319-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>]
* Re: Pavel's Lock cleanup [not found] ` <20111014211214.GA15319-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org> @ 2011-10-14 22:38 ` Steve French [not found] ` <CAH2r5msGZjEZP=BVWQedO80+W2yPJPvtd0+i5dAS9X0nq6=9kw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Steve French @ 2011-10-14 22:38 UTC (permalink / raw) To: J. Bruce Fields; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA On Fri, Oct 14, 2011 at 4:12 PM, J. Bruce Fields <bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org> wrote: > On Thu, Oct 13, 2011 at 05:23:52PM -0500, Steve French wrote: >> I like Pavel's lock cleanup (1st patch of series) so far, am >> continuing to review it, but I also noticed a few things that we need >> to do in the future. This line of code: >> >> if (flock->fl_flags & FL_LEASE) >> cFYI(1, "Lease on file - not implemented yet"); >> >> reminded me that we should check if we need to implement this (in cifs >> we can return yes if we have a lease already (oplock), but in smb2.1 >> and later we can request a lease or an upgrade to an existing one, on >> the fly). > > And you'll also need to make sure you call break_lease() when you find > out it's broken. > > A description of the smb (1/2/2.1) oplock and lease semantics would be > useful--I'm curious whether they're really a good fit for the linux > vfs's lease semantics. I can probably dig up the exact references in MS-CIFS.pdf and MS-SMB2.pdf but basically SMB2 (original dialect) and CIFS have similar semantics (and Samba's need to implement CIFS oplocks drove the original implementation of leases in the kernel, although it is requested at open time via a flag, not after open as a handle based call). The problem comes in with smb2.1 which adds the ability to reaquire leases (which may be ok) and upgrade leases (from read only to readwrite) and to reuse an existing lease (so the 2nd open from the same client doesn't have to break oplock) which helps Linux which has a common cache manager. smb2.2 adds the ability to do directory leases (to cache directory entries) -- Thanks, Steve ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <CAH2r5msGZjEZP=BVWQedO80+W2yPJPvtd0+i5dAS9X0nq6=9kw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Pavel's Lock cleanup [not found] ` <CAH2r5msGZjEZP=BVWQedO80+W2yPJPvtd0+i5dAS9X0nq6=9kw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2011-10-14 23:29 ` J. Bruce Fields [not found] ` <20111014232939.GA15881-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: J. Bruce Fields @ 2011-10-14 23:29 UTC (permalink / raw) To: Steve French; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA On Fri, Oct 14, 2011 at 05:38:59PM -0500, Steve French wrote: > On Fri, Oct 14, 2011 at 4:12 PM, J. Bruce Fields <bfields-uC3wQj2KruMpug/h7KTFAQ@public.gmane.orgg> wrote: > > On Thu, Oct 13, 2011 at 05:23:52PM -0500, Steve French wrote: > >> I like Pavel's lock cleanup (1st patch of series) so far, am > >> continuing to review it, but I also noticed a few things that we need > >> to do in the future. This line of code: > >> > >> if (flock->fl_flags & FL_LEASE) > >> cFYI(1, "Lease on file - not implemented yet"); > >> > >> reminded me that we should check if we need to implement this (in cifs > >> we can return yes if we have a lease already (oplock), but in smb2.1 > >> and later we can request a lease or an upgrade to an existing one, on > >> the fly). > > > > And you'll also need to make sure you call break_lease() when you find > > out it's broken. > > > > A description of the smb (1/2/2.1) oplock and lease semantics would be > > useful--I'm curious whether they're really a good fit for the linux > > vfs's lease semantics. > > I can probably dig up the exact references in MS-CIFS.pdf and MS-SMB2.pdf > but basically SMB2 (original dialect) and CIFS have similar semantics (and > Samba's need to implement CIFS oplocks drove the original implementation > of leases in the kernel, although it is requested at open time via a flag, > not after open as a handle based call). The problem comes in with smb2.1 > which adds the ability to reaquire leases (which may be ok) and upgrade > leases (from read only to readwrite) and to reuse an existing lease > (so the 2nd open from the same client doesn't have to break oplock) > which helps Linux which has a common cache manager. > > smb2.2 adds the ability to do directory leases (to cache directory > entries) I know all that, but what I'd like to know would be: - What's the difference between a lease and an oplock? - What does each give you the right to cache? For example: - The Samba folks tell me, not filename, only data: http://marc.info/?l=samba-technical&m=131688944117833&w=2 - Based on these patches, I'm assuming they also give the right to cache locks. But it would be nice to have references (either specifications, or test results) to support those statements. Microsoft's documents don't spell this out, as far as I can tell. --b. ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20111014232939.GA15881-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>]
* Re: Pavel's Lock cleanup [not found] ` <20111014232939.GA15881-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org> @ 2011-10-15 0:02 ` Steve French [not found] ` <CAH2r5mvd+N_F897=jAjc7x=186YAHwe=jwQDD=JnOu8YFmu3qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Steve French @ 2011-10-15 0:02 UTC (permalink / raw) To: J. Bruce Fields; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA On Fri, Oct 14, 2011 at 6:29 PM, J. Bruce Fields <bfields-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org> wrote: > On Fri, Oct 14, 2011 at 05:38:59PM -0500, Steve French wrote: >> On Fri, Oct 14, 2011 at 4:12 PM, J. Bruce Fields <bfields@fieldses.org> wrote: >> > On Thu, Oct 13, 2011 at 05:23:52PM -0500, Steve French wrote: >> >> I like Pavel's lock cleanup (1st patch of series) so far, am >> >> continuing to review it, but I also noticed a few things that we need >> >> to do in the future. This line of code: >> >> >> >> if (flock->fl_flags & FL_LEASE) >> >> cFYI(1, "Lease on file - not implemented yet"); >> >> >> >> reminded me that we should check if we need to implement this (in cifs >> >> we can return yes if we have a lease already (oplock), but in smb2.1 >> >> and later we can request a lease or an upgrade to an existing one, on >> >> the fly). >> > >> > And you'll also need to make sure you call break_lease() when you find >> > out it's broken. >> > >> > A description of the smb (1/2/2.1) oplock and lease semantics would be >> > useful--I'm curious whether they're really a good fit for the linux >> > vfs's lease semantics. >> >> I can probably dig up the exact references in MS-CIFS.pdf and MS-SMB2.pdf >> but basically SMB2 (original dialect) and CIFS have similar semantics (and >> Samba's need to implement CIFS oplocks drove the original implementation >> of leases in the kernel, although it is requested at open time via a flag, >> not after open as a handle based call). The problem comes in with smb2.1 >> which adds the ability to reaquire leases (which may be ok) and upgrade >> leases (from read only to readwrite) and to reuse an existing lease >> (so the 2nd open from the same client doesn't have to break oplock) >> which helps Linux which has a common cache manager. >> >> smb2.2 adds the ability to do directory leases (to cache directory >> entries) > > I know all that, but what I'd like to know would be: > - What's the difference between a lease and an oplock? > - What does each give you the right to cache? For example: > - The Samba folks tell me, not filename, only data: > http://marc.info/?l=samba-technical&m=131688944117833&w=2 > - Based on these patches, I'm assuming they also give > the right to cache locks. > But it would be nice to have references (either > specifications, or test results) to support those statements. Interesting questions. The MS-FSA document (in section 3.1.4.12) seems to agree with that (that querying attributes, and some metadata, timestamps, does not break oplock): (see http://msdn.microsoft.com/en-us/library/860b1516-c452-47b4-bdbc-625d344e2041.aspx) "If OpParams.DesiredAccess contains no flags other than FILE_READ_ATTRIBUTES, FILE_WRITE_ATTRIBUTES, or SYNCHRONIZE, the algorithm returns at this point." (ie doesn't break oplock if these are the only flags set). On oplock vs. leases (in MS usage, oplock is the older term). An oplock was - 1) requested on open (presumably what the "op" part of the name meant) 2) had only a few types: "batch" (could cache data, and cache open/close) and "read write" (could cache read or writes of data) and later a "read only" type was added (allowing you to cache writes) Leases (a later term in Microsoft documents) had more function (they included for example a "key" which identifies the owner of the lease). -- Thanks, Steve ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <CAH2r5mvd+N_F897=jAjc7x=186YAHwe=jwQDD=JnOu8YFmu3qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Pavel's Lock cleanup [not found] ` <CAH2r5mvd+N_F897=jAjc7x=186YAHwe=jwQDD=JnOu8YFmu3qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2011-10-15 0:04 ` Steve French [not found] ` <CAH2r5mubN4RGznpLQbgLGSytaK-xM2Mz0dBNm-koKgBuUExPcQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2011-10-15 14:50 ` J. Bruce Fields 1 sibling, 1 reply; 8+ messages in thread From: Steve French @ 2011-10-15 0:04 UTC (permalink / raw) To: J. Bruce Fields; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA On Fri, Oct 14, 2011 at 7:02 PM, Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > On oplock vs. leases (in MS usage, oplock is the older term). An oplock was - > 1) requested on open (presumably what the "op" part of the name meant) > 2) had only a few types: "batch" (could cache data, and cache open/close) > and "read write" (could cache read or writes of data) and later a > "read only" type was > added (allowing you to cache writes) oops - I meant "allowing you to cache reads" (obviously) -- Thanks, Steve ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <CAH2r5mubN4RGznpLQbgLGSytaK-xM2Mz0dBNm-koKgBuUExPcQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Pavel's Lock cleanup [not found] ` <CAH2r5mubN4RGznpLQbgLGSytaK-xM2Mz0dBNm-koKgBuUExPcQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2011-10-15 15:27 ` Pavel Shilovsky 0 siblings, 0 replies; 8+ messages in thread From: Pavel Shilovsky @ 2011-10-15 15:27 UTC (permalink / raw) To: Steve French; +Cc: J. Bruce Fields, linux-cifs-u79uwXL29TY76Z2rM5mHXA 2011/10/15 Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > On Fri, Oct 14, 2011 at 7:02 PM, Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> On oplock vs. leases (in MS usage, oplock is the older term). An oplock was - >> 1) requested on open (presumably what the "op" part of the name meant) >> 2) had only a few types: "batch" (could cache data, and cache open/close) >> and "read write" (could cache read or writes of data) and later a >> "read only" type was >> added (allowing you to cache writes) > > oops - I meant "allowing you to cache reads" (obviously) > Also, note that batch and read write oplocks allow to cache byte-range locks on the client. -- Best regards, Pavel Shilovsky. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Pavel's Lock cleanup [not found] ` <CAH2r5mvd+N_F897=jAjc7x=186YAHwe=jwQDD=JnOu8YFmu3qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2011-10-15 0:04 ` Steve French @ 2011-10-15 14:50 ` J. Bruce Fields 1 sibling, 0 replies; 8+ messages in thread From: J. Bruce Fields @ 2011-10-15 14:50 UTC (permalink / raw) To: Steve French; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA On Fri, Oct 14, 2011 at 07:02:55PM -0500, Steve French wrote: > On Fri, Oct 14, 2011 at 6:29 PM, J. Bruce Fields <bfields-uC3wQj2KruMpug/h7KTFAQ@public.gmane.orgg> wrote: > > On Fri, Oct 14, 2011 at 05:38:59PM -0500, Steve French wrote: > >> On Fri, Oct 14, 2011 at 4:12 PM, J. Bruce Fields <bfields@fieldses.org> wrote: > >> > On Thu, Oct 13, 2011 at 05:23:52PM -0500, Steve French wrote: > >> >> I like Pavel's lock cleanup (1st patch of series) so far, am > >> >> continuing to review it, but I also noticed a few things that we need > >> >> to do in the future. This line of code: > >> >> > >> >> if (flock->fl_flags & FL_LEASE) > >> >> cFYI(1, "Lease on file - not implemented yet"); > >> >> > >> >> reminded me that we should check if we need to implement this (in cifs > >> >> we can return yes if we have a lease already (oplock), but in smb2.1 > >> >> and later we can request a lease or an upgrade to an existing one, on > >> >> the fly). > >> > > >> > And you'll also need to make sure you call break_lease() when you find > >> > out it's broken. > >> > > >> > A description of the smb (1/2/2.1) oplock and lease semantics would be > >> > useful--I'm curious whether they're really a good fit for the linux > >> > vfs's lease semantics. > >> > >> I can probably dig up the exact references in MS-CIFS.pdf and MS-SMB2.pdf > >> but basically SMB2 (original dialect) and CIFS have similar semantics (and > >> Samba's need to implement CIFS oplocks drove the original implementation > >> of leases in the kernel, although it is requested at open time via a flag, > >> not after open as a handle based call). The problem comes in with smb2.1 > >> which adds the ability to reaquire leases (which may be ok) and upgrade > >> leases (from read only to readwrite) and to reuse an existing lease > >> (so the 2nd open from the same client doesn't have to break oplock) > >> which helps Linux which has a common cache manager. > >> > >> smb2.2 adds the ability to do directory leases (to cache directory > >> entries) > > > > I know all that, but what I'd like to know would be: > > - What's the difference between a lease and an oplock? > > - What does each give you the right to cache? For example: > > - The Samba folks tell me, not filename, only data: > > http://marc.info/?l=samba-technical&m=131688944117833&w=2 > > - Based on these patches, I'm assuming they also give > > the right to cache locks. > > But it would be nice to have references (either > > specifications, or test results) to support those statements. > > Interesting questions. The MS-FSA document (in section 3.1.4.12) Woah, I totally missed that section on my previous reading. Thanks! > seems to agree with that > (that querying attributes, and some metadata, timestamps, does not > break oplock): > > (see http://msdn.microsoft.com/en-us/library/860b1516-c452-47b4-bdbc-625d344e2041.aspx) > > "If OpParams.DesiredAccess contains no flags other than FILE_READ_ATTRIBUTES, > FILE_WRITE_ATTRIBUTES, or SYNCHRONIZE, the algorithm returns at this point." > (ie doesn't break oplock if these are the only flags set). > > > On oplock vs. leases (in MS usage, oplock is the older term). An oplock was - > 1) requested on open (presumably what the "op" part of the name meant) > 2) had only a few types: "batch" (could cache data, and cache open/close) > and "read write" (could cache read or writes of data) and later a > "read only" type was > added (allowing you to cache writes) > > Leases (a later term in Microsoft documents) had more function (they > included for > example a "key" which identifies the owner of the lease). OK, thanks again, that's helpful. --b. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-10-15 15:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-13 22:23 Pavel's Lock cleanup Steve French
[not found] ` <CAH2r5mtNGd-+YUXJwU2USPN_7XnQYdSaYh_HJrzyaM3g6o9szw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-14 21:12 ` J. Bruce Fields
[not found] ` <20111014211214.GA15319-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2011-10-14 22:38 ` Steve French
[not found] ` <CAH2r5msGZjEZP=BVWQedO80+W2yPJPvtd0+i5dAS9X0nq6=9kw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-14 23:29 ` J. Bruce Fields
[not found] ` <20111014232939.GA15881-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2011-10-15 0:02 ` Steve French
[not found] ` <CAH2r5mvd+N_F897=jAjc7x=186YAHwe=jwQDD=JnOu8YFmu3qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-15 0:04 ` Steve French
[not found] ` <CAH2r5mubN4RGznpLQbgLGSytaK-xM2Mz0dBNm-koKgBuUExPcQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-15 15:27 ` Pavel Shilovsky
2011-10-15 14:50 ` J. Bruce Fields
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox