[PATCH 1/2] locks: introduce i_blockleases to close lease races
J. Bruce Fields
bfields at fieldses.org
Mon Jun 13 18:35:53 MDT 2011
On Mon, Jun 13, 2011 at 04:37:03PM -0400, Mimi Zohar wrote:
> On Mon, 2011-06-13 at 08:19 -0400, J. Bruce Fields wrote:
> > On Sun, Jun 12, 2011 at 04:54:33PM -0400, Mimi Zohar wrote:
> > > On Sun, 2011-06-12 at 15:12 -0400, J. Bruce Fields wrote:
> > > > On Sun, Jun 12, 2011 at 03:10:04PM -0400, Mimi Zohar wrote:
> > > > > In lieu of adding a new inode field, another possible option, a bit
> > > > > kludgy, would be extending i_flock with an additional fl_flag
> > > > > FL_BLOCKLEASE.
> > > > >
> > > > > #define IS_BLOCKLEASE(fl) (fl->fl_flags & FL_BLOCKLEASE)
> > > >
> > > > Alas, that would mean adding and removing one of these file locks around
> > > > every single link, unlink, rename,....
> > > >
> > > > --b.
> > >
> > > You're adding a call to break_lease() for each of them. Currently
> > > __break_lease() is only called if a lease exists. Assuming there aren't
> > > any existing leases, couldn't break_lease() call something like
> > > block_lease()? The free would be after the link, unlink, ...,
> > > completed/failed.
> > >
> > > (You wouldn't actually need to alloc/free the 'struct file_lock' each
> > > time, just set the pointer and reset to NULL.)
> >
> > Well, the pointer has to be set to something. I suppose we could put a
> > struct file_lock on the stack.
> >
> > --b.
>
> Instead of putting the struct file_lock on the stack, how about creating
> a dummy list containing a single element with FL_BLOCKLEASE set?
I'm afraid I don't understand what you're proposing. Could you explain
in more detail?
--b.
More information about the samba-technical
mailing list