Whamcloud - gitweb
LU-12330 obdclass: allow per-session jobids. 95/34995/9
authorNeilBrown <neilb@suse.com>
Thu, 23 May 2019 00:15:43 +0000 (10:15 +1000)
committerOleg Drokin <green@whamcloud.com>
Tue, 25 Jun 2019 01:55:04 +0000 (01:55 +0000)
commita32ce8f50ecafa4fd44732023cc1d45f57cd56bd
tree4078417f152a1d2a6d1f66191ba894d143ec13d9
parentc2791674260b120c596885c0356f33852cd7a685
LU-12330 obdclass: allow per-session jobids.

Lustre includes a jobid in all RPC message sent to the server.  This
is used to collected per-job statistics, where a "job" can involve
multiple processes on multiple nodes in a cluster.

Nodes in a cluster can be running processes for multiple jobs, so it
is best if different processes can have different jobids, and that
processes on different nodes can have the same job id.

The current mechanism for supporting this is to use an environment
variable which the kernel extracts from the relevant process's address
space.  Some kernel developers see this to be an unacceptable design
choice, and the code is not likely to be accepted upstream.

This patch provides an alternate method, leveraging the concept of a
"session id", as set with setsid().  Each login session already gets a
unique sid which is preserved for all processes in that session unless
explicitly changed (with setsid(1)).
When a process in a session writes to
     /sys/fs/lustre/jobid_this_session
the string becomes the name for that session.
If jobid_var is set to "session", then the per-session jobid is used
for the jobid for all requests from processes in that session.

When a session ends, the jobid information will be purged within 5
minutes.

Change-Id: I6fb1a75f8f60f824e402706de0b1439464bfa05c
Signed-off-by: Mr NeilBrown <neilb@suse.com>
Reviewed-on: https://review.whamcloud.com/34995
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Ben Evans <bevans@cray.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/include/libcfs/linux/linux-hash.h
lustre/include/lprocfs_status.h
lustre/include/obd_class.h
lustre/obdclass/jobid.c
lustre/obdclass/obd_sysfs.c