2003-09-30 20:52:19

by Trond Myklebust

[permalink] [raw]
Subject: Re: Killed process on NFS client can result in lost lock on server

>>>>> " " == Philippe Troin <[email protected]> writes:

> While trying to make this test program, I've noticed that the
> problem only occurs while I/O is done on the locked file. Note
> the write() in a while loop in the test program. I could not
> get the bad behavior to show up if no I/O is going on.

Yep. It's the same problem as in nlmclnt_proc(): we have to clean up
all locks come rain or shine when the process exits.

Cheers,
Trond

--- linux-2.4.23-pre5/fs/nfs/file.c.orig 2003-07-09 14:10:21.000000000 -0400
+++ linux-2.4.23-pre5/fs/nfs/file.c 2003-09-30 16:48:52.000000000 -0400
@@ -293,7 +293,8 @@
status2 = filemap_fdatawait(inode->i_mapping);
if (status2 && !status)
status = status2;
- if (status < 0)
+ /* Note: Ignore status if we're cleaning up locks on process exit */
+ if (status < 0 && !(current->flags & PF_EXITING))
return status;

lock_kernel();




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2003-09-30 22:35:30

by Philippe Troin

[permalink] [raw]
Subject: Re: Killed process on NFS client can result in lost lock on server

Trond Myklebust <[email protected]> writes:

> >>>>> " " == Philippe Troin <[email protected]> writes:
>
> > While trying to make this test program, I've noticed that the
> > problem only occurs while I/O is done on the locked file. Note
> > the write() in a while loop in the test program. I could not
> > get the bad behavior to show up if no I/O is going on.
>
> Yep. It's the same problem as in nlmclnt_proc(): we have to clean up
> all locks come rain or shine when the process exits.

Thanks for the patch Trond, I'll give it a shot later today.

Is this patch in a -pre kernel yet or in 2.6.x or is it a new bug?

Phil.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2003-09-30 22:36:51

by Trond Myklebust

[permalink] [raw]
Subject: Re: Killed process on NFS client can result in lost lock on server


> Is this patch in a -pre kernel yet or in 2.6.x or is it a new
> bug?

It is new...

Cheers,
Trond


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2003-10-01 06:38:26

by Philippe Troin

[permalink] [raw]
Subject: Re: Killed process on NFS client can result in lost lock on server

Philippe Troin <[email protected]> writes:

> Trond Myklebust <[email protected]> writes:
>
> > >>>>> " " == Philippe Troin <[email protected]> writes:
> >
> > > While trying to make this test program, I've noticed that the
> > > problem only occurs while I/O is done on the locked file. Note
> > > the write() in a while loop in the test program. I could not
> > > get the bad behavior to show up if no I/O is going on.
> >
> > Yep. It's the same problem as in nlmclnt_proc(): we have to clean up
> > all locks come rain or shine when the process exits.
>
> Thanks for the patch Trond, I'll give it a shot later today.

Unfortunately, your patch does not fix the bug, although it makes it
less frequent. Please try running kill-locks for extended periods of
time to see the bug happen again. I can see the problem develop after
100-200 successful locking attempts here, versus just a few (< 10)
successful locking attempts before your patch.

Phil.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs