Skip to content

Commit cfdfe9e

Browse files
konisakpm00
authored andcommitted
nilfs2: remove sc_timer_task
After commit f5d4e04 ("nilfs2: fix use-after-free of timer for log writer thread") is applied, nilfs_construct_timeout(), which is called by a timer and wakes up the log writer thread, is never called after the log writer thread has terminated. As a result, the member variable "sc_timer_task" of the "nilfs_sc_info" structure, which was added when timer_setup() was adopted to retain a reference to the log writer thread's task even after it had terminated, is no longer needed, as it should be; we can simply use "sc_task" instead, which holds a reference to the log writer thread's task for its lifetime. So, eliminate "sc_timer_task" by this means. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ryusuke Konishi <[email protected]> Cc: Huang Xiaojia <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 33d23d8 commit cfdfe9e

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

fs/nilfs2/segment.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2502,7 +2502,7 @@ static void nilfs_construction_timeout(struct timer_list *t)
25022502
{
25032503
struct nilfs_sc_info *sci = from_timer(sci, t, sc_timer);
25042504

2505-
wake_up_process(sci->sc_timer_task);
2505+
wake_up_process(sci->sc_task);
25062506
}
25072507

25082508
static void
@@ -2640,7 +2640,6 @@ static int nilfs_segctor_thread(void *arg)
26402640
struct the_nilfs *nilfs = sci->sc_super->s_fs_info;
26412641
int timeout = 0;
26422642

2643-
sci->sc_timer_task = current;
26442643
timer_setup(&sci->sc_timer, nilfs_construction_timeout, 0);
26452644

26462645
/* start sync. */

fs/nilfs2/segment.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ struct nilfs_segsum_pointer {
115115
* @sc_lseg_stime: Start time of the latest logical segment
116116
* @sc_watermark: Watermark for the number of dirty buffers
117117
* @sc_timer: Timer for segctord
118-
* @sc_timer_task: Thread woken up by @sc_timer
119118
* @sc_task: current thread of segctord
120119
*/
121120
struct nilfs_sc_info {
@@ -172,7 +171,6 @@ struct nilfs_sc_info {
172171
unsigned long sc_watermark;
173172

174173
struct timer_list sc_timer;
175-
struct task_struct *sc_timer_task;
176174
struct task_struct *sc_task;
177175
};
178176

0 commit comments

Comments
 (0)