Linux filesystem development
 help / color / mirror / Atom feed
* mandatory locks and LOCK_MAND
@ 2002-04-24 11:11 Michael Ganss
  0 siblings, 0 replies; only message in thread
From: Michael Ganss @ 2002-04-24 11:11 UTC (permalink / raw)
  To: linux-fsdevel

Hi,

I'm trying to get mandatory file locking to work. I don't want to use 
the mount option plus permission bits hack.
The only helpful document I could find (besides mandatory.txt in the 
kernel sources) was http://infradead.org/~willy/locking_manifesto.html
which describes "share modes":

"*  Share modes. These are whole-file mandatory locks. No other process 
may open a file which would conflict with the Share Mode on the file. 
Use flock() with the %LOCK_MAND flag to set a Share Mode."

However, this doesn't work for me (kernel 2.4.17). /proc/locks shows the 
lock:

1: FLOCK  MSNFS     NONE  17653 03:05:44 0 EOF dfb6b458 c02eb928 
dfb6bb30 000000
00 dfb6b464

but it doesn't seem to be enforced anywhere. other processes can still 
open(2), read(2), write(2). I've skimmed fs/locks.c and for 
locks_may_read() it says:

"* 
N.B. this function is only ever called
  *	from knfsd and ownership of locks is never checked."

It seems to me, LOCK_MAND is not intended to be used outside the kernel. 
is this correct, or am I doing something wrong?

on the other hand, leases work as described.

regards
-- 
O&O Services GmbH - Delivering Value!

Michael Ganß

Am Borsigturm 48, 13507 Berlin, Germany
Tel: +49 30 43 03 43-50 Fax: -99
E-Mail: michael.ganss@oo-services.com
Web: http://www.oo-services.com/

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-04-24 11:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-24 11:11 mandatory locks and LOCK_MAND Michael Ganss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox