diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h
index 876f75dd8188577e9456f259f7fd12564244772e..e501004ebc6d792058ae0542c2950cb3722cf25e 100644
--- a/lustre/include/linux/obd.h
+++ b/lustre/include/linux/obd.h
@@ -328,6 +328,7 @@ struct mds_obd {
         int                              mds_lov_objids_valid;
         int                              mds_lov_nextid_set;
         struct file                     *mds_lov_objid_filp;
+        spinlock_t                      mds_lov_lock;
         unsigned long                   *mds_client_bitmap;
         struct semaphore                 mds_orphan_recovery_sem;
         /*add mds num here for real mds and cache mds create
diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c
index 81b22b3f8ce17994caceaef07436daad3d817c05..031ec325512eb9d5f09a745a1935bdc7b35f670d 100644
--- a/lustre/mds/mds_lov.c
+++ b/lustre/mds/mds_lov.c
@@ -61,11 +61,11 @@ void mds_lov_update_objids(struct obd_device *obd, obd_id *ids)
         int i;
         ENTRY;
 
-        lock_kernel();
+        spin_lock(&mds->mds_lov_lock);
         for (i = 0; i < mds->mds_lov_desc.ld_tgt_count; i++)
                 if (ids[i] > (mds->mds_lov_objids)[i])
                         (mds->mds_lov_objids)[i] = ids[i];
-        unlock_kernel();
+        spin_unlock(&mds->mds_lov_lock);
         EXIT;
 }
 
@@ -207,6 +207,7 @@ int mds_lov_connect(struct obd_device *obd, char * lov_name)
         if (mds->mds_osc_obd)
                 RETURN(0);
 
+        spin_lock_init(&mds->mds_lov_lock);
         mds->mds_osc_obd = class_name2obd(lov_name);
         if (!mds->mds_osc_obd) {
                 CERROR("MDS cannot locate LOV %s\n",