aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/glock.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-02-07 03:13:19 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:06 -0500
commitb1e058da50f7938e9c9e963e978b0730bba4ad32 (patch)
tree77dbff919c9c7f1d60d69426726c9aad6a2348a3 /fs/gfs2/glock.c
parent488b5ec871191359b9b79262a3d48456dae7ea5f (diff)
gfs2: make gfs2_holder.gh_owner_pid be a struct pid *
The gl_owner_pid field is used to get the holder task by its pid and check whether the current is a holder, so make it in a proper manner, i.e. via the struct pid * manipulations. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Steven Whitehouse <swhiteho@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r--fs/gfs2/glock.c18
1 files changed, 11 insertions, 7 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
434void gfs2_holder_uninit(struct gfs2_holder *gh) 434void 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
1047static inline struct gfs2_holder * 1048static inline struct gfs2_holder *
1048find_holder_by_owner(struct list_head *head, pid_t pid) 1049find_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