Loading kernel/acct.c +17 −3 Original line number Original line Diff line number Diff line Loading @@ -92,6 +92,8 @@ struct bsd_acct_struct { unsigned long needcheck; unsigned long needcheck; struct file *file; struct file *file; struct pid_namespace *ns; struct pid_namespace *ns; struct work_struct work; struct completion done; }; }; static void acct_free_rcu(struct rcu_head *head) static void acct_free_rcu(struct rcu_head *head) Loading Loading @@ -176,15 +178,27 @@ static struct bsd_acct_struct *acct_get(struct pid_namespace *ns) return res; return res; } } static void close_work(struct work_struct *work) { struct bsd_acct_struct *acct = container_of(work, struct bsd_acct_struct, work); struct file *file = acct->file; mnt_unpin(file->f_path.mnt); if (file->f_op->flush) file->f_op->flush(file, NULL); __fput_sync(file); complete(&acct->done); } static void acct_kill(struct bsd_acct_struct *acct, static void acct_kill(struct bsd_acct_struct *acct, struct bsd_acct_struct *new) struct bsd_acct_struct *new) { { if (acct) { if (acct) { struct file *file = acct->file; struct pid_namespace *ns = acct->ns; struct pid_namespace *ns = acct->ns; do_acct_process(acct); do_acct_process(acct); mnt_unpin(file->f_path.mnt); INIT_WORK(&acct->work, close_work); filp_close(file, NULL); init_completion(&acct->done); schedule_work(&acct->work); wait_for_completion(&acct->done); spin_lock(&acct_lock); spin_lock(&acct_lock); hlist_del(&acct->m_list); hlist_del(&acct->m_list); hlist_del(&acct->s_list); hlist_del(&acct->s_list); Loading Loading
kernel/acct.c +17 −3 Original line number Original line Diff line number Diff line Loading @@ -92,6 +92,8 @@ struct bsd_acct_struct { unsigned long needcheck; unsigned long needcheck; struct file *file; struct file *file; struct pid_namespace *ns; struct pid_namespace *ns; struct work_struct work; struct completion done; }; }; static void acct_free_rcu(struct rcu_head *head) static void acct_free_rcu(struct rcu_head *head) Loading Loading @@ -176,15 +178,27 @@ static struct bsd_acct_struct *acct_get(struct pid_namespace *ns) return res; return res; } } static void close_work(struct work_struct *work) { struct bsd_acct_struct *acct = container_of(work, struct bsd_acct_struct, work); struct file *file = acct->file; mnt_unpin(file->f_path.mnt); if (file->f_op->flush) file->f_op->flush(file, NULL); __fput_sync(file); complete(&acct->done); } static void acct_kill(struct bsd_acct_struct *acct, static void acct_kill(struct bsd_acct_struct *acct, struct bsd_acct_struct *new) struct bsd_acct_struct *new) { { if (acct) { if (acct) { struct file *file = acct->file; struct pid_namespace *ns = acct->ns; struct pid_namespace *ns = acct->ns; do_acct_process(acct); do_acct_process(acct); mnt_unpin(file->f_path.mnt); INIT_WORK(&acct->work, close_work); filp_close(file, NULL); init_completion(&acct->done); schedule_work(&acct->work); wait_for_completion(&acct->done); spin_lock(&acct_lock); spin_lock(&acct_lock); hlist_del(&acct->m_list); hlist_del(&acct->m_list); hlist_del(&acct->s_list); hlist_del(&acct->s_list); Loading