From fae163bee55e1895ff69d0bdea279919d63110a5 Mon Sep 17 00:00:00 2001 From: bobijam <bobijam> Date: Fri, 10 Oct 2008 01:55:17 +0000 Subject: [PATCH] Branch b1_6 b=17309 i=johann backport from bz 16266 for proper using write lock in lprocfs_remove(). --- lustre/include/lprocfs_status.h | 6 ++++++ lustre/obdclass/lprocfs_status.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 8c50f59fb6..e5c01389b1 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -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 */ diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 660a4eb71a..310093c6f7 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -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); } -- GitLab