diff options
Diffstat (limited to 'fs/splice.c')
-rw-r--r-- | fs/splice.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/splice.c b/fs/splice.c index 476024bb6546..bfe62ae40f40 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -1161,7 +1161,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, | |||
1161 | long ret, bytes; | 1161 | long ret, bytes; |
1162 | umode_t i_mode; | 1162 | umode_t i_mode; |
1163 | size_t len; | 1163 | size_t len; |
1164 | int i, flags; | 1164 | int i, flags, more; |
1165 | 1165 | ||
1166 | /* | 1166 | /* |
1167 | * We require the input being a regular file, as we don't want to | 1167 | * We require the input being a regular file, as we don't want to |
@@ -1204,6 +1204,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, | |||
1204 | * Don't block on output, we have to drain the direct pipe. | 1204 | * Don't block on output, we have to drain the direct pipe. |
1205 | */ | 1205 | */ |
1206 | sd->flags &= ~SPLICE_F_NONBLOCK; | 1206 | sd->flags &= ~SPLICE_F_NONBLOCK; |
1207 | more = sd->flags & SPLICE_F_MORE; | ||
1207 | 1208 | ||
1208 | while (len) { | 1209 | while (len) { |
1209 | size_t read_len; | 1210 | size_t read_len; |
@@ -1217,6 +1218,15 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, | |||
1217 | sd->total_len = read_len; | 1218 | sd->total_len = read_len; |
1218 | 1219 | ||
1219 | /* | 1220 | /* |
1221 | * If more data is pending, set SPLICE_F_MORE | ||
1222 | * If this is the last data and SPLICE_F_MORE was not set | ||
1223 | * initially, clears it. | ||
1224 | */ | ||
1225 | if (read_len < len) | ||
1226 | sd->flags |= SPLICE_F_MORE; | ||
1227 | else if (!more) | ||
1228 | sd->flags &= ~SPLICE_F_MORE; | ||
1229 | /* | ||
1220 | * NOTE: nonblocking mode only applies to the input. We | 1230 | * NOTE: nonblocking mode only applies to the input. We |
1221 | * must not do the output in nonblocking mode as then we | 1231 | * must not do the output in nonblocking mode as then we |
1222 | * could get stuck data in the internal pipe: | 1232 | * could get stuck data in the internal pipe: |