Whamcloud - gitweb
refine locking for avoid write wrong info into lov_objid file and some races.
[fs/lustre-release.git] / lustre / include / obd.h
index e86e153..5d1fe3b 100644 (file)
@@ -523,12 +523,19 @@ struct mds_obd {
         struct obd_export               *mds_osc_exp; /* XXX lov_exp */
         struct lov_desc                  mds_lov_desc;
         __u32                            mds_id;
-        obd_id                          *mds_lov_objids;
-        int                              mds_lov_objids_size;
-        __u32                            mds_lov_objids_in_file;
+
         unsigned int                     mds_lov_objids_dirty:1;
-        int                              mds_lov_nextid_set;
         struct file                     *mds_lov_objid_filp;
+        /* protect update vs free in lov_add_target */
+        struct rw_semaphore              mds_lov_objids_sem;
+        /* protect update vs update or memmove vs update */
+        spinlock_t                       mds_lov_objids_lock;
+        /* wait for safe free */
+        cfs_waitq_t                      mds_lov_objids_wait;
+        obd_id                          *mds_lov_objids;
+        __u32                            mds_lov_objids_count;
+        int                              mds_lov_nextid_set;
+
         struct file                     *mds_health_check_filp;
         unsigned long                   *mds_client_bitmap;
 //        struct upcall_cache             *mds_group_hash;
@@ -552,6 +559,8 @@ struct mds_obd {
         struct lustre_capa_key          *mds_capa_keys;
 };
 
+#define mds_lov_objids_size(mds)        ((mds)->mds_lov_objids_count*sizeof(obd_id))
+
 struct echo_obd {
         struct obdo          eo_oa;
         spinlock_t           eo_lock;