pipe: simplify signal handling in pipe_read() and add comments
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Dec 2019 19:46:19 +0000 (11:46 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Dec 2019 19:46:19 +0000 (11:46 -0800)
commitd1c6a2aa02af09238ad09493eb3c8685ccc3fe12
tree138bfecd61e39cbe7492eaba1db0092d1e8cc8e7
parent6794862a16ef41f753abd75c03a152836e4c8028
pipe: simplify signal handling in pipe_read() and add comments

There's no need to separately check for signals while inside the locked
region, since we're going to do "wait_event_interruptible()" right
afterwards anyway, and the error handling is much simpler there.

The check for whether we had already read anything was also redundant,
since we no longer do the odd merging of reads when there are pending
writers.

But perhaps more importantly, this adds commentary about why we still
need to wake up possible writers even though we didn't read any data,
and why we can skip all the finishing touches now if we get a signal (or
had a signal pending) while waiting for more data.

[ This is a split-out cleanup from my "make pipe IO use exclusive wait
  queues" thing, which I can't apply because it triggers a nasty bug in
  the GNU make jobserver   - Linus ]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/pipe.c