From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Ganss Subject: mandatory locks and LOCK_MAND Date: Wed, 24 Apr 2002 13:11:15 +0200 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <3CC692D3.7040907@oo-services.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: To: linux-fsdevel@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Hi, I'm trying to get mandatory file locking to work. I don't want to use=20 the mount option plus permission bits hack. The only helpful document I could find (besides mandatory.txt in the=20 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= =20 may open a file which would conflict with the Share Mode on the file.=20 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 th= e=20 lock: 1: FLOCK MSNFS NONE 17653 03:05:44 0 EOF dfb6b458 c02eb928=20 dfb6bb30 000000 00 dfb6b464 but it doesn't seem to be enforced anywhere. other processes can still=20 open(2), read(2), write(2). I've skimmed fs/locks.c and for=20 locks_may_read() it says: "*=20 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= =2E=20 is this correct, or am I doing something wrong? on the other hand, leases work as described. regards --=20 O&O Services GmbH - Delivering Value! Michael Gan=DF 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