diff options
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 80e09c50590a..7175a4d06435 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -334,7 +334,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, | |||
334 | gl->gl_state = LM_ST_UNLOCKED; | 334 | gl->gl_state = LM_ST_UNLOCKED; |
335 | gl->gl_demote_state = LM_ST_EXCLUSIVE; | 335 | gl->gl_demote_state = LM_ST_EXCLUSIVE; |
336 | gl->gl_hash = hash; | 336 | gl->gl_hash = hash; |
337 | gl->gl_owner_pid = 0; | 337 | gl->gl_owner_pid = NULL; |
338 | gl->gl_ip = 0; | 338 | gl->gl_ip = 0; |
339 | gl->gl_ops = glops; | 339 | gl->gl_ops = glops; |
340 | gl->gl_req_gh = NULL; | 340 | gl->gl_req_gh = NULL; |
@@ -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; |
@@ -631,7 +632,7 @@ static void gfs2_glmutex_lock(struct gfs2_glock *gl) | |||
631 | wait_on_holder(&gh); | 632 | wait_on_holder(&gh); |
632 | gfs2_holder_uninit(&gh); | 633 | gfs2_holder_uninit(&gh); |
633 | } else { | 634 | } else { |
634 | gl->gl_owner_pid = current->pid; | 635 | gl->gl_owner_pid = get_pid(task_pid(current)); |
635 | gl->gl_ip = (unsigned long)__builtin_return_address(0); | 636 | gl->gl_ip = (unsigned long)__builtin_return_address(0); |
636 | spin_unlock(&gl->gl_spin); | 637 | spin_unlock(&gl->gl_spin); |
637 | } | 638 | } |
@@ -652,7 +653,7 @@ static int gfs2_glmutex_trylock(struct gfs2_glock *gl) | |||
652 | if (test_and_set_bit(GLF_LOCK, &gl->gl_flags)) { | 653 | if (test_and_set_bit(GLF_LOCK, &gl->gl_flags)) { |
653 | acquired = 0; | 654 | acquired = 0; |
654 | } else { | 655 | } else { |
655 | gl->gl_owner_pid = current->pid; | 656 | gl->gl_owner_pid = get_pid(task_pid(current)); |
656 | gl->gl_ip = (unsigned long)__builtin_return_address(0); | 657 | gl->gl_ip = (unsigned long)__builtin_return_address(0); |
657 | } | 658 | } |
658 | spin_unlock(&gl->gl_spin); | 659 | spin_unlock(&gl->gl_spin); |
@@ -668,12 +669,17 @@ static int gfs2_glmutex_trylock(struct gfs2_glock *gl) | |||
668 | 669 | ||
669 | static void gfs2_glmutex_unlock(struct gfs2_glock *gl) | 670 | static void gfs2_glmutex_unlock(struct gfs2_glock *gl) |
670 | { | 671 | { |
672 | struct pid *pid; | ||
673 | |||
671 | spin_lock(&gl->gl_spin); | 674 | spin_lock(&gl->gl_spin); |
672 | clear_bit(GLF_LOCK, &gl->gl_flags); | 675 | clear_bit(GLF_LOCK, &gl->gl_flags); |
673 | gl->gl_owner_pid = 0; | 676 | pid = gl->gl_owner_pid; |
677 | gl->gl_owner_pid = NULL; | ||
674 | gl->gl_ip = 0; | 678 | gl->gl_ip = 0; |
675 | run_queue(gl); | 679 | run_queue(gl); |
676 | spin_unlock(&gl->gl_spin); | 680 | spin_unlock(&gl->gl_spin); |
681 | |||
682 | put_pid(pid); | ||
677 | } | 683 | } |
678 | 684 | ||
679 | /** | 685 | /** |
@@ -1045,7 +1051,7 @@ static int glock_wait_internal(struct gfs2_holder *gh) | |||
1045 | } | 1051 | } |
1046 | 1052 | ||
1047 | static inline struct gfs2_holder * | 1053 | static inline struct gfs2_holder * |
1048 | find_holder_by_owner(struct list_head *head, pid_t pid) | 1054 | find_holder_by_owner(struct list_head *head, struct pid *pid) |
1049 | { | 1055 | { |
1050 | struct gfs2_holder *gh; | 1056 | struct gfs2_holder *gh; |
1051 | 1057 | ||
@@ -1082,7 +1088,7 @@ static void add_to_queue(struct gfs2_holder *gh) | |||
1082 | struct gfs2_glock *gl = gh->gh_gl; | 1088 | struct gfs2_glock *gl = gh->gh_gl; |
1083 | struct gfs2_holder *existing; | 1089 | struct gfs2_holder *existing; |
1084 | 1090 | ||
1085 | BUG_ON(!gh->gh_owner_pid); | 1091 | BUG_ON(gh->gh_owner_pid == NULL); |
1086 | if (test_and_set_bit(HIF_WAIT, &gh->gh_iflags)) | 1092 | if (test_and_set_bit(HIF_WAIT, &gh->gh_iflags)) |
1087 | BUG(); | 1093 | BUG(); |
1088 | 1094 | ||
@@ -1092,12 +1098,14 @@ static void add_to_queue(struct gfs2_holder *gh) | |||
1092 | if (existing) { | 1098 | if (existing) { |
1093 | print_symbol(KERN_WARNING "original: %s\n", | 1099 | print_symbol(KERN_WARNING "original: %s\n", |
1094 | existing->gh_ip); | 1100 | existing->gh_ip); |
1095 | printk(KERN_INFO "pid : %d\n", existing->gh_owner_pid); | 1101 | printk(KERN_INFO "pid : %d\n", |
1102 | pid_nr(existing->gh_owner_pid)); | ||
1096 | printk(KERN_INFO "lock type : %d lock state : %d\n", | 1103 | printk(KERN_INFO "lock type : %d lock state : %d\n", |
1097 | existing->gh_gl->gl_name.ln_type, | 1104 | existing->gh_gl->gl_name.ln_type, |
1098 | existing->gh_gl->gl_state); | 1105 | existing->gh_gl->gl_state); |
1099 | print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip); | 1106 | print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip); |
1100 | printk(KERN_INFO "pid : %d\n", gh->gh_owner_pid); | 1107 | printk(KERN_INFO "pid : %d\n", |
1108 | pid_nr(gh->gh_owner_pid)); | ||
1101 | printk(KERN_INFO "lock type : %d lock state : %d\n", | 1109 | printk(KERN_INFO "lock type : %d lock state : %d\n", |
1102 | gl->gl_name.ln_type, gl->gl_state); | 1110 | gl->gl_name.ln_type, gl->gl_state); |
1103 | BUG(); | 1111 | BUG(); |
@@ -1798,8 +1806,9 @@ static int dump_holder(struct glock_iter *gi, char *str, | |||
1798 | 1806 | ||
1799 | print_dbg(gi, " %s\n", str); | 1807 | print_dbg(gi, " %s\n", str); |
1800 | if (gh->gh_owner_pid) { | 1808 | if (gh->gh_owner_pid) { |
1801 | print_dbg(gi, " owner = %ld ", (long)gh->gh_owner_pid); | 1809 | print_dbg(gi, " owner = %ld ", |
1802 | gh_owner = find_task_by_pid(gh->gh_owner_pid); | 1810 | (long)pid_nr(gh->gh_owner_pid)); |
1811 | gh_owner = pid_task(gh->gh_owner_pid, PIDTYPE_PID); | ||
1803 | if (gh_owner) | 1812 | if (gh_owner) |
1804 | print_dbg(gi, "(%s)\n", gh_owner->comm); | 1813 | print_dbg(gi, "(%s)\n", gh_owner->comm); |
1805 | else | 1814 | else |
@@ -1877,13 +1886,13 @@ static int dump_glock(struct glock_iter *gi, struct gfs2_glock *gl) | |||
1877 | print_dbg(gi, " gl_ref = %d\n", atomic_read(&gl->gl_ref)); | 1886 | print_dbg(gi, " gl_ref = %d\n", atomic_read(&gl->gl_ref)); |
1878 | print_dbg(gi, " gl_state = %u\n", gl->gl_state); | 1887 | print_dbg(gi, " gl_state = %u\n", gl->gl_state); |
1879 | if (gl->gl_owner_pid) { | 1888 | if (gl->gl_owner_pid) { |
1880 | gl_owner = find_task_by_pid(gl->gl_owner_pid); | 1889 | gl_owner = pid_task(gl->gl_owner_pid, PIDTYPE_PID); |
1881 | if (gl_owner) | 1890 | if (gl_owner) |
1882 | print_dbg(gi, " gl_owner = pid %d (%s)\n", | 1891 | print_dbg(gi, " gl_owner = pid %d (%s)\n", |
1883 | gl->gl_owner_pid, gl_owner->comm); | 1892 | pid_nr(gl->gl_owner_pid), gl_owner->comm); |
1884 | else | 1893 | else |
1885 | print_dbg(gi, " gl_owner = %d (ended)\n", | 1894 | print_dbg(gi, " gl_owner = %d (ended)\n", |
1886 | gl->gl_owner_pid); | 1895 | pid_nr(gl->gl_owner_pid)); |
1887 | } else | 1896 | } else |
1888 | print_dbg(gi, " gl_owner = -1\n"); | 1897 | print_dbg(gi, " gl_owner = -1\n"); |
1889 | print_dbg(gi, " gl_ip = %lu\n", gl->gl_ip); | 1898 | print_dbg(gi, " gl_ip = %lu\n", gl->gl_ip); |