]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
gfs2: make gfs2_holder.gh_owner_pid be a struct pid *
authorPavel Emelyanov <xemul@openvz.org>
Thu, 7 Feb 2008 08:13:19 +0000 (00:13 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 7 Feb 2008 16:42:06 +0000 (08:42 -0800)
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>
fs/gfs2/glock.c
fs/gfs2/glock.h
fs/gfs2/incore.h

index 80e09c50590a52ed1a6e77c47ea59459da4b1bde..82471c82f02474346093fdb64ab86a5b299cd057 100644 (file)
@@ -399,7 +399,7 @@ void gfs2_holder_init(struct gfs2_glock *gl, unsigned int state, unsigned flags,
        INIT_LIST_HEAD(&gh->gh_list);
        gh->gh_gl = gl;
        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_flags = flags;
        gh->gh_error = 0;
@@ -433,6 +433,7 @@ void gfs2_holder_reinit(unsigned int state, unsigned flags, struct gfs2_holder *
 
 void gfs2_holder_uninit(struct gfs2_holder *gh)
 {
+       put_pid(gh->gh_owner_pid);
        gfs2_glock_put(gh->gh_gl);
        gh->gh_gl = NULL;
        gh->gh_ip = 0;
@@ -1045,7 +1046,7 @@ static int glock_wait_internal(struct gfs2_holder *gh)
 }
 
 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;
 
@@ -1082,7 +1083,7 @@ static void add_to_queue(struct gfs2_holder *gh)
        struct gfs2_glock *gl = gh->gh_gl;
        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))
                BUG();
 
@@ -1092,12 +1093,14 @@ static void add_to_queue(struct gfs2_holder *gh)
                if (existing) {
                        print_symbol(KERN_WARNING "original: %s\n", 
                                     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",
                               existing->gh_gl->gl_name.ln_type, 
                               existing->gh_gl->gl_state);
                        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",
                               gl->gl_name.ln_type, gl->gl_state);
                        BUG();
@@ -1798,8 +1801,9 @@ static int dump_holder(struct glock_iter *gi, char *str,
 
        print_dbg(gi, "  %s\n", str);
        if (gh->gh_owner_pid) {
-               print_dbg(gi, "    owner = %ld ", (long)gh->gh_owner_pid);
-               gh_owner = find_task_by_pid(gh->gh_owner_pid);
+               print_dbg(gi, "    owner = %ld ",
+                               (long)pid_nr(gh->gh_owner_pid));
+               gh_owner = pid_task(gh->gh_owner_pid, PIDTYPE_PID);
                if (gh_owner)
                        print_dbg(gi, "(%s)\n", gh_owner->comm);
                else
index b16f604eea9fd6e052ac29b17766f16ad2316adb..2f9c6d136b37a860a790367a35e02c2e59d47130 100644 (file)
@@ -36,11 +36,13 @@ static inline int gfs2_glock_is_locked_by_me(struct gfs2_glock *gl)
 {
        struct gfs2_holder *gh;
        int locked = 0;
+       struct pid *pid;
 
        /* Look in glock's list of holders for one with current task as owner */
        spin_lock(&gl->gl_spin);
+       pid = task_pid(current);
        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;
                        break;
                }
index 513aaf0dc0ab5b6bbba7d10e9567d40cf33515c7..4b724e772602ad0869d7f56a2408b932902a7a42 100644 (file)
@@ -151,7 +151,7 @@ struct gfs2_holder {
        struct list_head gh_list;
 
        struct gfs2_glock *gh_gl;
-       pid_t gh_owner_pid;
+       struct pid *gh_owner_pid;
        unsigned int gh_state;
        unsigned gh_flags;