sporadic deadlock fix
move to always kthreaded and mitigate sporadic deadlocks on Co-authored-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
This commit is contained in:
@@ -259,7 +259,7 @@ static bool has_v1_signature_file(struct file *fp)
|
||||
* possibly optional
|
||||
*
|
||||
*/
|
||||
static bool is_lock_held(const char *path)
|
||||
bool is_lock_held(const char *path)
|
||||
{
|
||||
struct path kpath;
|
||||
|
||||
|
||||
@@ -439,13 +439,6 @@ static int throne_tracker_thread(void *data)
|
||||
|
||||
void track_throne(void)
|
||||
{
|
||||
static bool throne_tracker_first_run __read_mostly = true;
|
||||
if (unlikely(throne_tracker_first_run)) {
|
||||
track_throne_function();
|
||||
throne_tracker_first_run = false;
|
||||
return;
|
||||
}
|
||||
|
||||
smp_mb();
|
||||
if (throne_thread != NULL) // single instance lock
|
||||
return;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#define KERN_PATH_TIMEOUT_MS 100
|
||||
#define MAX_FUSE_CHECK_RETRIES 3
|
||||
|
||||
extern bool is_lock_held(const char *path);
|
||||
|
||||
static struct workqueue_struct *scan_workqueue;
|
||||
|
||||
struct work_buffers *get_work_buffer(void)
|
||||
@@ -216,6 +218,16 @@ static int process_deferred_paths(struct list_head *deferred_paths, struct list_
|
||||
continue;
|
||||
}
|
||||
|
||||
int tries = 0;
|
||||
do {
|
||||
if (!is_lock_held(path_info->path))
|
||||
break;
|
||||
|
||||
tries++;
|
||||
pr_info("%s: waiting for lock on %s (try %d)\n", __func__, path_info->path, tries);
|
||||
msleep(100);
|
||||
} while (tries < 10);
|
||||
|
||||
struct kstat stat;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) || defined(KSU_HAS_NEW_VFS_GETATTR)
|
||||
err = vfs_getattr(&path, &stat, STATX_UID, AT_STATX_SYNC_AS_STAT);
|
||||
|
||||
Reference in New Issue
Block a user