Re: [PATCH] fix posix lock on NFS, #2

From: Trond Myklebust
Date: Fri Dec 23 2005 - 10:01:47 EST


On Fri, 2005-12-23 at 23:38 +0900, ASANO Masahiro wrote:
> Here is a patch. It changes nfsd to keep the range of file_lock for
> later use. Any comments and feedback are welcome.
>
> Signed-off-by: ASANO Masahiro <masano@xxxxxxxxxxxxxx>
>
> --- linux-2.6.15-rc6/fs/lockd/svclock.c.orig 2005-12-23 20:16:33.000000000 +0900
> +++ linux-2.6.15-rc6/fs/lockd/svclock.c 2005-12-23 20:24:13.000000000 +0900
> @@ -510,6 +510,7 @@ nlmsvc_grant_blocked(struct nlm_block *b
> struct nlm_file *file = block->b_file;
> struct nlm_lock *lock = &block->b_call.a_args.lock;
> struct file_lock *conflock;
> + struct file_lock tmplck;
> int error;
>
> dprintk("lockd: grant blocked lock %p\n", block);
> @@ -542,7 +543,8 @@ nlmsvc_grant_blocked(struct nlm_block *b
> * following yields an error, this is most probably due to low
> * memory. Retry the lock in a few seconds.
> */
> - if ((error = posix_lock_file(file->f_file, &lock->fl)) < 0) {
> + tmplck = lock->fl; /* keep the range for later use */
> + if ((error = posix_lock_file(file->f_file, &tmplck)) < 0) {
> printk(KERN_WARNING "lockd: unexpected error %d in %s!\n",
> -error, __FUNCTION__);
> nlmsvc_insert_block(block, 10 * HZ);

NACK. You cannot copy locks like this. See locks_copy_lock().

Cheers,
Trond

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/