Re: [PATCH 1/2] locks: let the caller free file_lock on ->setleasefailure

From: J. Bruce Fields
Date: Wed Nov 03 2010 - 21:41:36 EST


On Wed, Nov 03, 2010 at 09:40:24PM -0400, J. Bruce Fields wrote:
> On Wed, Nov 03, 2010 at 04:41:48PM -0400, J. Bruce Fields wrote:
> > On Sun, Oct 31, 2010 at 08:35:10AM -0400, Christoph Hellwig wrote:
> > > Index: linux-2.6/fs/locks.c
> > > ===================================================================
> > > --- linux-2.6.orig/fs/locks.c 2010-10-31 07:10:07.649004084 -0400
> > > +++ linux-2.6/fs/locks.c 2010-10-31 07:34:10.102255587 -0400
> > > @@ -1428,8 +1425,9 @@ int generic_setlease(struct file *filp,
> > > goto out;
> > >
> > > if (my_before != NULL) {
> > > - *flp = *my_before;
> > > error = lease->fl_lmops->fl_change(my_before, arg);
> > > + if (!error)
> > > + *flp = *my_before;
> >
> > Argh, missed this: we're leaking the passed-in lease in this case.
>
> We could do something like this.

And while I was here I noticed:

--b.