Use helpers to obtain task pid in printks
authorPavel Emelyanov <xemul@openvz.org>
Fri, 19 Oct 2007 06:40:40 +0000 (23:40 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 19 Oct 2007 18:53:43 +0000 (11:53 -0700)
The task_struct->pid member is going to be deprecated, so start
using the helpers (task_pid_nr/task_pid_vnr/task_pid_nr_ns) in
the kernel.

The first thing to start with is the pid, printed to dmesg - in
this case we may safely use task_pid_nr(). Besides, printks produce
more (much more) than a half of all the explicit pid usage.

[akpm@linux-foundation.org: git-drm went and changed lots of stuff]
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: Dave Airlie <airlied@linux.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
47 files changed:
block/ll_rw_blk.c
drivers/block/nbd.c
drivers/cdrom/cdrom.c
drivers/char/drm/drm_bufs.c
drivers/char/drm/drm_drv.c
drivers/char/drm/drm_fops.c
drivers/char/drm/drm_lock.c
drivers/char/drm/drm_os_linux.h
drivers/char/drm/i810_dma.c
drivers/char/drm/i830_dma.c
drivers/char/sx.c
drivers/char/tty_io.c
drivers/hid/hidraw.c
drivers/md/md.c
drivers/media/video/zoran_driver.c
drivers/mtd/ubi/wl.c
drivers/net/wireless/hostap/hostap_ioctl.c
drivers/scsi/libsas/sas_discover.c
drivers/usb/core/devio.c
drivers/usb/gadget/file_storage.c
fs/cifs/connect.c
fs/dlm/user.c
fs/fs-writeback.c
fs/jffs2/debug.h
fs/nfsd/vfs.c
fs/ocfs2/cluster/heartbeat.c
fs/ocfs2/cluster/masklog.h
fs/ocfs2/dlm/dlmrecovery.c
include/linux/reiserfs_fs.h
include/net/9p/9p.h
kernel/cpu.c
kernel/exit.c
kernel/lockdep.c
kernel/rtmutex-debug.c
kernel/rtmutex.c
kernel/sched.c
kernel/signal.c
kernel/softlockup.c
kernel/workqueue.c
lib/spinlock_debug.c
mm/oom_kill.c
net/core/pktgen.c
net/core/sock.c
net/ipv4/ipvs/ip_vs_sync.c
net/ipv4/tcp.c
net/llc/af_llc.c
net/sunrpc/sched.c

index 501edfa807a0f8b14886895633f04887dad7ad6b..8025d646ab3085ff5627fc0f082465eba8329ce7 100644 (file)
@@ -3367,7 +3367,7 @@ void submit_bio(int rw, struct bio *bio)
                if (unlikely(block_dump)) {
                        char b[BDEVNAME_SIZE];
                        printk(KERN_DEBUG "%s(%d): %s block %Lu on %s\n",
-                               current->comm, current->pid,
+                       current->comm, task_pid_nr(current),
                                (rw & WRITE) ? "WRITE" : "READ",
                                (unsigned long long)bio->bi_sector,
                                bdevname(bio->bi_bdev,b));
index cb136a919f2a83f1f97e6936949cebe6e4fd9f72..ac4a0cb217ab33b75a6a41814df03d08f39ccca2 100644 (file)
@@ -188,7 +188,7 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size,
                if (signal_pending(current)) {
                        siginfo_t info;
                        printk(KERN_WARNING "nbd (pid %d: %s) got signal %d\n",
-                               current->pid, current->comm,
+                               task_pid_nr(current), current->comm,
                                dequeue_signal_lock(current, &current->blocked, &info));
                        result = -EINTR;
                        sock_shutdown(lo, !send);
index d70745c84250cb4b3f15d51adae267019a2d32c9..af0561053167cd177d89c499c3d9f2b108843d46 100644 (file)
@@ -1107,7 +1107,7 @@ int open_for_data(struct cdrom_device_info * cdi)
                       is the default case! */
                    cdinfo(CD_OPEN, "bummer. wrong media type.\n"); 
                    cdinfo(CD_WARNING, "pid %d must open device O_NONBLOCK!\n",
-                                       (unsigned int)current->pid); 
+                                       (unsigned int)task_pid_nr(current));
                    ret=-EMEDIUMTYPE;
                    goto clean_up_and_return;
                }
index 856774fbe025f17e6f7ed4b3014d2d37e8b08c22..d24a6c2c2c24e10f33d7498fccd30e16a8574ec0 100644 (file)
@@ -1456,7 +1456,7 @@ int drm_freebufs(struct drm_device *dev, void *data,
                buf = dma->buflist[idx];
                if (buf->file_priv != file_priv) {
                        DRM_ERROR("Process %d freeing buffer not owned\n",
-                                 current->pid);
+                                 task_pid_nr(current));
                        return -EINVAL;
                }
                drm_free_buffer(dev, buf);
index 72668b15e5ce2a5a8db7aedce9b73691762a8f05..44a46268b02b138c310c345b6ed6ecbdad7599f3 100644 (file)
@@ -463,7 +463,7 @@ int drm_ioctl(struct inode *inode, struct file *filp,
        ++file_priv->ioctl_count;
 
        DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
-                 current->pid, cmd, nr,
+                 task_pid_nr(current), cmd, nr,
                  (long)old_encode_dev(file_priv->head->device),
                  file_priv->authenticated);
 
index f383fc37190c1a1d2a3a18396adda4d130a6b3f4..3992f73299cc8e161ffd67db642040051a9c8243 100644 (file)
@@ -234,7 +234,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
        if (!drm_cpu_valid())
                return -EINVAL;
 
-       DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor);
+       DRM_DEBUG("pid = %d, minor = %d\n", task_pid_nr(current), minor);
 
        priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES);
        if (!priv)
