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:34:18 +0000 (12:34 -0400)
commit9e48efda56a31a1946611de15158fe01e036fbf7
treedc2902550e20bb453f959e5e89956e921017515f
parentee695bf0762f5dbcb2ac6d96354f8d01ad764903
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