diff options
-rw-r--r-- | fs/gfs2/glock.c | 18 | ||||
-rw-r--r-- | fs/gfs2/glock.h | 4 | ||||
-rw-r--r-- | fs/gfs2/incore.h | 2 |
3 files changed, 15 insertions, 9 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 80e09c50590a..82471c82f024 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -399,7 +399,7 @@ void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, unsigned flags, | |||
399 | INIT_LIST_HEAD(&gh->gh_list); | 399 | INIT_LIST_HEAD(&gh->gh_list); |
400 | gh->gh_gl = gl; | 400 | gh->gh_gl = gl; |
401 | gh->gh_ip = (unsigned long)__builtin_return_address(0); | 401 | gh->gh_ip = (unsigned long)__builtin_return_address(0); |
402 | gh->gh_owner_pid = current->pid; | 402 | gh->gh_owner_pid = get_pid(task_pid(current)); |
403 | gh->gh_state = state; | 403 | gh->gh_state = state; |
404 | gh->gh_flags = flags; | 404 | gh->gh_flags = flags; |
405 | gh->gh_error = 0; | 405 | gh->gh_error = 0; |
@@ -433,6 +433,7 @@ void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder * | |||
433 | 433 | ||
434 | void gfs2_holder_uninit(struct gfs2_holder *gh) | 434 | void gfs2_holder_uninit(struct gfs2_holder *gh) |
435 | { | 435 | { |
436 | put_pid(gh->gh_owner_pid); | ||
436 | gfs2_glock_put(gh->gh_gl); | 437 | gfs2_glock_put(gh->gh_gl); |
437 | gh->gh_gl = NULL; | 438 | gh->gh_gl = NULL; |
438 | gh->gh_ip = 0; | 439 | gh->gh_ip = 0; |
@@ -1045,7 +1046,7 @@ static int glock_wait_internal(struct gfs2_holder *gh) | |||
1045 | } | 1046 | } |
1046 | 1047 | ||
1047 | static inline struct gfs2_holder * | 1048 | static inline struct gfs2_holder * |
1048 | find_holder_by_owner(struct list_head *head, pid_t pid) | 1049 | find_holder_by_owner(struct list_head *head, struct pid *pid) |
1049 | { | 1050 | { |
1050 | struct gfs2_holder *gh; | 1051 | struct gfs2_holder *gh; |
1051 | 1052 | ||
@@ -1082,7 +1083,7 @@ static void add_to_queue(struct gfs2_holder *gh) | |||
1082 | struct gfs2_glock *gl = gh->gh_gl; | 1083 | struct gfs2_glock *gl = gh->gh_gl; |
1083 | struct gfs2_holder *existing; | 1084 | struct gfs2_holder *existing; |
1084 | 1085 | ||
1085 | BUG_ON(!gh->gh_owner_pid); | 1086 | BUG_ON(gh->gh_owner_pid == NULL); |
1086 | if (test_and_set_bit(HIF_WAIT, &gh->gh_iflags)) | 1087 | if (test_and_set_bit(HIF_WAIT, &gh->gh_iflags)) |
1087 | BUG(); | 1088 | BUG(); |
1088 | 1089 | ||
@@ -1092,12 +1093,14 @@ static void add_to_queue(struct gfs2_holder *gh) | |||
1092 | if (existing) { | 1093 | if (existing) { |
1093 | print_symbol(KERN_WARNING "original: %s\n", | 1094 | print_symbol(KERN_WARNING "original: %s\n", |
1094 | existing->gh_ip); | 1095 | existing->gh_ip); |
1095 | printk(KERN_INFO "pid : %d\n", existing->gh_owner_pid); | 1096 | printk(KERN_INFO "pid : %d\n", |
1097 | pid_nr(existing->gh_owner_pid)); | ||
1096 | printk(KERN_INFO "lock type : %d lock state : %d\n", | 1098 | printk(KERN_INFO "lock type : %d lock state : %d\n", |
1097 | existing->gh_gl->gl_name.ln_type, | 1099 | existing->gh_gl->gl_name.ln_type, |
1098 | existing->gh_gl->gl_state); | 1100 | existing->gh_gl->gl_state); |
1099 | print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip); | 1101 | print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip); |
1100 | printk(KERN_INFO "pid : %d\n", gh->gh_owner_pid); | 1102 | printk(KERN_INFO "pid : %d\n", |
1103 | pid_nr(gh->gh_owner_pid)); | ||
1101 | printk(KERN_INFO "lock type : %d lock state : %d\n", | 1104 | printk(KERN_INFO "lock type : %d lock state : %d\n", |
1102 | gl->gl_name.ln_type, gl->gl_state); | 1105 | gl->gl_name.ln_type, gl->gl_state); |
1103 | BUG(); | 1106 | BUG(); |
@@ -1798,8 +1801,9 @@ static int dump_holder(struct glock_iter *gi, char *str, | |||
1798 | 1801 | ||
1799 | print_dbg(gi, " %s\n", str); | 1802 | print_dbg(gi, " %s\n", str); |
1800 | if (gh->gh_owner_pid) { | 1803 | if (gh->gh_owner_pid) { |
1801 | print_dbg(gi, " owner = %ld ", (long)gh->gh_owner_pid); | 1804 | print_dbg(gi, " owner = %ld ", |
1802 | gh_owner = find_task_by_pid(gh->gh_owner_pid); | 1805 | (long)pid_nr(gh->gh_owner_pid)); |
1806 | gh_owner = pid_task(gh->gh_owner_pid, PIDTYPE_PID); | ||
1803 | if (gh_owner) | 1807 | if (gh_owner) |
1804 | print_dbg(gi, "(%s)\n", gh_owner->comm); | 1808 | print_dbg(gi, "(%s)\n", gh_owner->comm); |
1805 | else | 1809 | else |
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h index b16f604eea9f..2f9c6d136b37 100644 --- a/fs/gfs2/glock.h +++ b/fs/gfs2/glock.h | |||
@@ -36,11 +36,13 @@ static inline int gfs2_glock_is_locked_by_me(struct gfs2_glock *gl) | |||
36 | { | 36 | { |
37 | struct gfs2_holder *gh; | 37 | struct gfs2_holder *gh; |
38 | int locked = 0; | 38 | int locked = 0; |
39 | struct pid *pid; | ||
39 | 40 | ||
40 | /* Look in glock's list of holders for one with current task as owner */ | 41 | /* Look in glock's list of holders for one with current task as owner */ |
41 | spin_lock(&gl->gl_spin); | 42 | spin_lock(&gl->gl_spin); |
43 | pid = task_pid(current); | ||
42 | list_for_each_entry(gh, &gl->gl_holders, gh_list) { | 44 | list_for_each_entry(gh, &gl->gl_holders, gh_list) { |
43 | if (gh->gh_owner_pid == current->pid) { | 45 | if (gh->gh_owner_pid == pid) { |
44 | locked = 1; | 46 | locked = 1; |
45 | break; | 47 | break; |
46 | } | 48 | } |
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h index 513aaf0dc0ab..4b724e772602 100644 --- a/fs/gfs2/incore.h +++ b/fs/gfs2/incore.h | |||
@@ -151,7 +151,7 @@ struct gfs2_holder { | |||
151 | struct list_head gh_list; | 151 | struct list_head gh_list; |
152 | 152 | ||
153 | struct gfs2_glock *gh_gl; | 153 | struct gfs2_glock *gh_gl; |
154 | pid_t gh_owner_pid; | 154 | struct pid *gh_owner_pid; |
155 | unsigned int gh_state; | 155 | unsigned int gh_state; |
156 | unsigned gh_flags; | 156 | unsigned gh_flags; |
157 | 157 | ||