Whamcloud - gitweb
Branch b1_6
authorbobijam <bobijam>
Fri, 10 Oct 2008 01:55:17 +0000 (01:55 +0000)
committerbobijam <bobijam>
Fri, 10 Oct 2008 01:55:17 +0000 (01:55 +0000)
b=17309
i=johann

backport from bz 16266 for proper using write lock in lprocfs_remove().

lustre/include/lprocfs_status.h
lustre/obdclass/lprocfs_status.c

index 8c50f59..e5c0138 100644 (file)
@@ -527,6 +527,12 @@ extern struct rw_semaphore _lprocfs_lock;
                 return -ENODEV;                 \
         }                                       \
 } while(0)
+#define LPROCFS_WRITE_ENTRY()     do {  \
+        down_write(&_lprocfs_lock);     \
+} while(0)
+#define LPROCFS_WRITE_EXIT()      do {  \
+        up_write(&_lprocfs_lock);       \
+} while(0)
 
 /* You must use these macros when you want to refer to
  * the import in a client obd_device for a lprocfs entry */
index 660a4eb..310093c 100644 (file)
@@ -328,7 +328,7 @@ void lprocfs_remove(struct proc_dir_entry **rooth)
 
         parent = root->parent;
         LASSERT(parent != NULL);
-        LPROCFS_ENTRY(); /* search vs remove race */
+        LPROCFS_WRITE_ENTRY(); /* search vs remove race */
 
         while (1) {
                 while (temp->subdir != NULL)
@@ -350,7 +350,7 @@ void lprocfs_remove(struct proc_dir_entry **rooth)
                 if (temp == parent)
                         break;
         }
-        LPROCFS_EXIT();
+        LPROCFS_WRITE_EXIT();
 }
 
 struct proc_dir_entry *lprocfs_register(const char *name,
@@ -1316,7 +1316,7 @@ void lprocfs_exp_print_hash(void *obj, void *cb_data)
                         *data->len += lustre_hash_debug_header(data->page,
                                                                data->count);
 
-                *data->len += lustre_hash_debug_str(lh, data->page + 
+                *data->len += lustre_hash_debug_str(lh, data->page +
                                                     *data->len,
                                                     data->count);
      }