diff options
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 4082b3b3cea7..648f2c0c8e18 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2125,6 +2125,12 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, | |||
2125 | break; | 2125 | break; |
2126 | } | 2126 | } |
2127 | 2127 | ||
2128 | if (unlikely(bytes == 0)) { | ||
2129 | status = 0; | ||
2130 | copied = 0; | ||
2131 | goto zero_length_segment; | ||
2132 | } | ||
2133 | |||
2128 | status = a_ops->prepare_write(file, page, offset, offset+bytes); | 2134 | status = a_ops->prepare_write(file, page, offset, offset+bytes); |
2129 | if (unlikely(status)) { | 2135 | if (unlikely(status)) { |
2130 | loff_t isize = i_size_read(inode); | 2136 | loff_t isize = i_size_read(inode); |
@@ -2154,7 +2160,8 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov, | |||
2154 | page_cache_release(page); | 2160 | page_cache_release(page); |
2155 | continue; | 2161 | continue; |
2156 | } | 2162 | } |
2157 | if (likely(copied > 0)) { | 2163 | zero_length_segment: |
2164 | if (likely(copied >= 0)) { | ||
2158 | if (!status) | 2165 | if (!status) |
2159 | status = copied; | 2166 | status = copied; |
2160 | 2167 | ||