Whamcloud - gitweb
LU-1735 ptlrpc: only set jobid if not already set
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 10 Aug 2012 22:24:00 +0000 (16:24 -0600)
committerOleg Drokin <green@whamcloud.com>
Wed, 22 Aug 2012 16:14:49 +0000 (12:14 -0400)
commitf641913a348ec0179cdc599baa93f74aa64f9943
tree05ee73de0cd118aac8fadb6a87e3918d482fccf0
parent388111848489ef99b1fa31ce8fef255ab9c08e84
LU-1735 ptlrpc: only set jobid if not already set

The ptlrpc_set_add_req->lustre_get_jobid->cfs_access_process_vm()
callpath locks mm->mmap_sem to fetch environment variables, but if
this could deadlock in case of MMAP IO, which also holds mmap_sem.
If the mmap_sem is already held for write, just don't set the jobid.
This will make jobid stats inconsistent for mmap IO, but avoids a
lot of complexity or race conditions in the code otherwise.

If the caller already has fetched the jobid and saved it for this
inode in the OSC layer, so we don't need to fetch and reset the
pd_jobid field at all in this case.  This avoids doing extra work
to fetch the jobid if it is not needed, and avoids storing it
temporarily on the stack when it won't be used.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I22c3d5c1755c1d6aab666a769df38218b954650a
Reviewed-on: http://review.whamcloud.com/3604
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Niu Yawei <niu@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/linux/linux-curproc.c
lustre/obdclass/class_obd.c
lustre/ptlrpc/client.c
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/ptlrpcd.c