Re: [PATCH] [2.4.20-pre2] File lease fixes

Stephen Rothwell (sfr@canb.auug.org.au)
Tue, 13 Aug 2002 15:09:29 +1000


Hi Marcelo,

On Mon, 12 Aug 2002 23:47:03 -0300 (BRT) Marcelo Tosatti <marcelo@conectiva.com.br> wrote:
>
> On Tue, 13 Aug 2002, Stephen Rothwell wrote:
>
> > static inline int get_lease(struct inode *inode, unsigned int mode)
> > {
> > - if (inode->i_flock && (inode->i_flock->fl_flags & FL_LEASE))
> > + if (inode->i_flock)
> > return __get_lease(inode, mode);
> > return 0;
> > }
>
> Why do you remove the FL_LEASE check here?

Because there is a race between checking inode->i_flock and
inode->i_flock->fl_flags which a couple of people have actually
hit ... The check for FL_EASE is done again in __get_lease
but protected by the BKL.

This is just an optimisation and having the check here is only
faster in the case where there is a lock held that is NOT a lease.

This was the race fix provided by Willy.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/