Implemented OPLOCK for FreeBsd

Ephi Dror edror at
Fri Sep 7 19:57:41 GMT 2001

Hi Jonathan,

Thanks a lot for willing to look and review our vnode fcntl/signal
implementation for oplock in FreeBSD.
I will email it soon after we do more testing on it.

Without saying much, in our Panasas system the oplock must be managed in our
specific file system which is BELOW the vnode layer since we allow access to
those files from remote systems.
In a distributed file system, we need to push the oplock state through to
the server,
and our server will participate in the oplock protocol.  So, it can't be
done soley above the
vnode layer because our server would not be able to participate.

So for us, we need to protect this oplocked file and initiate oplock break
for the case that the file is opened from a different host. Vnode, as easy
as it sounds, is not good enough for us since it does not "know" about the
other access methods to that poor file.

For this reason, it sounded easer for us to use the Linux fctrl/signal
approach.  If we used kevent(),
would the right thing be to introduce a new vnode event type?  Also, the man
page says that the vnode
filters only work on UFS systems.  This implies that the implementation is
below the vnode layer already,
but not presently in our file system.

We felt that our intermediate development effort which is a vnode layer
implementation is a quick (I hope not dirty) and good contribution for
FreeBSD and the SAMBA communities.

Hey, we feel it is our obligation to make it freely available and it is up
to each individual to use it or not.


> -----Original Message-----
> From: Jonathan Lemon [mailto:jlemon at]
> Sent: Friday, September 07, 2001 2:32 PM
> To: Ephi Dror
> Cc: jra at; 'Jordan Hubbard'; 'Jonathan Lemon';
> tridge at;
> samba-technical at; jeremy at;
> developers at
> Subject: Re: Implemented OPLOCK for FreeBsd
> On Fri, Sep 07, 2001 at 02:10:23PM -0700, Ephi Dror wrote:
> >
> > My goal was to implement only what is needed to fulfill the
> > oplock and not to develop a generic leasing management on files.
> >
> > Jonathan, do you have it implemented already? I don't mind
> to use and test
> > it for now.
> No - I only saw this thread an hour or so ago, so I haven't done any
> coding at all.  However, it really shouldn't be difficult to do.
> > For us, at Panasas, we chose fcntl and signal approach
> because later on we
> > are going to move the logic of oplock in the kernel from
> VNODE to other
> > place that better fit our system architecture.
> I'm not sure why you felt this way.  From what I understand, an oplock
> is broken when the file is opened or truncated.  This means that the
> oplock lease calls can be placed above the VFS layer, and not have any
> knowledge of the underlying internals.  The data structure
> that the knote
> (internal kq data structure) attaches to is determined by the kernel
> implementation, and is not visible to the outside world.
> Regardless, if you send me the code you have (primarily the stuff
> dealing with timeouts and the placement of hooks in the sys/kern/*
> layer), I can take a quick go at making a conversion.
> --
> Jonathan

More information about the samba-technical mailing list