@@ -244,7 +244,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
        filp->private_data = priv;
        priv->filp = filp;
        priv->uid = current->euid;
-       priv->pid = current->pid;
+       priv->pid = task_pid_nr(current);
        priv->minor = minor;
        priv->head = drm_heads[minor];
        priv->ioctl_count = 0;
@@ -339,7 +339,8 @@ int drm_release(struct inode *inode, struct file *filp)
         */
 
        DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
-                 current->pid, (long)old_encode_dev(file_priv->head->device),
+                 task_pid_nr(current),
+                 (long)old_encode_dev(file_priv->head->device),
                  dev->open_count);
 
        if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) {
index c6b73e744d67baba2fcd96094e3e3748f8738df2..bea2a7d5b2b22f695d3c6131d2068450ed55f074 100644 (file)
@@ -58,12 +58,12 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
 
        if (lock->context == DRM_KERNEL_CONTEXT) {
                DRM_ERROR("Process %d using kernel context %d\n",
-                         current->pid, lock->context);
+                         task_pid_nr(current), lock->context);
                return -EINVAL;
        }
 
        DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
-                 lock->context, current->pid,
+                 lock->context, task_pid_nr(current),
                  dev->lock.hw_lock->lock, lock->flags);
 
        if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE))
@@ -153,7 +153,7 @@ int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
 
        if (lock->context == DRM_KERNEL_CONTEXT) {
                DRM_ERROR("Process %d using kernel context %d\n",
-                         current->pid, lock->context);
+                         task_pid_nr(current), lock->context);
                return -EINVAL;
        }
 
index 114e54e0f61bc8d5f0cc1c7d85d2c72cfa1f9750..76e44ac94fb52f4315a6c3498359d1e7d523ec69 100644 (file)
@@ -7,7 +7,7 @@
 #include <linux/delay.h>
 
 /** Current process ID */
-#define DRM_CURRENTPID                 current->pid
+#define DRM_CURRENTPID                 task_pid_nr(current)
 #define DRM_SUSER(p)                   capable(CAP_SYS_ADMIN)
 #define DRM_UDELAY(d)                  udelay(d)
 /** Read a byte from a MMIO region */
index 8e841bdee6dc219c067032c7add3b74152f5fa63..eb381a7c5beed40920fa577061ebec084331da86 100644 (file)
@@ -1024,7 +1024,7 @@ static int i810_getbuf(struct drm_device *dev, void *data,
        retcode = i810_dma_get_buffer(dev, d, file_priv);
 
        DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n",
-                 current->pid, retcode, d->granted);
+                 task_pid_nr(current), retcode, d->granted);
 
        sarea_priv->last_dispatch = (int)hw_status[5];
 
index 43a1f78712d6cc784f24048d10b9ca71cbc060a9..69a363edb0d202b157d262ea0150aa185384eb1a 100644 (file)
@@ -1409,7 +1409,7 @@ static int i830_getbuf(struct drm_device *dev, void *data,
        retcode = i830_dma_get_buffer(dev, d, file_priv);
 
        DRM_DEBUG("i830_dma: %d returning %d, granted = %d\n",
-                 current->pid, retcode, d->granted);
+                 task_pid_nr(current), retcode, d->granted);
 
        sarea_priv->last_dispatch = (int)hw_status[5];
 
index 85a23283dff55144b594ae86b6a87100814fdf66..a6e1c9ba12174d769e1389d5329b70676e5e3b16 100644 (file)
@@ -1467,7 +1467,7 @@ static int sx_open(struct tty_struct *tty, struct file *filp)
 
        line = tty->index;
        sx_dprintk(SX_DEBUG_OPEN, "%d: opening line %d. tty=%p ctty=%p, "
-                       "np=%d)\n", current->pid, line, tty,
+                       "np=%d)\n", task_pid_nr(current), line, tty,
                        current->signal->tty, sx_nports);
 
        if ((line < 0) || (line >= SX_NPORTS) || (line >= sx_nports))
