Re: [Cluster-devel] [PATCH 00/10] locks/nfsd: internal lease API overhaul

2014-08-24 Thread Jeff Layton
On Sun, 24 Aug 2014 09:10:46 -0700 Christoph Hellwig wrote: > One more wishlist item in addition to the one mentioned in the patches: > > - add a return value to lm_break so that the lock manager can tell the >core code "you can delete this lease right now". That gets rid of >the games

Re: [Cluster-devel] [PATCH 08/10] locks: move i_lock acquisition into generic_*_lease handlers

2014-08-24 Thread Jeff Layton
On Sun, 24 Aug 2014 09:06:34 -0700 Christoph Hellwig wrote: > Looks good, > > Reviewed-by: Christoph Hellwig > > Some comments on further work I'd like to see in this area, though: > > > + spin_lock(&inode->i_lock); > > + time_out_leases(inode); > > for (before = &inode->i_flock; > >

Re: [Cluster-devel] [PATCH 09/10] locks: move freeing of leases outside of i_lock

2014-08-24 Thread Jeff Layton
On Sun, 24 Aug 2014 09:08:04 -0700 Christoph Hellwig wrote: > On Sat, Aug 23, 2014 at 10:41:17AM -0400, Jeff Layton wrote: > > There was only one place where we still could free a file_lock while > > holding the i_lock -- lease_modify. Add a new list_head argument to the > > lm_change operation,

Re: [Cluster-devel] [PATCH 07/10] locks: define a lm_setup handler for leases

2014-08-24 Thread Jeff Layton
On Sun, 24 Aug 2014 08:58:58 -0700 Christoph Hellwig wrote: > I like this change a lot! But one caveat: > > > + /* > > +* Despite the fact that it's an int return function, __f_setown never > > +* returns an error. Just ignore any error return here, but spew a > > +* WARN_ON_ONCE

Re: [Cluster-devel] [PATCH 08/10] locks: move i_lock acquisition into generic_*_lease handlers

2014-08-24 Thread Christoph Hellwig
On Sun, Aug 24, 2014 at 09:06:34AM -0700, Christoph Hellwig wrote: > We really should split a lm_release from lm_change, the way it is > used is highly confusing. In addition I think a lot of code > currently in lease_modify should move here instead, e.g. something like: At this point the old lm_

Re: [Cluster-devel] [PATCH 00/10] locks/nfsd: internal lease API overhaul

2014-08-24 Thread Christoph Hellwig
One more wishlist item in addition to the one mentioned in the patches: - add a return value to lm_break so that the lock manager can tell the core code "you can delete this lease right now". That gets rid of the games with the timeout which require all kinds of race avoidance code in t

Re: [Cluster-devel] [PATCH 09/10] locks: move freeing of leases outside of i_lock

2014-08-24 Thread Christoph Hellwig
On Sat, Aug 23, 2014 at 10:41:17AM -0400, Jeff Layton wrote: > There was only one place where we still could free a file_lock while > holding the i_lock -- lease_modify. Add a new list_head argument to the > lm_change operation, pass in a private list when calling it, and fix > those callers to dis

Re: [Cluster-devel] [PATCH 08/10] locks: move i_lock acquisition into generic_*_lease handlers

2014-08-24 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig Some comments on further work I'd like to see in this area, though: > + spin_lock(&inode->i_lock); > + time_out_leases(inode); > for (before = &inode->i_flock; > ((fl = *before) != NULL) && IS_LEASE(fl); >

Re: [Cluster-devel] [PATCH 07/10] locks: define a lm_setup handler for leases

2014-08-24 Thread Christoph Hellwig
I like this change a lot! But one caveat: > + /* > + * Despite the fact that it's an int return function, __f_setown never > + * returns an error. Just ignore any error return here, but spew a > + * WARN_ON_ONCE in case this ever changes. > + */ > + WARN_ON_ONCE(__f_se

Re: [Cluster-devel] [PATCH 06/10] locks: plumb an "aux" pointer into the setlease routines

2014-08-24 Thread Christoph Hellwig
On Sun, Aug 24, 2014 at 06:08:01AM -0400, Jeff Layton wrote: > > Can you just return -EEXIST if reusing an existing one and make it a > > normal private pointer a we use elsewhere? > > > > That sounds a little confusing... > > We have two pointers we pass down to generic_setlease: the file_lock

Re: [Cluster-devel] [PATCH 05/10] nfsd: don't keep a pointer to the lease in nfs4_file

2014-08-24 Thread Christoph Hellwig
On Sat, Aug 23, 2014 at 10:41:13AM -0400, Jeff Layton wrote: > Now that we don't need to pass in an actual lease pointer to > vfs_setlease on unlock, we can stop tracking a pointer to the lease in > the nfs4_file. > > Switch all of the places that check the fi_lease to check fi_deleg_file > instea

Re: [Cluster-devel] [PATCH 04/10] locks: clean up vfs_setlease kerneldoc comments

2014-08-24 Thread Christoph Hellwig
On Sat, Aug 23, 2014 at 10:41:12AM -0400, Jeff Layton wrote: > Some of the latter paragraphs seem ambiguous and just plain wrong. > In particular the break_lease comment makes no sense. We call > break_lease (and break_deleg) from all sorts of vfs-layer functions, > so there is clearly such a metho

Re: [Cluster-devel] [PATCH 02/10] nfsd: fix potential lease memory leak in nfs4_setlease

2014-08-24 Thread Christoph Hellwig
On Sat, Aug 23, 2014 at 10:41:10AM -0400, Jeff Layton wrote: > It's unlikely to ever occur, but if there were already a lease set on > the file then we could end up getting back a different pointer on a > successful setlease attempt than the one we allocated. If that happens, > the one we allocated

Re: [Cluster-devel] [PATCH 01/10] locks: close potential race in lease_get_mtime

2014-08-24 Thread Christoph Hellwig
On Sat, Aug 23, 2014 at 10:41:09AM -0400, Jeff Layton wrote: > lease_get_mtime is called without the i_lock held, so there's no > guarantee about the stability of the list. Between the time when we > assign "flock" and then dereference it to check whether it's a lease > and for write, the lease cou

Re: [Cluster-devel] [PATCH 03/10] locks: generic_delete_lease doesn't need a file_lock at all

2014-08-24 Thread Jeff Layton
On Sat, 23 Aug 2014 18:27:57 -0700 Christoph Hellwig wrote: > On Sat, Aug 23, 2014 at 10:41:11AM -0400, Jeff Layton wrote: > > +static int generic_delete_lease(struct file *filp) > > { > > struct file_lock *fl, **before; > > struct dentry *dentry = filp->f_path.dentry; > > struct ino

Re: [Cluster-devel] [PATCH 06/10] locks: plumb an "aux" pointer into the setlease routines

2014-08-24 Thread Jeff Layton
On Sat, 23 Aug 2014 18:33:05 -0700 Christoph Hellwig wrote: > On Sat, Aug 23, 2014 at 10:41:14AM -0400, Jeff Layton wrote: > > In later patches, we're going to add a new lock_manager_operation to > > finish setting up the lease while still holding the i_lock. To do > > this, we'll need to pass a