diff options
-rw-r--r-- | fs/splice.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/splice.c b/fs/splice.c index 5428b0ff3b6..2282650bdbe 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -378,10 +378,11 @@ __generic_file_splice_read(struct file *in, loff_t *ppos, * If in nonblock mode then dont block on waiting * for an in-flight io page */ - if (flags & SPLICE_F_NONBLOCK) - break; - - lock_page(page); + if (flags & SPLICE_F_NONBLOCK) { + if (TestSetPageLocked(page)) + break; + } else + lock_page(page); /* * page was truncated, stop here. if this isn't the |