to den 11.08.2005 Klokka 16:40 (+0200) skreiv Michael Kerrisk:
> I think my metapoint really is this: there has never been a 
> clearly documented statement of how File Leases are supposed 
> to behave on Linux.  There is just some code... how is one 
> supposed to know what it _should_ do?  (The manual page text 
> was my attempt to discover the details, after the fact.)
> 
> Can you provide an explanation of how file leases should 
> behave?  That is, a tabulation of the expected behavious 
> for the possible cimbinations of
> 
> [lease type] X 
> [open() access-mode employed file placing lease] X
> [open() access-mode employed by other process(es)]

The only document that I have is RFC3530 (the NFSv4 spec) which doesn't
really define file leases, but does define the caching protocol that
they act as support for.
In principle it is supposed to be the same protocol that CIFS uses
(although CIFS doesn't really have much in the form of documentation
that we can use to verify that fact).

To me, the NFSv4 requirements suggest:

     open()  |  lease requested    | effect on existing leases |
      flag   | F_RDLCK  | F_WRLCK  | F_RDLCK  | F_WRLCK        |
    ---------+----------+----------+---------------------------+
    O_RDONLY | okay     |  okay    |  none    |  recall        |
    O_WRONLY | EAGAIN   |  okay    |  recall  |  recall        |
    O_RDWR   | EAGAIN   |  okay    |  recall  |  recall        |

-----
 fcntl(SETLK)| effect on existing leases |
     flag    | F_RDLCK   | F_WRLCK       |
    ---------+---------------------------+
     F_RDLCK | none      | none          |
     F_WRLCK | recall    | none          |

-----
Other operation that should recall leases (both types!) are

unlink(), link(), f/l/chown(), f/chmod(), rename(), setfacl().

truncate() and utime() calls by another process.

-----
Finally, operations that should recall read leases only:

truncate() and utime() calls by your process.
-----

Cheers,
  Trond

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to