* [PATCH fs/locks 1 of 3] Fix miscompare in __posix_lock_file
@ 2005-07-11 10:32 Olaf Kirch
0 siblings, 0 replies; only message in thread
From: Olaf Kirch @ 2005-07-11 10:32 UTC (permalink / raw)
To: nfs, akpm
# Subject: Fix miscompare in __posix_lock_file
#
# If an application requests the same lock twice, the
# kernel should just leave the existing lock in place.
# Currently, it will install a second lock of the same type.
#
# Signed-off-by: Olaf Kirch <okir@suse.de>
Index: linux-2.6.12/fs/locks.c
===================================================================
--- linux-2.6.12.orig/fs/locks.c 2005-07-11 12:15:59.000000000 +0200
+++ linux-2.6.12/fs/locks.c 2005-07-11 12:16:41.000000000 +0200
@@ -828,12 +828,16 @@ static int __posix_lock_file(struct inod
/* Detect adjacent or overlapping regions (if same lock type)
*/
if (request->fl_type == fl->fl_type) {
+ /* In all comparisons of start vs end, use
+ * "start - 1" rather than "end + 1". If end
+ * is OFFSET_MAX, end + 1 will become negative.
+ */
if (fl->fl_end < request->fl_start - 1)
goto next_lock;
/* If the next lock in the list has entirely bigger
* addresses than the new one, insert the lock here.
*/
- if (fl->fl_start > request->fl_end + 1)
+ if (fl->fl_start - 1 > request->fl_end)
break;
/* If we come here, the new and old lock are of the
--
Olaf Kirch | --- o --- Nous sommes du soleil we love when we play
okir@suse.de | / | \ sol.dhoop.naytheet.ah kin.ir.samse.qurax
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-07-11 10:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-11 10:32 [PATCH fs/locks 1 of 3] Fix miscompare in __posix_lock_file Olaf Kirch
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.