Re: [PATCH] TASK_KILLABLE version 2
From: Bob Bell
Date: Mon Sep 24 2007 - 16:26:19 EST
On Sat, Sep 01, 2007 at 08:43:49PM -0600, Matthew Wilcox wrote:
Here's the second version of TASK_KILLABLE. A few changes since version 1:
I obviously haven't covered every place that can result in a process
sleeping uninterruptibly while attempting an operation. But sync_page
(patch 4/5) covers about 90% of the times I've attempted to kill cat,
and I hope that by providing the two examples, I can help other people
to fix the cases that they find interesting.
I've been testing this patch on my systems. It's working for me when
I read() a file. Asynchronous write()s seem okay, too. However,
synchronous writes (caused by either calling fsync() or fcntl() to
release a lock) prevent the process from being killed when the NFS
server goes down.
When the process is sent SIGKILL, it's waiting with the following call
nfs_wait_on_requests_locks (I believe)
When the process is later viewed after being deemed "stuck", it's
waiting with the following call tree:
If I hazard a guess as to what might be wrong here, I believe that when
the processes catches SIGKILL, nfs_wait_bit_interruptible is returning
-ERESTARTSYS. That error bubbles back up to nfs_fsync. However,
nfs_fsync returns ctx->error, not -ERESTARTSYS, and ctx->error is 0.
do_fsync proceeds to call filemap_fdatawait. I question whether
nfs_sync should return an error, and if do_fsync should skip
filemap_fdatawait if the fsync op returned an error.
I did try replacing the call to sync_page in __wait_on_bit with
sync_page_killable and replacing TASK_UNINTERRUPTIBLE with
TASK_KILLABLE. That seemed to work once, but then really screwed things
up on subsequent attempts.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/