index e4054494713556e9f4d47a69bec96bbde7fdc486..13a53575a0164bf82ea5716c7c1d5fbc30b8cbbf 100644 (file)
@@ -3530,7 +3530,7 @@ void __do_SAK(struct tty_struct *tty)
        do_each_pid_task(session, PIDTYPE_SID, p) {
                printk(KERN_NOTICE "SAK: killed process %d"
                        " (%s): task_session_nr(p)==tty->session\n",
-                       p->pid, p->comm);
+                       task_pid_nr(p), p->comm);
                send_sig(SIGKILL, p, 1);
        } while_each_pid_task(session, PIDTYPE_SID, p);
        /* Now kill any processes that happen to have the
@@ -3540,7 +3540,7 @@ void __do_SAK(struct tty_struct *tty)
                if (p->signal->tty == tty) {
                        printk(KERN_NOTICE "SAK: killed process %d"
                            " (%s): task_session_nr(p)==tty->session\n",
-                           p->pid, p->comm);
+                           task_pid_nr(p), p->comm);
                        send_sig(SIGKILL, p, 1);
                        continue;
                }
@@ -3560,7 +3560,7 @@ void __do_SAK(struct tty_struct *tty)
                                    filp->private_data == tty) {
                                        printk(KERN_NOTICE "SAK: killed process %d"
                                            " (%s): fd#%d opened to the tty\n",
-                                           p->pid, p->comm, i);
+                                           task_pid_nr(p), p->comm, i);
                                        force_sig(SIGKILL, p);
                                        break;
                                }
index a702e2f6da7d953892a468574e8348e23397e735..1ca6f4635eeb3e0474abada594892ac5683ce7ba 100644 (file)
@@ -113,13 +113,13 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t
 
        if (count > HID_MIN_BUFFER_SIZE) {
                printk(KERN_WARNING "hidraw: pid %d passed too large report\n",
-                               current->pid);
+                               task_pid_nr(current));
                return -EINVAL;
        }
 
        if (count < 2) {
                printk(KERN_WARNING "hidraw: pid %d passed too short report\n",
-                               current->pid);
+                               task_pid_nr(current));
                return -EINVAL;
        }
 
index c059ae6f37e5ae1fe789e3fad66ad0a91da3a264..808cd95494563d260456733e0d1e9ba80cbee21e 100644 (file)
@@ -4717,7 +4717,7 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev,
 
 void md_unregister_thread(mdk_thread_t *thread)
 {
-       dprintk("interrupting MD-thread pid %d\n", thread->tsk->pid);
+       dprintk("interrupting MD-thread pid %d\n", task_pid_nr(thread->tsk));
 
        kthread_stop(thread->tsk);
        kfree(thread);
index 1c14fa2bd4115623de441807e76688133f6664f3..419e5af785332925a997ec3224c867e92dffb7d4 100644 (file)
@@ -1285,7 +1285,7 @@ zoran_open (struct inode *inode,
        }
 
        dprintk(1, KERN_INFO "%s: zoran_open(%s, pid=[%d]), users(-)=%d\n",
-               ZR_DEVNAME(zr), current->comm, current->pid, zr->user);
+               ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user);
 
        /* now, create the open()-specific file_ops struct */
        fh = kzalloc(sizeof(struct zoran_fh), GFP_KERNEL);
@@ -1358,7 +1358,7 @@ zoran_close (struct inode *inode,
        struct zoran *zr = fh->zr;
 
        dprintk(1, KERN_INFO "%s: zoran_close(%s, pid=[%d]), users(+)=%d\n",
-               ZR_DEVNAME(zr), current->comm, current->pid, zr->user);
+               ZR_DEVNAME(zr), current->comm, task_pid_nr(current), zr->user);
 
        /* kernel locks (fs/device.c), so don't do that ourselves
         * (prevents deadlocks) */
index a4f1bf33164a1426eb92ea59df1093d856986633..6330c8cc72b5521fa8574d7f4d3f492b7e9cb231 100644 (file)
@@ -1309,7 +1309,7 @@ static int ubi_thread(void *u)
        struct ubi_device *ubi = u;
 
        ubi_msg("background thread \"%s\" started, PID %d",
-               ubi->bgt_name, current->pid);
+               ubi->bgt_name, task_pid_nr(current));
 
        set_freezable();
        for (;;) {
index 40f516d42c5e39894f4c14f45582852ce116fb7b..d8f5efcfcab96915d0f41ecfb22958ba556a3936 100644 (file)
@@ -2920,7 +2920,7 @@ static int prism2_ioctl_priv_monitor(struct net_device *dev, int *i)
 
        printk(KERN_DEBUG "%s: process %d (%s) used deprecated iwpriv monitor "
               "- update software to use iwconfig mode monitor\n",
-              dev->name, current->pid, current->comm);
+              dev->name, task_pid_nr(current), current->comm);
 
        /* Backward compatibility code - this can be removed at some point */
 
index 7ef0afc3cd68b7f848a7b635af3c30fb8a6690ad..5f3a0d7b18de9db796d4ada15df39d8ef29c1b61 100644 (file)
@@ -285,7 +285,7 @@ static void sas_discover_domain(struct work_struct *work)
        dev = port->port_dev;
 
        SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id,
-                   current->pid);
+                   task_pid_nr(current));
 
        switch (dev->dev_type) {
        case SAS_END_DEV:
@@ -320,7 +320,7 @@ static void sas_discover_domain(struct work_struct *work)
        }
 
        SAS_DPRINTK("DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->id,
-                   current->pid, error);
+                   task_pid_nr(current), error);
 }
 
 static void sas_revalidate_domain(struct work_struct *work)
@@ -334,12 +334,12 @@ static void sas_revalidate_domain(struct work_struct *work)
                        &port->disc.pending);
 
        SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id,
-                   current->pid);
+                   task_pid_nr(current));
        if (port->port_dev)
                res = sas_ex_revalidate_domain(port->port_dev);
 
        SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n",
-                   port->id, current->pid, res);
+                   port->id, task_pid_nr(current), res);
 }
 
 /* ---------- Events ---------- */
index f013b4012c9a18a4199f0764d0a8218233fdb577..1f4f6d02fe25598e22a62b785b1b7140913b7c12 100644 (file)
@@ -460,7 +460,7 @@ static int checkintf(struct dev_state *ps, unsigned int ifnum)
                return 0;
        /* if not yet claimed, claim it for the driver */
        dev_warn(&ps->dev->dev, "usbfs: process %d (%s) did not claim interface %u before use\n",
-              current->pid, current->comm, ifnum);
+              task_pid_nr(current), current->comm, ifnum);
        return claimintf(ps, ifnum);
 }
 
index 73726c570a6eeb01cc41d91cb5230a256e57729e..1d174dcb3ac9e6a4ea5ce8133d6e4519d32d9783 100644 (file)
@@ -4006,7 +4006,7 @@ static int __init fsg_bind(struct usb_gadget *gadget)
        DBG(fsg, "removable=%d, stall=%d, buflen=%u\n",
                        mod_data.removable, mod_data.can_stall,
                        mod_data.buflen);
