diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 96b7a524065eba27248fee6fd93abbdd83560497..2da7baedc7317467047a77e7f2b125420a0df620 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -156,6 +156,15 @@ Details    : Directly associate cached pages to lock that protect those pages,
              this allows us to quickly find what pages to write and remove
 	     once lock callback is received.
 
+Severity   : normal
+Bugzilla   : 14379
+Description: Too many locks accumulating on client during NFS usage
+Details    : mds_open improperly used accmode to find out access mode to a
+             file. Also mdc_intent_lock logic to find out if we already have
+	     lock similar to just received was flawed since introduction of
+	     skiplists - locks are now added to the front of the granted
+	     queue.
+
 --------------------------------------------------------------------------------
 
 2007-12-07         Cluster File Systems, Inc. <info@clusterfs.com>
diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c
index a9996267de402ea44af48676521fe6c02f274bdd..977ff9ab0c5c6738bbced3f3025f35148cb19503 100644
--- a/lustre/ldlm/ldlm_lock.c
+++ b/lustre/ldlm/ldlm_lock.c
@@ -919,7 +919,7 @@ static struct ldlm_lock *search_queue(struct list_head *queue,
                 lock = list_entry(tmp, struct ldlm_lock, l_res_link);
 
                 if (lock == old_lock)
-                        break;
+                        continue;
 
                 /* llite sometimes wants to match locks that will be
                  * canceled when their users drop, but we allow it to match
diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c
index 7c50196f35c7ff7eee50db55313c5385711dda40..d038f111c3d45e2e1766557f336b0ca558488c3f 100644
--- a/lustre/mds/mds_open.c
+++ b/lustre/mds/mds_open.c
@@ -1151,9 +1151,9 @@ found_child:
 
         /* We cannot use acc_mode here, because it is zeroed in case of
            creating a file, so we get wrong lockmode */
-        if (accmode(dchild->d_inode, rec->ur_flags) & MAY_WRITE)
+        if (rec->ur_flags & FMODE_WRITE)
                 child_mode = LCK_CW;
-        else if (accmode(dchild->d_inode, rec->ur_flags) & MAY_EXEC)
+        else if (rec->ur_flags & MDS_FMODE_EXEC)
                 child_mode = LCK_PR;
         else
                 child_mode = LCK_CR;