From: Jeffrey Hutzelman Date: Thu, 8 Feb 2007 22:37:41 +0000 (+0000) Subject: linux-lock-tracking-20070208 X-Git-Tag: BP-openafs-windows-kdfs-ifs~816 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=b0425c4e7f65c00fe217d7c54d309bceac9b38d5 linux-lock-tracking-20070208 FIXES 31818 avoid a potential leaked lock when closing firefox. --- diff --git a/acinclude.m4 b/acinclude.m4 index db38569..50a9419 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -622,6 +622,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_RLIM LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_EXIT_STATE + LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_TGID LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_TODO LINUX_GET_SB_HAS_STRUCT_VFSMOUNT LINUX_STATFS_TAKES_DENTRY @@ -801,6 +802,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) if test "x$ac_cv_linux_sched_struct_task_struct_has_exit_state" = "xyes"; then AC_DEFINE(STRUCT_TASK_STRUCT_HAS_EXIT_STATE, 1, [define if your struct task_struct has exit_state]) fi + if test "x$ac_cv_linux_sched_struct_task_struct_has_tgid" = "xyes"; then + AC_DEFINE(STRUCT_TASK_STRUCT_HAS_TGID, 1, [define if your struct task_struct has tgid]) + fi if test "x$ac_cv_linux_sched_struct_task_struct_has_todo" = "xyes"; then AC_DEFINE(STRUCT_TASK_STRUCT_HAS_TODO, 1, [define if your struct task_struct has todo]) fi diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h index 52488af..836a98d 100644 --- a/src/afs/LINUX/osi_machdep.h +++ b/src/afs/LINUX/osi_machdep.h @@ -28,6 +28,16 @@ #undef getuerror +#ifdef STRUCT_TASK_STRUCT_HAS_TGID +#define getpid() current->tgid +#ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT +#define getppid() current->real_parent->tgid +#elif defined(STRUCT_TASK_STRUCT_HAS_PARENT) +#define getppid() current->parent->tgid +#else +#define getppid() current->p_opptr->tgid +#endif +#else /* !STRUCT_TASK_STRUCT_HAS_TGID */ #define getpid() current->pid #ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT #define getppid() current->real_parent->pid @@ -36,6 +46,7 @@ #else #define getppid() current->p_opptr->pid #endif +#endif /* STRUCT_TASK_STRUCT_HAS_TGID */ #ifdef RECALC_SIGPENDING_TAKES_VOID #define RECALC_SIGPENDING(X) recalc_sigpending() diff --git a/src/afs/afs_osi.h b/src/afs/afs_osi.h index 9eb0a27..c66ece8 100644 --- a/src/afs/afs_osi.h +++ b/src/afs/afs_osi.h @@ -212,8 +212,12 @@ typedef struct timeval osi_timeval_t; /* should use curthread, but 'ps' can't display it */ #define osi_ThreadUnique() curproc #else +#ifdef AFS_LINUX_ENV +#define osi_ThreadUnique() (current->pid) +#else #define osi_ThreadUnique() getpid() #endif +#endif diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 6beb68c..0fd4e3c 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -333,6 +333,18 @@ printk("%d\n", _tsk.parent);], AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_parent)]) +AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_TGID], [ + AC_MSG_CHECKING([for tgid in struct task_struct]) + AC_CACHE_VAL([ac_cv_linux_sched_struct_task_struct_has_tgid], [ + AC_TRY_KBUILD( +[#include ], +[struct task_struct _tsk; +printk("%d\n", _tsk.tgid);], + ac_cv_linux_sched_struct_task_struct_has_tgid=yes, + ac_cv_linux_sched_struct_task_struct_has_tgid=no)]) + AC_MSG_RESULT($ac_cv_linux_sched_struct_task_struct_has_tgid)]) + + AC_DEFUN([LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_REAL_PARENT], [ AC_MSG_CHECKING([for real_parent in struct task_struct]) AC_CACHE_VAL([ac_cv_linux_sched_struct_task_struct_has_real_parent], [