summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_attr_inactive.c
diff options
context:
space:
mode:
authorHou Tao2017-10-17 23:16:28 +0200
committerDarrick J. Wong2017-10-27 00:38:22 +0200
commit0bd89676c4fed53b003025bc4a5200861ac5d8ef (patch)
tree466a692aa4012845b76395f7d99954b5180bcf3e /fs/xfs/xfs_attr_inactive.c
parentxfs: remove xfs_bmbt_get_state (diff)
downloadkernel-qcow2-linux-0bd89676c4fed53b003025bc4a5200861ac5d8ef.tar.gz
kernel-qcow2-linux-0bd89676c4fed53b003025bc4a5200861ac5d8ef.tar.xz
kernel-qcow2-linux-0bd89676c4fed53b003025bc4a5200861ac5d8ef.zip
xfs: check kthread_should_stop() after the setting of task state
A umount hang is possible when a race occurs between the umount process and the xfsaild kthread. The following sequences outline the race: xfsaild: kthread_should_stop() => return false, so xfsaild continue umount: set_bit(KTHREAD_SHOULD_STOP, &kthread->flags) => by kthread_stop() umount: wake_up_process() => because xfsaild is still running, so 0 is returned xfsaild: __set_current_state(TASK_INTERRUPTIBLE) xfsaild: schedule() => now, xfsaild will wait indefinitely umount: wait_for_completion() => and umount will hang To fix that, we need to check kthread_should_stop() after we set the task state, so the xfsaild will either see the stop bit and exit or the task state is reset to runnable by wake_up_process() such that it isn't scheduled out indefinitely and detects the stop bit at the next iteration. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Hou Tao <houtao1@huawei.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_attr_inactive.c')
0 files changed, 0 insertions, 0 deletions