[lkml]   [2000]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: kNFS troubles (2.2.14pre15, Mandrake 7.0)
On Mon, Jan 24, 2000 at 12:17:36PM +1100, Neil Brown wrote:
> and v3 at least) cannot support mandatory locking. It would probably
> be as safe, and less intrusive, to allow access but simply deny all
> lock requests to a mandatory locking file, but I haven't looked into
> the issues very deeply.

The reason knfsd refuses to touch a file with the mandatory locking bit
on is that I wasn't sure how to deal with it. Blocking the server thread
isn't an option.

What you could do is to call locks_verify_area() in read/write/truncate,
and fail the request if there is a conflicting lock. This on the other
hand may cause `mysterious' failures to some people because the write
may happen from within the client application's close() call--and we
all know how many apps check for the return value of close().

In addition, an application _may_ be doing everything according to the
book (establishing a lock etc, then calling read/write)--and still
we would have to fail the request because the NFS credentials do not
transport the lock handle.

The bottom line of my reasoning is that mandatory locking over NFS
makes no sense at all because the protocol doesn't support it. So it's
irrelevant _how_ we fail requests for mandlock files--which is why I
picked the approach that involved the smallest amount of work :-)

If you really want to break the NFS client you can create a non-standard
NFS error return (first fall from grace), called EMANDLOCK. In knfsd's
read/write/truncate, check for a conflicting mandatory lock, and if there
is one, return EMANDLOCK. The client recognizes this error, and backs
off (either by trying to establish a blocking lock for the file area,
or by retrying the call every now and then (second fall from grace)). At
some time in the future, the retried call will succeed (or fail with a
different error). Release the NFS lock. Return. Of course you'll have
to deal reasonably with signals (e.g. the impatient user hitting Ctrl-C
because your app seems to be stuck in close()). Enjoy.

Olaf Kirch | --- o --- Nous sommes du soleil we love when we play | / | \ sol.dhoop.naytheet.ah +-------------------- Why Not?! -----------------------
UNIX, n.: Spanish manufacturer of fire extinguishers.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:56    [W:0.075 / U:0.996 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site