-       DBG(fsg, "I/O thread pid: %d\n", fsg->thread_task->pid);
+       DBG(fsg, "I/O thread pid: %d\n", task_pid_nr(fsg->thread_task));
 
        set_bit(REGISTERED, &fsg->atomic_bitflags);
 
index 4af3588c1a9615b39976bac9fadc3487a64025eb..370866cb3d482c5d061a065a026a0eb0197173c2 100644 (file)
@@ -352,7 +352,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
 
        current->flags |= PF_MEMALLOC;
        server->tsk = current;  /* save process info to wake at shutdown */
-       cFYI(1, ("Demultiplex PID: %d", current->pid));
+       cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current)));
        write_lock(&GlobalSMBSeslock);
        atomic_inc(&tcpSesAllocCount);
        length = tcpSesAllocCount.counter;
index 6438941ab1f8baf21e4ca88ce5d05b120b525f8b..4f741546f4bbce873079bee9060eac437934d8b6 100644 (file)
@@ -456,7 +456,7 @@ static int check_version(struct dlm_write_request *req)
                printk(KERN_DEBUG "dlm: process %s (%d) version mismatch "
                       "user (%d.%d.%d) kernel (%d.%d.%d)\n",
                       current->comm,
-                      current->pid,
+                      task_pid_nr(current),
                       req->version[0],
                       req->version[1],
                       req->version[2],
index 686734ff973d947f6f393d2e5fe14427040e978c..0fca82021d7652df2d2fc8e1b1f33204e8712651 100644 (file)
@@ -89,7 +89,7 @@ void __mark_inode_dirty(struct inode *inode, int flags)
                if (inode->i_ino || strcmp(inode->i_sb->s_id, "bdev"))
                        printk(KERN_DEBUG
                               "%s(%d): dirtied inode %lu (%s) on %s\n",
-                              current->comm, current->pid, inode->i_ino,
+                              current->comm, task_pid_nr(current), inode->i_ino,
                               name, inode->i_sb->s_id);
        }
 
