Skip to content

Commit

Permalink
Make /dev/zero reads interruptible by signals
Browse files Browse the repository at this point in the history
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: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Linus Torvalds committed Jun 10, 2009
1 parent 07a2039 commit 2b83868
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,8 @@ static ssize_t read_zero(struct file * file, char __user * buf,
written += chunk - unwritten;
if (unwritten)
break;
/* Consider changing this to just 'signal_pending()' with lots of testing */
if (fatal_signal_pending(current))
return written ? written : -EINTR;
if (signal_pending(current))
return written ? written : -ERESTARTSYS;
buf += chunk;
count -= chunk;
cond_resched();
Expand Down

0 comments on commit 2b83868

Please sign in to comment.