Re: [PATCH] AFS: Implement file locking [try #2]

2007-05-31 Thread David Howells
J. Bruce Fields <[EMAIL PROTECTED]> wrote: > > Yes. I need to get the server lock first, before going to the VFS locking > > routines. > > That doesn't really answer the question. The NFS client has similar > requirements, but it doesn't have to duplicate the per-inode lists of > granted locks,

Re: [PATCH] AFS: Implement file locking [try #2]

2007-05-30 Thread J. Bruce Fields
On Wed, May 30, 2007 at 09:35:32AM +0100, David Howells wrote: > J. Bruce Fields <[EMAIL PROTECTED]> wrote: > > > --without having tried to understand how they're actually used, these > > data structures (like the pending_locks and granted_locks lists) seem to > > duplicate stuff that's already ke

Re: [PATCH] AFS: Implement file locking [try #2]

2007-05-30 Thread David Howells
J. Bruce Fields <[EMAIL PROTECTED]> wrote: > --without having tried to understand how they're actually used, these > data structures (like the pending_locks and granted_locks lists) seem to > duplicate stuff that's already kept in fs/locks.c. Is there a reason > they're required? Yes. I need to

Re: [PATCH] AFS: Implement file locking [try #2]

2007-05-29 Thread J. Bruce Fields
One more vague question I had while skimming the previous version-- On Tue, May 29, 2007 at 03:54:27PM +0100, David Howells wrote: > +static void afs_grant_locks(struct afs_vnode *vnode, struct file_lock *fl) > +{ > + struct file_lock *p, *_p; > + > + list_move_tail(&fl->fl_u.afs.link, &vn

Re: [PATCH] AFS: Implement file locking

2007-05-29 Thread J. Bruce Fields
On Tue, May 29, 2007 at 10:34:41AM +0100, David Howells wrote: > I'll need to test the upgrade/downgrade case. I don't know whether the AFS > server supports that. If it doesn't, I can emulate downgrade, but not upgrade > - not unless I only ever ask it for exclusive locks. > > Lock upgrading is

Re: [PATCH] AFS: Implement file locking

2007-05-29 Thread David Howells
J. Bruce Fields <[EMAIL PROTECTED]> wrote: > > At the moment, yes. Don't the POSIX and flock lock-handling routines in the > > kernel normally do that anyway? > > No, they'd upgrade in that case. I just checked. The OpenAFS server supports neither lock upgrading nor lock downgrading. Attempts

Re: [PATCH] AFS: Implement file locking

2007-05-29 Thread David Howells
J. Bruce Fields <[EMAIL PROTECTED]> wrote: > You can contrive examples of applications that would be correct given > the standard fcntl behavior, but that would deadlock on a system that > didn't allow read locks to jump the queue in the above situation. Yes, but you can also contrive starvation

Re: [PATCH] AFS: Implement file locking

2007-05-27 Thread J. Bruce Fields
On Sun, May 27, 2007 at 09:51:10AM +0100, David Howells wrote: > J. Bruce Fields <[EMAIL PROTECTED]> wrote: > > So if I request a write lock while holding a read lock, my request will > > be denied? > > At the moment, yes. Don't the POSIX and flock lock-handling routines in the > kernel normally

Re: [PATCH] AFS: Implement file locking

2007-05-27 Thread David Howells
J. Bruce Fields <[EMAIL PROTECTED]> wrote: > > > Do you allow upgrades and downgrades? (Just curious.) > > > > AFS does not, as far as I know. > > So if I request a write lock while holding a read lock, my request will > be denied? At the moment, yes. Don't the POSIX and flock lock-handling r

Re: [PATCH] AFS: Implement file locking

2007-05-26 Thread J. Bruce Fields
On Sun, May 27, 2007 at 12:55:30AM +0100, David Howells wrote: > J. Bruce Fields <[EMAIL PROTECTED]> wrote: > > > > + if (!afs_lock_manager) { > > > + afs_lock_manager = create_singlethread_workqueue("kafs_lockd"); > > > + if (!afs_lock_manager) > > > + return -ENOM

Re: [PATCH] AFS: Implement file locking

2007-05-26 Thread David Howells
Kyle Moffett <[EMAIL PROTECTED]> wrote: > I was actually under the impression that OpenAFS had support for byte- > range locking (as well as lock upgrade/downgrade); As far as I know, there is no support for byte-range locking at all in the AFS protocol itself. The client can try to emulate byt

Re: [PATCH] AFS: Implement file locking

2007-05-26 Thread David Howells
J. Bruce Fields <[EMAIL PROTECTED]> wrote: > > + if (!afs_lock_manager) { > > + afs_lock_manager = create_singlethread_workqueue("kafs_lockd"); > > + if (!afs_lock_manager) > > + return -ENOMEM; > > + } > > + return 0; > > Doesn't this need some locking

Re: [PATCH] AFS: Implement file locking

2007-05-25 Thread Kyle Moffett
On May 25, 2007, at 22:23:42, J. Bruce Fields wrote: On Thu, May 24, 2007 at 05:55:54PM +0100, David Howells wrote: + /* only whole-file locks are supported */ + if (fl->fl_start != 0 || fl->fl_end != OFFSET_MAX) + return -EINVAL; Do you allow upgrades and downgrades?

Re: [PATCH] AFS: Implement file locking

2007-05-25 Thread J. Bruce Fields
On Thu, May 24, 2007 at 05:55:54PM +0100, David Howells wrote: > +/* > + * initialise the lock manager thread if it isn't already running > + */ > +static int afs_init_lock_manager(void) > +{ > + if (!afs_lock_manager) { > + afs_lock_manager = create_singlethread_workqueue("kafs_loc

Re: [PATCH] AFS: Implement file locking

2007-05-25 Thread Jiri Slaby
David Howells napsal(a): > Implement file locking for AFS. > > Signed-off-by: David Howells <[EMAIL PROTECTED]> > --- > > fs/afs/Makefile|1 > fs/afs/afs.h |8 + > fs/afs/afs_fs.h|3 > fs/afs/callback.c |3 > fs/afs/dir.c |1 > fs/afs/file.c |