index 2a49f2c51a9f8a11e42d7664a7dffc7ceb60060b..4130adabd76e6d9a9d496d1e6d176a43cb905783 100644 (file)
 #define JFFS2_ERROR(fmt, ...)                                          \
        do {                                                            \
                printk(JFFS2_ERR_MSG_PREFIX                             \
-                       " (%d) %s: " fmt, current->pid,                 \
+                       " (%d) %s: " fmt, task_pid_nr(current),         \
                        __FUNCTION__ , ##__VA_ARGS__);                  \
        } while(0)
 
 #define JFFS2_WARNING(fmt, ...)                                                \
        do {                                                            \
                printk(JFFS2_WARN_MSG_PREFIX                            \
-                       " (%d) %s: " fmt, current->pid,                 \
+                       " (%d) %s: " fmt, task_pid_nr(current),         \
                        __FUNCTION__ , ##__VA_ARGS__);                  \
        } while(0)
 
 #define JFFS2_NOTICE(fmt, ...)                                         \
        do {                                                            \
                printk(JFFS2_NOTICE_MSG_PREFIX                          \
-                       " (%d) %s: " fmt, current->pid,                 \
+                       " (%d) %s: " fmt, task_pid_nr(current),         \
                        __FUNCTION__ , ##__VA_ARGS__);                  \
        } while(0)
 
 #define JFFS2_DEBUG(fmt, ...)                                          \
        do {                                                            \
                printk(JFFS2_DBG_MSG_PREFIX                             \
-                       " (%d) %s: " fmt, current->pid,                 \
+                       " (%d) %s: " fmt, task_pid_nr(current),         \
                        __FUNCTION__ , ##__VA_ARGS__);                  \
        } while(0)
 
index 46934c97f8f7fe30c915aa24e0cee144c390657b..d0199189924cee7d5ea49aafd52dcc81fab21df2 100644 (file)
@@ -1029,13 +1029,13 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
                if (EX_WGATHER(exp)) {
                        if (atomic_read(&inode->i_writecount) > 1
                            || (last_ino == inode->i_ino && last_dev == inode->i_sb->s_dev)) {
-                               dprintk("nfsd: write defer %d\n", current->pid);
+                               dprintk("nfsd: write defer %d\n", task_pid_nr(current));
                                msleep(10);
-                               dprintk("nfsd: write resume %d\n", current->pid);
+                               dprintk("nfsd: write resume %d\n", task_pid_nr(current));
                        }
 
                        if (inode->i_state & I_DIRTY) {
-                               dprintk("nfsd: write sync %d\n", current->pid);
+                               dprintk("nfsd: write sync %d\n", task_pid_nr(current));
                                host_err=nfsd_sync(file);
                        }
 #if 0
index f14b541fab951d01aae5155a4cbd224c6c807b2e..9cc7c0418b70eb53b04d1904a197feb82b196b24 100644 (file)
@@ -1372,7 +1372,7 @@ static ssize_t o2hb_region_pid_read(struct o2hb_region *reg,
 
        spin_lock(&o2hb_live_lock);
        if (reg->hr_task)
-               pid = reg->hr_task->pid;
+               pid = task_pid_nr(reg->hr_task);
        spin_unlock(&o2hb_live_lock);
 
        if (!pid)
index 75cd877f6d42e17d3687674158a37764826e0633..cd046060114ef4790a0039919bb68e3ff3ab86fd 100644 (file)
@@ -192,7 +192,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
  * previous token if args expands to nothing.
  */
 #define __mlog_printk(level, fmt, args...)                             \
-       printk(level "(%u,%lu):%s:%d " fmt, current->pid,               \
+       printk(level "(%u,%lu):%s:%d " fmt, task_pid_nr(current),       \
               __mlog_cpu_guess, __PRETTY_FUNCTION__, __LINE__ ,        \
               ##args)
 
index a2c33160bfd6838dd17487b49492f6a85e5b3539..2fde7bf91434b0e95faddaf188d193877d803b39 100644 (file)
@@ -259,7 +259,7 @@ static void dlm_print_reco_node_status(struct dlm_ctxt *dlm)
        struct dlm_lock_resource *res;
 
        mlog(ML_NOTICE, "%s(%d): recovery info, state=%s, dead=%u, master=%u\n",
-            dlm->name, dlm->dlm_reco_thread_task->pid,
+            dlm->name, task_pid_nr(dlm->dlm_reco_thread_task),
             dlm->reco.state & DLM_RECO_STATE_ACTIVE ? "ACTIVE" : "inactive",
             dlm->reco.dead_node, dlm->reco.new_master);
 
@@ -420,7 +420,7 @@ void dlm_wait_for_recovery(struct dlm_ctxt *dlm)
        if (dlm_in_recovery(dlm)) {
                mlog(0, "%s: reco thread %d in recovery: "
                     "state=%d, master=%u, dead=%u\n",
-                    dlm->name, dlm->dlm_reco_thread_task->pid,
+                    dlm->name, task_pid_nr(dlm->dlm_reco_thread_task),
                     dlm->reco.state, dlm->reco.new_master,
                     dlm->reco.dead_node);
        }
@@ -483,7 +483,7 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm)
                return 0;
        }
        mlog(0, "%s(%d):recovery thread found node %u in the recovery map!\n",
-            dlm->name, dlm->dlm_reco_thread_task->pid,
+            dlm->name, task_pid_nr(dlm->dlm_reco_thread_task),
             dlm->reco.dead_node);
        spin_unlock(&dlm->spinlock);
 
@@ -507,7 +507,7 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm)
                mlog(0, "another node will master this recovery session.\n");
        }
        mlog(0, "dlm=%s (%d), new_master=%u, this node=%u, dead_node=%u\n",
-            dlm->name, dlm->dlm_reco_thread_task->pid, dlm->reco.new_master,
+            dlm->name, task_pid_nr(dlm->dlm_reco_thread_task), dlm->reco.new_master,
             dlm->node_num, dlm->reco.dead_node);
 
        /* it is safe to start everything back up here
@@ -520,7 +520,7 @@ static int dlm_do_recovery(struct dlm_ctxt *dlm)
 
 master_here:
        mlog(0, "(%d) mastering recovery of %s:%u here(this=%u)!\n",
-            dlm->dlm_reco_thread_task->pid,
+            task_pid_nr(dlm->dlm_reco_thread_task),
             dlm->name, dlm->reco.dead_node, dlm->node_num);
 
        status = dlm_remaster_locks(dlm, dlm->reco.dead_node);
index d8653bf232e3c807f3466bf4049d6e35e1ab44ec..72bfccd3da22bc91e831d77b0b00179fef338d61 100644 (file)
@@ -85,7 +85,7 @@ void reiserfs_warning(struct super_block *s, const char *fmt, ...);
 if( !( cond ) )                                                                \
   reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \
                  __FILE__ ":%i:%s: " format "\n",              \
-                 in_interrupt() ? -1 : current -> pid, __LINE__ , __FUNCTION__ , ##args )
+                 in_interrupt() ? -1 : task_pid_nr(current), __LINE__ , __FUNCTION__ , ##args )
 
 #define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args)
 
index 686425a97b0f63b1be45a6b59aa2a3c5c044068c..625346c47ee2e276dd6eb413a96672bbb75014fb 100644 (file)
@@ -44,7 +44,7 @@ extern unsigned int p9_debug_level;
 do {  \
        if ((p9_debug_level & level) == level) \
                printk(KERN_NOTICE "-- %s (%d): " \
-               format , __FUNCTION__, current->pid , ## arg); \
+               format , __FUNCTION__, task_pid_nr(current) , ## arg); \
 } while (0)
 
 #define PRINT_FCALL_ERROR(s, fcall) P9_DPRINTK(P9_DEBUG_ERROR,   \
@@ -59,7 +59,7 @@ do {  \
 #define P9_EPRINTK(level, format, arg...) \
 do { \
        printk(level "9p: %s (%d): " \
-               format , __FUNCTION__, current->pid , ## arg); \
+               format , __FUNCTION__, task_pid_nr(current), ## arg); \
 } while (0)
 
 
index a21f71af9d81fba3c0012afd8538d25a1f7c0c62..ebf6647a2bd4a51bccd9a634f6812208e38dd590 100644 (file)
@@ -98,7 +98,8 @@ static inline void check_for_tasks(int cpu)
                     !cputime_eq(p->stime, cputime_zero)))
                        printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d\
                                (state = %ld, flags = %x) \n",
-                                p->comm, p->pid, cpu, p->state, p->flags);
+                                p->comm, task_pid_nr(p), cpu,
+                                p->state, p->flags);
        }
        write_unlock_irq(&tasklist_lock);
 }
index 6838d4d77e05685e79325d78edf3de724f6a667c..7dab2defec6323f63a8042ff68176b62b72031ed 100644 (file)
@@ -959,7 +959,7 @@ fastcall NORET_TYPE void do_exit(long code)
 
        if (unlikely(in_atomic()))
                printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n",
-                               current->comm, current->pid,
+                               current->comm, task_pid_nr(current),
                                preempt_count());
 
        acct_update_integrals(tsk);
index b5392ff7e6a660f2698811e58d70defd8eb5b6c0..55fe0c7cd95fc6776dda4f93d85fa1541200ebb1 100644 (file)
@@ -511,11 +511,11 @@ static void lockdep_print_held_locks(struct task_struct *curr)
        int i, depth = curr->lockdep_depth;
 
        if (!depth) {
-               printk("no locks held by %s/%d.\n", curr->comm, curr->pid);
+               printk("no locks held by %s/%d.\n", curr->comm, task_pid_nr(curr));
                return;
        }
        printk("%d lock%s held by %s/%d:\n",
-               depth, depth > 1 ? "s" : "", curr->comm, curr->pid);
+               depth, depth > 1 ? "s" : "", curr->comm, task_pid_nr(curr));
 
        for (i = 0; i < depth; i++) {
                printk(" #%d: ", i);
@@ -904,7 +904,7 @@ print_circular_bug_header(struct lock_list *entry, unsigned int depth)
        print_kernel_version();
        printk(  "-------------------------------------------------------\n");
        printk("%s/%d is trying to acquire lock:\n",
-               curr->comm, curr->pid);
+               curr->comm, task_pid_nr(curr));
        print_lock(check_source);
        printk("\nbut task is already holding lock:\n");
        print_lock(check_target);
@@ -1085,7 +1085,7 @@ print_bad_irq_dependency(struct task_struct *curr,
        print_kernel_version();
        printk(  "------------------------------------------------------\n");
        printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n",
-               curr->comm, curr->pid,
+               curr->comm, task_pid_nr(curr),
                curr->hardirq_context, hardirq_count() >> HARDIRQ_SHIFT,
                curr->softirq_context, softirq_count() >> SOFTIRQ_SHIFT,
                curr->hardirqs_enabled,
@@ -1237,7 +1237,7 @@ print_deadlock_bug(struct task_struct *curr, struct held_lock *prev,
        print_kernel_version();
        printk(  "---------------------------------------------\n");
        printk("%s/%d is trying to acquire lock:\n",
-               curr->comm, curr->pid);
+               curr->comm, task_pid_nr(curr));
        print_lock(next);
        printk("\nbut task is already holding lock:\n");
        print_lock(prev);
@@ -1641,7 +1641,7 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this,
                usage_str[prev_bit], usage_str[new_bit]);
 
        printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] takes:\n",
-               curr->comm, curr->pid,
+               curr->comm, task_pid_nr(curr),
                trace_hardirq_context(curr), hardirq_count() >> HARDIRQ_SHIFT,
                trace_softirq_context(curr), softirq_count() >> SOFTIRQ_SHIFT,
                trace_hardirqs_enabled(curr),
@@ -1694,7 +1694,7 @@ print_irq_inversion_bug(struct task_struct *curr, struct lock_class *other,
        print_kernel_version();
        printk(  "---------------------------------------------------------\n");
        printk("%s/%d just changed the state of lock:\n",
-               curr->comm, curr->pid);
+               curr->comm, task_pid_nr(curr));
        print_lock(this);
        if (forwards)
                printk("but this lock took another, %s-irq-unsafe lock in the past:\n", irqclass);
@@ -2487,7 +2487,7 @@ print_unlock_inbalance_bug(struct task_struct *curr, struct lockdep_map *lock,
        printk(  "[ BUG: bad unlock balance detected! ]\n");
        printk(  "-------------------------------------\n");
        printk("%s/%d is trying to release lock (",
-               curr->comm, curr->pid);
+               curr->comm, task_pid_nr(curr));
        print_lockdep_cache(lock);
        printk(") at:\n");
        print_ip_sym(ip);
@@ -2737,7 +2737,7 @@ print_lock_contention_bug(struct task_struct *curr, struct lockdep_map *lock,
        printk(  "[ BUG: bad contention detected! ]\n");
        printk(  "---------------------------------\n");
        printk("%s/%d is trying to contend lock (",
-               curr->comm, curr->pid);
+               curr->comm, task_pid_nr(curr));
        print_lockdep_cache(lock);
        printk(") at:\n");
        print_ip_sym(ip);
@@ -3072,7 +3072,7 @@ print_freed_lock_bug(struct task_struct *curr, const void *mem_from,
        printk(  "[ BUG: held lock freed! ]\n");
        printk(  "-------------------------\n");
        printk("%s/%d is freeing memory %p-%p, with a lock still held there!\n",
-               curr->comm, curr->pid, mem_from, mem_to-1);
+               curr->comm, task_pid_nr(curr), mem_from, mem_to-1);
        print_lock(hlock);
        lockdep_print_held_locks(curr);
 
@@ -3125,7 +3125,7 @@ static void print_held_locks_bug(struct task_struct *curr)
        printk(  "[ BUG: lock held at task exit time! ]\n");
        printk(  "-------------------------------------\n");
        printk("%s/%d is exiting with locks still held!\n",
-               curr->comm, curr->pid);
+               curr->comm, task_pid_nr(curr));
        lockdep_print_held_locks(curr);
 
        printk("\nstack backtrace:\n");
index 6b0703db152d2a61411595380ce4b608e98f6890..56d73cb8826d86ff75ce0dea818ce658be11cf49 100644 (file)
@@ -87,7 +87,7 @@ static int rt_trace_on = 1;
 static void printk_task(struct task_struct *p)
 {
        if (p)
-               printk("%16s:%5d [%p, %3d]", p->comm, p->pid, p, p->prio);
+               printk("%16s:%5d [%p, %3d]", p->comm, task_pid_nr(p), p, p->prio);
        else
                printk("<none>");
 }
@@ -152,22 +152,25 @@ void debug_rt_mutex_print_deadlock(struct rt_mutex_waiter *waiter)
        printk(  "[ BUG: circular locking deadlock detected! ]\n");
        printk(  "--------------------------------------------\n");
        printk("%s/%d is deadlocking current task %s/%d\n\n",
-              task->comm, task->pid, current->comm, current->pid);
+              task->comm, task_pid_nr(task),
+              current->comm, task_pid_nr(current));
 
        printk("\n1) %s/%d is trying to acquire this lock:\n",
-              current->comm, current->pid);
+              current->comm, task_pid_nr(current));
        printk_lock(waiter->lock, 1);
 
-       printk("\n2) %s/%d is blocked on this lock:\n", task->comm, task->pid);
+       printk("\n2) %s/%d is blocked on this lock:\n",
+               task->comm, task_pid_nr(task));
        printk_lock(waiter->deadlock_lock, 1);
 
        debug_show_held_locks(current);
        debug_show_held_locks(task);
 
-       printk("\n%s/%d's [blocked] stackdump:\n\n", task->comm, task->pid);
+       printk("\n%s/%d's [blocked] stackdump:\n\n",
+               task->comm, task_pid_nr(task));
        show_stack(task, NULL);
        printk("\n%s/%d's [current] stackdump:\n\n",
-              current->comm, current->pid);
+               current->comm, task_pid_nr(current));
        dump_stack();
        debug_show_all_locks();
 
index 8cd9bd2cdb34243a89c45102708abdcc2c7cbdbd..0deef71ff8d2a7444f74af1904b11b93e2a86766 100644 (file)
@@ -185,7 +185,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
                        prev_max = max_lock_depth;
                        printk(KERN_WARNING "Maximum lock depth %d reached "
                               "task: %s (%d)\n", max_lock_depth,
-                              top_task->comm, top_task->pid);
+                              top_task->comm, task_pid_nr(top_task));
                }
                put_task_struct(task);
 
index 9d458504e3a6dbefa38c12e2e1a9daacac2ce48e..a7e30462600ffb2a4a8b9be900e907c95ba13bed 100644 (file)
@@ -3502,7 +3502,7 @@ EXPORT_SYMBOL(sub_preempt_count);
 static noinline void __schedule_bug(struct task_struct *prev)
 {
        printk(KERN_ERR "BUG: scheduling while atomic: %s/0x%08x/%d\n",
-               prev->comm, preempt_count(), prev->pid);
+               prev->comm, preempt_count(), task_pid_nr(prev));
        debug_show_held_locks(prev);
        if (irqs_disabled())
                print_irqtrace_events(prev);
@@ -4865,7 +4865,8 @@ static void show_task(struct task_struct *p)
                free = (unsigned long)n - (unsigned long)end_of_stack(p);
        }
 #endif
-       printk(KERN_CONT "%5lu %5d %6d\n", free, p->pid, p->parent->pid);
+       printk(KERN_CONT "%5lu %5d %6d\n", free,
+               task_pid_nr(p), task_pid_nr(p->parent));
 
        if (state != TASK_RUNNING)
                show_stack(p, NULL);
@@ -5172,7 +5173,7 @@ static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)
                        if (p->mm && printk_ratelimit())
                                printk(KERN_INFO "process %d (%s) no "
                                       "longer affine to cpu%d\n",
-                                      p->pid, p->comm, dead_cpu);
+                              task_pid_nr(p), p->comm, dead_cpu);
                }
        } while (!__migrate_task_irq(p, dead_cpu, dest_cpu));
 }
index 08364e75bb589534e86b041887fd1832c70b4a36..12006308c7eba5f920ba417bcff27a42312399af 100644 (file)
@@ -730,7 +730,7 @@ int print_fatal_signals;
 static void print_fatal_signal(struct pt_regs *regs, int signr)
 {
        printk("%s/%d: potentially unexpected fatal signal %d.\n",
-               current->comm, current->pid, signr);
+               current->comm, task_pid_nr(current), signr);
 
 #ifdef __i386__
        printk("code at %08lx: ", regs->eip);
index edeeef3a6a322917b5b2befb95238df5557a9af5..11df812263c8fd3eed16f4f1a57d36a68f6eaedc 100644 (file)
@@ -113,7 +113,7 @@ void softlockup_tick(void)
        spin_lock(&print_lock);
        printk(KERN_ERR "BUG: soft lockup - CPU#%d stuck for %lus! [%s:%d]\n",
                        this_cpu, now - touch_timestamp,
-                               current->comm, current->pid);
+                       current->comm, task_pid_nr(current));
        if (regs)
                show_regs(regs);
        else
index d1916fea710842719333d2fba32c4680a780c9f7..52d5e7c9a8e6e82e68a0cb88ba0cdbad508eded5 100644 (file)
@@ -282,7 +282,7 @@ static void run_workqueue(struct cpu_workqueue_struct *cwq)
                        printk(KERN_ERR "BUG: workqueue leaked lock or atomic: "
                                        "%s/0x%08x/%d\n",
                                        current->comm, preempt_count(),
-                                       current->pid);
+                                       task_pid_nr(current));
                        printk(KERN_ERR "    last function: ");
                        print_symbol("%s\n", (unsigned long)f);
                        debug_show_held_locks(current);
index 479fd462eaa9c7630df676bdddd91d4dd1212a2c..9c4b0256490bd240b37f8811915e873463c88537 100644 (file)
@@ -60,12 +60,12 @@ static void spin_bug(spinlock_t *lock, const char *msg)
                owner = lock->owner;
        printk(KERN_EMERG "BUG: spinlock %s on CPU#%d, %s/%d\n",
                msg, raw_smp_processor_id(),
-               current->comm, current->pid);
+               current->comm, task_pid_nr(current));
        printk(KERN_EMERG " lock: %p, .magic: %08x, .owner: %s/%d, "
                        ".owner_cpu: %d\n",
                lock, lock->magic,
                owner ? owner->comm : "<none>",
-               owner ? owner->pid : -1,
+               owner ? task_pid_nr(owner) : -1,
                lock->owner_cpu);
        dump_stack();
 }
@@ -116,7 +116,7 @@ static void __spin_lock_debug(spinlock_t *lock)
                        printk(KERN_EMERG "BUG: spinlock lockup on CPU#%d, "
                                        "%s/%d, %p\n",
                                raw_smp_processor_id(), current->comm,
-                               current->pid, lock);
+                               task_pid_nr(current), lock);
                        dump_stack();
 #ifdef CONFIG_SMP
                        trigger_all_cpu_backtrace();
@@ -161,7 +161,7 @@ static void rwlock_bug(rwlock_t *lock, const char *msg)
 
        printk(KERN_EMERG "BUG: rwlock %s on CPU#%d, %s/%d, %p\n",
                msg, raw_smp_processor_id(), current->comm,
-               current->pid, lock);
+               task_pid_nr(current), lock);
        dump_stack();
 }
 
index e3778f1215c085e68d985858701b83acdb725b86..824cade078277fda90f06799001a563a45680394 100644 (file)
@@ -278,7 +278,8 @@ static void __oom_kill_task(struct task_struct *p, int verbose)
        }
 
        if (verbose)
-               printk(KERN_ERR "Killed process %d (%s)\n", p->pid, p->comm);
+               printk(KERN_ERR "Killed process %d (%s)\n",
+                               task_pid_nr(p), p->comm);
 
        /*
         * We give our sacrificial lamb high priority and access to
@@ -356,7 +357,7 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
        }
 
        printk(KERN_ERR "%s: kill process %d (%s) score %li or a child\n",
-                                       message, p->pid, p->comm, points);
+                                       message, task_pid_nr(p), p->comm, points);
 
        /* Try to kill a child first */
        list_for_each_entry(c, &p->children, sibling) {
index 9d6e6f18838be2fdb7690c38139a3b24680f121e..7ac703171ff3014cd2f204501250344ef5373cf1 100644 (file)
@@ -3514,7 +3514,7 @@ static int pktgen_thread_worker(void *arg)
 
        init_waitqueue_head(&t->queue);
 
-       pr_debug("pktgen: starting pktgen/%d:  pid=%d\n", cpu, current->pid);
+       pr_debug("pktgen: starting pktgen/%d:  pid=%d\n", cpu, task_pid_nr(current));
 
        set_current_state(TASK_INTERRUPTIBLE);
 
index d292b4113d6e240829c48cbd84e24ab5da660764..febbcbcf8022ac82f25d66de5dcd54177aeca250 100644 (file)
@@ -232,7 +232,7 @@ static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
                        warned++;
                        printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) "
                               "tries to set negative timeout\n",
-                               current->comm, current->pid);
+                               current->comm, task_pid_nr(current));
                return 0;
        }
        *timeo_p = MAX_SCHEDULE_TIMEOUT;
index 1960747f354c8c89966b920426d7487640476617..3b0d32291d5ec66c2dc2f3bc432bed4c453d928d 100644 (file)
@@ -877,7 +877,7 @@ int start_sync_thread(int state, char *mcast_ifn, __u8 syncid)
        if (!tinfo)
                return -ENOMEM;
 
-       IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, current->pid);
+       IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, task_pid_nr(current));
        IP_VS_DBG(7, "Each ip_vs_sync_conn entry need %Zd bytes\n",
                  sizeof(struct ip_vs_sync_conn));
 
