From: Trond Myklebust Subject: Re: [NFS client] NFS locks not released on abnormal process termination Date: Mon, 08 Dec 2003 14:56:07 -0500 Sender: linux-kernel-owner@vger.kernel.org Message-ID: <1070913367.2941.137.camel@nidelv.trondhjem.org> References: <20031208033933.16136.qmail@web20024.mail.yahoo.com> <877k17rzai.fsf@ceramic.fifi.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-oqgWc3Gv82hj8jqjrEkA" Cc: Trond Myklebust , Kenny Simpson , linux-kernel@vger.kernel.org, nfs@lists.sourceforge.net Return-path: To: Philippe Troin In-Reply-To: <877k17rzai.fsf@ceramic.fifi.org> List-ID: --=-oqgWc3Gv82hj8jqjrEkA Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable P=E5 m=E5 , 08/12/2003 klokka 12:32, skreiv Philippe Troin: > Trond, do you think I should push the patch to Marcelo, or should I > wait for a better fix? No. If I wanted a partial fix, I could just as well have pushed it to Marcelo myself. When I said "feel free" I was referring to pursuing the remaining signalling bugs. I have a feeling the second race case of your test is that you are interrupting the fcntl(F_SETLK) call while it is on the wire. If you do that, then the server may record the lock as taken, but the client will never receive the reply, and so will not know that it must clean up locks... Hmm... For that case, we probably want to have the locking code record the call as having succeeded in order to ensure that we do indeed clear out the lock on process exit. See if the appended patch helps... Cheers, Trond --=-oqgWc3Gv82hj8jqjrEkA Content-Description: Content-Disposition: attachment; filename=linux-2.4.23-lock_race.dif Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: base64 LS0tIGxpbnV4LTIuNC4yMy1yYzEvZnMvbmZzL2ZpbGUuYy5vcmlnCTIwMDMtMTEtMTYgMTk6Mjg6 NTIuMDAwMDAwMDAwIC0wNTAwDQorKysgbGludXgtMi40LjIzLXJjMS9mcy9uZnMvZmlsZS5jCTIw MDMtMTItMDggMTQ6NTM6MTIuMDAwMDAwMDAwIC0wNTAwDQpAQCAtMjQxLDYgKzI0MSw5MiBAQA0K IAlnb3RvIG91dDsNCiB9DQogD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