On Tue, 12 Aug 2014 08:32:29 -0700 Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote: > Btw, I might be missing something here, but wouldn't it be better > to reference count the file_lock structure and grab a reference to > it where we currently call (__)locks_copy_lock? > It's not really possible with the way this code works at the moment. The problem there is that struct file_lock can represent any of: - a lock request (copied from userland into a kernel structure) - a lock record (that lives on the i_flock list) - a conflicting lock record (returned by GETLK-type request) In many cases we call (__)locks_copy_lock to copy from one "use-type" of struct file_lock to another, and doing that with refcounts makes that a bit difficult to manage. If I were designing this code from scratch, I'd have probably made each use-type a distinct structure. Maybe we should do that anyway at some point -- I'm not sure. Now, all that said...I think we will end up needing to do some sort of refcounting to fix the leasing code at some point. Currently, ->setlease operations can't block, which is a significant impediment to adding leases to clustered filesystems and the like. It would be nice to lift that limitation and that may require making leases be refcounted (or maybe RCU-managed). -- Jeff Layton <jlayton@xxxxxxxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html