@@ -917,7 +917,7 @@ int stop_sync_thread(int state)
            (state == IP_VS_STATE_BACKUP && !sync_backup_pid))
                return -ESRCH;
 
-       IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, current->pid);
+       IP_VS_DBG(7, "%s: pid %d\n", __FUNCTION__, task_pid_nr(current));
        IP_VS_INFO("stopping sync thread %d ...\n",
                   (state == IP_VS_STATE_MASTER) ?
                   sync_master_pid : sync_backup_pid);
index 4f322003835dc1886b4202259a91bd641d9139c3..2e6ad6dbba6c54d904d1df28d6e38dfcd7640b00 100644 (file)
@@ -1334,7 +1334,7 @@ do_prequeue:
                if ((flags & MSG_PEEK) && peek_seq != tp->copied_seq) {
                        if (net_ratelimit())
                                printk(KERN_DEBUG "TCP(%s:%d): Application bug, race in MSG_PEEK.\n",
-                                      current->comm, current->pid);
+                                      current->comm, task_pid_nr(current));
                        peek_seq = tp->copied_seq;
                }
                continue;
index 49eacba824df5bfdf1905c1df6e5503eaf15326d..46cf962f7f8889f049a3b0406f9f5f3b6c31034c 100644 (file)
@@ -762,7 +762,7 @@ static int llc_ui_recvmsg(struct kiocb *iocb, struct socket *sock,
                        if (net_ratelimit())
                                printk(KERN_DEBUG "LLC(%s:%d): Application "
                                                  "bug, race in MSG_PEEK.\n",
-                                      current->comm, current->pid);
+                                      current->comm, task_pid_nr(current));
                        peek_seq = llc->copied_seq;
                }
                continue;
index 3c773c53e12e96e08207e50446a033132043e349..c98873f39aec49bc4d4af57f60f34d23a20123c4 100644 (file)
@@ -847,7 +847,7 @@ void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, int flags, cons
        task->tk_start = jiffies;
 
        dprintk("RPC:       new task initialized, procpid %u\n",
-                               current->pid);
+                               task_pid_nr(current));
 }
 
 static struct rpc_task *