Commit b1e058da authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Linus Torvalds

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: default avatarPavel Emelyanov <xemul@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 488b5ec8
...@@ -399,7 +399,7 @@ void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, unsigned flags, ...@@ -399,7 +399,7 @@ void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, unsigned flags,
INIT_LIST_HEAD(&gh->gh_list); INIT_LIST_HEAD(&gh->gh_list);
gh->gh_gl = gl; gh->gh_gl = gl;
gh->gh_ip = (unsigned long)__builtin_return_address(0); gh->gh_ip = (unsigned long)__builtin_return_address(0);
gh->gh_owner_pid = current->pid; gh->gh_owner_pid = get_pid(task_pid(current));
gh->gh_state = state; gh->gh_state = state;
gh->gh_flags = flags; gh->gh_flags = flags;
gh->gh_error = 0; gh->gh_error = 0;
...@@ -433,6 +433,7 @@ void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder * ...@@ -433,6 +433,7 @@ void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder *
void gfs2_holder_uninit(struct gfs2_holder *gh) void gfs2_holder_uninit(struct gfs2_holder *gh)
{ {
put_pid(gh->gh_owner_pid);
gfs2_glock_put(gh->gh_gl); gfs2_glock_put(gh->gh_gl);
gh->gh_gl = NULL; gh->gh_gl = NULL;
gh->gh_ip = 0; gh->gh_ip = 0;
...@@ -1045,7 +1046,7 @@ static int glock_wait_internal(struct gfs2_holder *gh) ...@@ -1045,7 +1046,7 @@ static int glock_wait_internal(struct gfs2_holder *gh)
} }
static inline struct gfs2_holder * static inline struct gfs2_holder *
find_holder_by_owner(struct list_head *head, pid_t pid) find_holder_by_owner(struct list_head *head, struct pid *pid)
{ {
struct gfs2_holder *gh; struct gfs2_holder *gh;
...@@ -1082,7 +1083,7 @@ static void add_to_queue(struct gfs2_holder *gh) ...@@ -1082,7 +1083,7 @@ static void add_to_queue(struct gfs2_holder *gh)
struct gfs2_glock *gl = gh->gh_gl; struct gfs2_glock *gl = gh->gh_gl;
struct gfs2_holder *existing; struct gfs2_holder *existing;
BUG_ON(!gh->gh_owner_pid); BUG_ON(gh->gh_owner_pid == NULL);
if (test_and_set_bit(HIF_WAIT, &gh->gh_iflags)) if (test_and_set_bit(HIF_WAIT, &gh->gh_iflags))
BUG(); BUG();
...@@ -1092,12 +1093,14 @@ static void add_to_queue(struct gfs2_holder *gh) ...@@ -1092,12 +1093,14 @@ static void add_to_queue(struct gfs2_holder *gh)
if (existing) { if (existing) {
print_symbol(KERN_WARNING "original: %s\n", print_symbol(KERN_WARNING "original: %s\n",
existing->gh_ip); existing->gh_ip);
printk(KERN_INFO "pid : %d\n", existing->gh_owner_pid); printk(KERN_INFO "pid : %d\n",
pid_nr(existing->gh_owner_pid));
printk(KERN_INFO "lock type : %d lock state : %d\n", printk(KERN_INFO "lock type : %d lock state : %d\n",
existing->gh_gl->gl_name.ln_type, existing->gh_gl->gl_name.ln_type,
existing->gh_gl->gl_state); existing->gh_gl->gl_state);
print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip); print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip);
printk(KERN_INFO "pid : %d\n", gh->gh_owner_pid); printk(KERN_INFO "pid : %d\n",
pid_nr(gh->gh_owner_pid));
printk(KERN_INFO "lock type : %d lock state : %d\n", printk(KERN_INFO "lock type : %d lock state : %d\n",
gl->gl_name.ln_type, gl->gl_state); gl->gl_name.ln_type, gl->gl_state);
BUG(); BUG();
...@@ -1798,8 +1801,9 @@ static int dump_holder(struct glock_iter *gi, char *str, ...@@ -1798,8 +1801,9 @@ static int dump_holder(struct glock_iter *gi, char *str,
print_dbg(gi, " %s\n", str); print_dbg(gi, " %s\n", str);
if (gh->gh_owner_pid) { if (gh->gh_owner_pid) {
print_dbg(gi, " owner = %ld ", (long)gh->gh_owner_pid); print_dbg(gi, " owner = %ld ",
gh_owner = find_task_by_pid(gh->gh_owner_pid); (long)pid_nr(gh->gh_owner_pid));
gh_owner = pid_task(gh->gh_owner_pid, PIDTYPE_PID);
if (gh_owner) if (gh_owner)
print_dbg(gi, "(%s)\n", gh_owner->comm); print_dbg(gi, "(%s)\n", gh_owner->comm);
else else
......
...@@ -36,11 +36,13 @@ static inline int gfs2_glock_is_locked_by_me(struct gfs2_glock *gl) ...@@ -36,11 +36,13 @@ static inline int gfs2_glock_is_locked_by_me(struct gfs2_glock *gl)
{ {
struct gfs2_holder *gh; struct gfs2_holder *gh;
int locked = 0; int locked = 0;
struct pid *pid;
/* Look in glock's list of holders for one with current task as owner */ /* Look in glock's list of holders for one with current task as owner */
spin_lock(&gl->gl_spin); spin_lock(&gl->gl_spin);
pid = task_pid(current);
list_for_each_entry(gh, &gl->gl_holders, gh_list) { list_for_each_entry(gh, &gl->gl_holders, gh_list) {
if (gh->gh_owner_pid == current->pid) { if (gh->gh_owner_pid == pid) {
locked = 1; locked = 1;
break; break;
} }
......
...@@ -151,7 +151,7 @@ struct gfs2_holder { ...@@ -151,7 +151,7 @@ struct gfs2_holder {
struct list_head gh_list; struct list_head gh_list;
struct gfs2_glock *gh_gl; struct gfs2_glock *gh_gl;
pid_t gh_owner_pid; struct pid *gh_owner_pid;
unsigned int gh_state; unsigned int gh_state;
unsigned gh_flags; unsigned gh_flags;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment