glock.c (c1f3ee120bb61045b1c0a3ead620d1d65af47130) | glock.c (b1e058da50f7938e9c9e963e978b0730bba4ad32) |
---|---|
1/* 2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 3 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 4 * 5 * This copyrighted material is made available to anyone wishing to use, 6 * modify, copy, or redistribute it subject to the terms and conditions 7 * of the GNU General Public License version 2. 8 */ --- 385 unchanged lines hidden (view full) --- 394 */ 395 396void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, unsigned flags, 397 struct gfs2_holder *gh) 398{ 399 INIT_LIST_HEAD(&gh->gh_list); 400 gh->gh_gl = gl; 401 gh->gh_ip = (unsigned long)__builtin_return_address(0); | 1/* 2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 3 * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. 4 * 5 * This copyrighted material is made available to anyone wishing to use, 6 * modify, copy, or redistribute it subject to the terms and conditions 7 * of the GNU General Public License version 2. 8 */ --- 385 unchanged lines hidden (view full) --- 394 */ 395 396void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, unsigned flags, 397 struct gfs2_holder *gh) 398{ 399 INIT_LIST_HEAD(&gh->gh_list); 400 gh->gh_gl = gl; 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; 404 gh->gh_flags = flags; 405 gh->gh_error = 0; 406 gh->gh_iflags = 0; 407 gfs2_glock_hold(gl); 408} 409 410/** --- 17 unchanged lines hidden (view full) --- 428/** 429 * gfs2_holder_uninit - uninitialize a holder structure (drop glock reference) 430 * @gh: the holder structure 431 * 432 */ 433 434void gfs2_holder_uninit(struct gfs2_holder *gh) 435{ | 403 gh->gh_state = state; 404 gh->gh_flags = flags; 405 gh->gh_error = 0; 406 gh->gh_iflags = 0; 407 gfs2_glock_hold(gl); 408} 409 410/** --- 17 unchanged lines hidden (view full) --- 428/** 429 * gfs2_holder_uninit - uninitialize a holder structure (drop glock reference) 430 * @gh: the holder structure 431 * 432 */ 433 434void gfs2_holder_uninit(struct gfs2_holder *gh) 435{ |
436 put_pid(gh->gh_owner_pid); |
|
436 gfs2_glock_put(gh->gh_gl); 437 gh->gh_gl = NULL; 438 gh->gh_ip = 0; 439} 440 441static void gfs2_holder_wake(struct gfs2_holder *gh) 442{ 443 clear_bit(HIF_WAIT, &gh->gh_iflags); --- 596 unchanged lines hidden (view full) --- 1040 run_queue(gl); 1041 spin_unlock(&gl->gl_spin); 1042 } 1043 1044 return gh->gh_error; 1045} 1046 1047static inline struct gfs2_holder * | 437 gfs2_glock_put(gh->gh_gl); 438 gh->gh_gl = NULL; 439 gh->gh_ip = 0; 440} 441 442static void gfs2_holder_wake(struct gfs2_holder *gh) 443{ 444 clear_bit(HIF_WAIT, &gh->gh_iflags); --- 596 unchanged lines hidden (view full) --- 1041 run_queue(gl); 1042 spin_unlock(&gl->gl_spin); 1043 } 1044 1045 return gh->gh_error; 1046} 1047 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 struct gfs2_holder *gh; 1051 1052 list_for_each_entry(gh, head, gh_list) { 1053 if (gh->gh_owner_pid == pid) 1054 return gh; 1055 } 1056 --- 20 unchanged lines hidden (view full) --- 1077 * 1078 */ 1079 1080static void add_to_queue(struct gfs2_holder *gh) 1081{ 1082 struct gfs2_glock *gl = gh->gh_gl; 1083 struct gfs2_holder *existing; 1084 | 1050{ 1051 struct gfs2_holder *gh; 1052 1053 list_for_each_entry(gh, head, gh_list) { 1054 if (gh->gh_owner_pid == pid) 1055 return gh; 1056 } 1057 --- 20 unchanged lines hidden (view full) --- 1078 * 1079 */ 1080 1081static void add_to_queue(struct gfs2_holder *gh) 1082{ 1083 struct gfs2_glock *gl = gh->gh_gl; 1084 struct gfs2_holder *existing; 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 BUG(); 1088 1089 if (!(gh->gh_flags & GL_FLOCK)) { 1090 existing = find_holder_by_owner(&gl->gl_holders, 1091 gh->gh_owner_pid); 1092 if (existing) { 1093 print_symbol(KERN_WARNING "original: %s\n", 1094 existing->gh_ip); | 1087 if (test_and_set_bit(HIF_WAIT, &gh->gh_iflags)) 1088 BUG(); 1089 1090 if (!(gh->gh_flags & GL_FLOCK)) { 1091 existing = find_holder_by_owner(&gl->gl_holders, 1092 gh->gh_owner_pid); 1093 if (existing) { 1094 print_symbol(KERN_WARNING "original: %s\n", 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", 1097 existing->gh_gl->gl_name.ln_type, 1098 existing->gh_gl->gl_state); 1099 print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip); | 1098 printk(KERN_INFO "lock type : %d lock state : %d\n", 1099 existing->gh_gl->gl_name.ln_type, 1100 existing->gh_gl->gl_state); 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", 1102 gl->gl_name.ln_type, gl->gl_state); 1103 BUG(); 1104 } 1105 1106 existing = find_holder_by_owner(&gl->gl_waiters3, 1107 gh->gh_owner_pid); 1108 if (existing) { --- 684 unchanged lines hidden (view full) --- 1793static int dump_holder(struct glock_iter *gi, char *str, 1794 struct gfs2_holder *gh) 1795{ 1796 unsigned int x; 1797 struct task_struct *gh_owner; 1798 1799 print_dbg(gi, " %s\n", str); 1800 if (gh->gh_owner_pid) { | 1104 printk(KERN_INFO "lock type : %d lock state : %d\n", 1105 gl->gl_name.ln_type, gl->gl_state); 1106 BUG(); 1107 } 1108 1109 existing = find_holder_by_owner(&gl->gl_waiters3, 1110 gh->gh_owner_pid); 1111 if (existing) { --- 684 unchanged lines hidden (view full) --- 1796static int dump_holder(struct glock_iter *gi, char *str, 1797 struct gfs2_holder *gh) 1798{ 1799 unsigned int x; 1800 struct task_struct *gh_owner; 1801 1802 print_dbg(gi, " %s\n", str); 1803 if (gh->gh_owner_pid) { |
1801 print_dbg(gi, " owner = %ld ", (long)gh->gh_owner_pid); 1802 gh_owner = find_task_by_pid(gh->gh_owner_pid); | 1804 print_dbg(gi, " owner = %ld ", 1805 (long)pid_nr(gh->gh_owner_pid)); 1806 gh_owner = pid_task(gh->gh_owner_pid, PIDTYPE_PID); |
1803 if (gh_owner) 1804 print_dbg(gi, "(%s)\n", gh_owner->comm); 1805 else 1806 print_dbg(gi, "(ended)\n"); 1807 } else 1808 print_dbg(gi, " owner = -1\n"); 1809 print_dbg(gi, " gh_state = %u\n", gh->gh_state); 1810 print_dbg(gi, " gh_flags ="); --- 421 unchanged lines hidden --- | 1807 if (gh_owner) 1808 print_dbg(gi, "(%s)\n", gh_owner->comm); 1809 else 1810 print_dbg(gi, "(ended)\n"); 1811 } else 1812 print_dbg(gi, " owner = -1\n"); 1813 print_dbg(gi, " gh_state = %u\n", gh->gh_state); 1814 print_dbg(gi, " gh_flags ="); --- 421 unchanged lines hidden --- |