diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-02-07 03:13:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:06 -0500 |
commit | eccba068915feece2868c502787037e244db3376 (patch) | |
tree | eac7790a497c1a33c167605a81ba62b22057b99c /fs/gfs2/glock.c | |
parent | 4cbc76eadf56399cd11fb736b33c53aec9caab8c (diff) |
gfs2: make gfs2_glock.gl_owner_pid be a struct pid *
The gl_owner_pid field is used to get the lock owning task by its pid, so make
it in a proper manner, i.e. by using the struct pid pointer and pid_task()
function.
The pid_task() becomes exported for the gfs2 module.
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.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 82471c82f024..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; |
@@ -632,7 +632,7 @@ static void gfs2_glmutex_lock(struct gfs2_glock *gl) | |||
632 | wait_on_holder(&gh); | 632 | wait_on_holder(&gh); |
633 | gfs2_holder_uninit(&gh); | 633 | gfs2_holder_uninit(&gh); |
634 | } else { | 634 | } else { |
635 | gl->gl_owner_pid = current->pid; | 635 | gl->gl_owner_pid = get_pid(task_pid(current)); |
636 | gl->gl_ip = (unsigned long)__builtin_return_address(0); | 636 | gl->gl_ip = (unsigned long)__builtin_return_address(0); |
637 | spin_unlock(&gl->gl_spin); | 637 | spin_unlock(&gl->gl_spin); |
638 | } | 638 | } |
@@ -653,7 +653,7 @@ static int gfs2_glmutex_trylock(struct gfs2_glock *gl) | |||
653 | if (test_and_set_bit(GLF_LOCK, &gl->gl_flags)) { | 653 | if (test_and_set_bit(GLF_LOCK, &gl->gl_flags)) { |
654 | acquired = 0; | 654 | acquired = 0; |
655 | } else { | 655 | } else { |
656 | gl->gl_owner_pid = current->pid; | 656 | gl->gl_owner_pid = get_pid(task_pid(current)); |
657 | gl->gl_ip = (unsigned long)__builtin_return_address(0); | 657 | gl->gl_ip = (unsigned long)__builtin_return_address(0); |
658 | } | 658 | } |
659 | spin_unlock(&gl->gl_spin); | 659 | spin_unlock(&gl->gl_spin); |
@@ -669,12 +669,17 @@ static int gfs2_glmutex_trylock(struct gfs2_glock *gl) | |||
669 | 669 | ||
670 | static void gfs2_glmutex_unlock(struct gfs2_glock *gl) | 670 | static void gfs2_glmutex_unlock(struct gfs2_glock *gl) |
671 | { | 671 | { |
672 | struct pid *pid; | ||
673 | |||
672 | spin_lock(&gl->gl_spin); | 674 | spin_lock(&gl->gl_spin); |
673 | clear_bit(GLF_LOCK, &gl->gl_flags); | 675 | clear_bit(GLF_LOCK, &gl->gl_flags); |
674 | gl->gl_owner_pid = 0; | 676 | pid = gl->gl_owner_pid; |
677 | gl->gl_owner_pid = NULL; | ||
675 | gl->gl_ip = 0; | 678 | gl->gl_ip = 0; |
676 | run_queue(gl); | 679 | run_queue(gl); |
677 | spin_unlock(&gl->gl_spin); | 680 | spin_unlock(&gl->gl_spin); |
681 | |||
682 | put_pid(pid); | ||
678 | } | 683 | } |
679 | 684 | ||
680 | /** | 685 | /** |
@@ -1881,13 +1886,13 @@ static int dump_glock(struct glock_iter *gi, struct gfs2_glock *gl) | |||
1881 | 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)); |
1882 | print_dbg(gi, " gl_state = %u\n", gl->gl_state); | 1887 | print_dbg(gi, " gl_state = %u\n", gl->gl_state); |
1883 | if (gl->gl_owner_pid) { | 1888 | if (gl->gl_owner_pid) { |
1884 | gl_owner = find_task_by_pid(gl->gl_owner_pid); | 1889 | gl_owner = pid_task(gl->gl_owner_pid, PIDTYPE_PID); |
1885 | if (gl_owner) | 1890 | if (gl_owner) |
1886 | print_dbg(gi, " gl_owner = pid %d (%s)\n", | 1891 | print_dbg(gi, " gl_owner = pid %d (%s)\n", |
1887 | gl->gl_owner_pid, gl_owner->comm); | 1892 | pid_nr(gl->gl_owner_pid), gl_owner->comm); |
1888 | else | 1893 | else |
1889 | print_dbg(gi, " gl_owner = %d (ended)\n", | 1894 | print_dbg(gi, " gl_owner = %d (ended)\n", |
1890 | gl->gl_owner_pid); | 1895 | pid_nr(gl->gl_owner_pid)); |
1891 | } else | 1896 | } else |
1892 | print_dbg(gi, " gl_owner = -1\n"); | 1897 | print_dbg(gi, " gl_owner = -1\n"); |
1893 | print_dbg(gi, " gl_ip = %lu\n", gl->gl_ip); | 1898 | print_dbg(gi, " gl_ip = %lu\n", gl->gl_ip); |