提交 2b838687 编写于 作者: L Linus Torvalds

Make /dev/zero reads interruptible by signals

This helps with bad latencies for large reads from /dev/zero, but might
conceivably break some application that "knows" that a read of /dev/zero
cannot return early.  So do this early in the merge window to give us
maximal test coverage, even if the patch is totally trivial.

Obviously, no well-behaved application should ever depend on the read
being uninterruptible, but hey, bugs happen.
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 07a2039b
...@@ -694,9 +694,8 @@ static ssize_t read_zero(struct file * file, char __user * buf, ...@@ -694,9 +694,8 @@ static ssize_t read_zero(struct file * file, char __user * buf,
written += chunk - unwritten; written += chunk - unwritten;
if (unwritten) if (unwritten)
break; break;
/* Consider changing this to just 'signal_pending()' with lots of testing */ if (signal_pending(current))
if (fatal_signal_pending(current)) return written ? written : -ERESTARTSYS;
return written ? written : -EINTR;
buf += chunk; buf += chunk;
count -= chunk; count -= chunk;
cond_resched(); cond_resched();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册