relayfs: fix infinite loop with splice()

Running kmemtraced, which uses splice() on relayfs, causes a hard lock on
x86-64 SMP. As described by Tom Zanussi:

It looks like you hit the same problem as described here:

commit 8191ecd1d14c6914c660dfa007154860a7908857

splice: fix infinite loop in generic_file_splice_read()

relay uses the same loop but it never got noticed or fixed.

Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Tested-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Tom Zanussi and committed by Linus Torvalds fbb5b7ae 36137120

+2 -5
+2 -5
kernel/relay.c
··· 1317 1317 if (ret < 0) 1318 1318 break; 1319 1319 else if (!ret) { 1320 - if (spliced) 1321 - break; 1322 - if (flags & SPLICE_F_NONBLOCK) { 1320 + if (flags & SPLICE_F_NONBLOCK) 1323 1321 ret = -EAGAIN; 1324 - break; 1325 - } 1322 + break; 1326 1323 } 1327 1324 1328 1325 *ppos += ret;