aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-12-08 14:25:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-12-08 14:25:02 -0500
commitf896adc42d5399eb68c9900bd4fd471ccea895e4 (patch)
tree99ea258f46790dd8206f42ff42f8be0a58d09e92
parent356ff8a9a78fb35d6482584d260c3754dcbdf669 (diff)
parent8f67b5adc030553fbc877124306f3f3bdab89aa8 (diff)
Merge tag 'xfs-4.20-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs fixes from Darrick Wong: "Here are hopefully the last set of fixes for 4.20. There's a fix for a longstanding statfs reporting problem with project quotas, a correction for page cache invalidation behaviors when fallocating near EOF, and a fix for a broken metadata verifier return code. Finally, the most important fix is to the pipe splicing code (aka the generic copy_file_range fallback) to avoid pointless short directio reads by only asking the filesystem for as much data as there are available pages in the pipe buffer. Our previous fix (simulated short directio reads because the number of pages didn't match the length of the read requested) caused subtle problems on overlayfs, so that part is reverted. Anyhow, this series passes fstests -g all on xfs and overlay+xfs, and has passed 17 billion fsx operations problem-free since I started testing Summary: - Fix broken project quota inode counts - Fix incorrect PAGE_MASK/PAGE_SIZE usage - Fix incorrect return value in btree verifier - Fix WARN_ON remap flags false positive - Fix splice read overflows" * tag 'xfs-4.20-fixes-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: iomap: partially revert 4721a601099 (simulated directio short read on EFAULT) splice: don't read more than available pipe space vfs: allow some remap flags to be passed to vfs_clone_file_range xfs: fix inverted return from xfs_btree_sblock_verify_crc xfs: fix PAGE_MASK usage in xfs_free_file_space fs/xfs: fix f_ffree value for statfs when project quota is set
-rw-r--r--fs/iomap.c9
-rw-r--r--fs/read_write.c2
-rw-r--r--fs/splice.c7
-rw-r--r--fs/xfs/libxfs/xfs_btree.c2
-rw-r--r--fs/xfs/xfs_bmap_util.c4
-rw-r--r--fs/xfs/xfs_qm_bhv.c2
6 files changed, 11 insertions, 15 deletions
diff --git a/fs/iomap.c b/fs/iomap.c
index 3ffb776fbebe..d6bc98ae8d35 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -1877,15 +1877,6 @@ iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
1877 dio->wait_for_completion = true; 1877 dio->wait_for_completion = true;
1878 ret = 0; 1878 ret = 0;
1879 } 1879 }
1880
1881 /*
1882 * Splicing to pipes can fail on a full pipe. We have to
1883 * swallow this to make it look like a short IO
1884 * otherwise the higher splice layers will completely
1885 * mishandle the error and stop moving data.
1886 */
1887 if (ret == -EFAULT)
1888 ret = 0;
1889 break; 1880 break;
1890 } 1881 }
1891 pos += ret; 1882 pos += ret;
diff --git a/fs/read_write.c b/fs/read_write.c
index 4dae0399c75a..58f30537c47a 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1956,7 +1956,7 @@ loff_t do_clone_file_range(struct file *file_in, loff_t pos_in,
1956 struct inode *inode_out = file_inode(file_out); 1956 struct inode *inode_out = file_inode(file_out);
1957 loff_t ret; 1957 loff_t ret;
1958 1958
1959 WARN_ON_ONCE(remap_flags); 1959 WARN_ON_ONCE(remap_flags & REMAP_FILE_DEDUP);
1960 1960
1961 if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode)) 1961 if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))
1962 return -EISDIR; 1962 return -EISDIR;
diff --git a/fs/splice.c b/fs/splice.c
index 3553f1956508..de2ede048473 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -945,11 +945,16 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
945 sd->flags &= ~SPLICE_F_NONBLOCK; 945 sd->flags &= ~SPLICE_F_NONBLOCK;
946 more = sd->flags & SPLICE_F_MORE; 946 more = sd->flags & SPLICE_F_MORE;
947 947
948 WARN_ON_ONCE(pipe->nrbufs != 0);
949
948 while (len) { 950 while (len) {
949 size_t read_len; 951 size_t read_len;
950 loff_t pos = sd->pos, prev_pos = pos; 952 loff_t pos = sd->pos, prev_pos = pos;
951 953
952 ret = do_splice_to(in, &pos, pipe, len, flags); 954 /* Don't try to read more the pipe has space for. */
955 read_len = min_t(size_t, len,
956 (pipe->buffers - pipe->nrbufs) << PAGE_SHIFT);
957 ret = do_splice_to(in, &pos, pipe, read_len, flags);
953 if (unlikely(ret <= 0)) 958 if (unlikely(ret <= 0))
954 goto out_release; 959 goto out_release;
955 960
diff --git a/fs/xfs/libxfs/xfs_btree.c b/fs/xfs/libxfs/xfs_btree.c
index 34c6d7bd4d18..bbdae2b4559f 100644
--- a/fs/xfs/libxfs/xfs_btree.c
+++ b/fs/xfs/libxfs/xfs_btree.c
@@ -330,7 +330,7 @@ xfs_btree_sblock_verify_crc(
330 330
331 if (xfs_sb_version_hascrc(&mp->m_sb)) { 331 if (xfs_sb_version_hascrc(&mp->m_sb)) {
332 if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.s.bb_lsn))) 332 if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.s.bb_lsn)))
333 return __this_address; 333 return false;
334 return xfs_buf_verify_cksum(bp, XFS_BTREE_SBLOCK_CRC_OFF); 334 return xfs_buf_verify_cksum(bp, XFS_BTREE_SBLOCK_CRC_OFF);
335 } 335 }
336 336
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 404e581f1ea1..1ee8c5539fa4 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -1126,9 +1126,9 @@ xfs_free_file_space(
1126 * page could be mmap'd and iomap_zero_range doesn't do that for us. 1126 * page could be mmap'd and iomap_zero_range doesn't do that for us.
1127 * Writeback of the eof page will do this, albeit clumsily. 1127 * Writeback of the eof page will do this, albeit clumsily.
1128 */ 1128 */
1129 if (offset + len >= XFS_ISIZE(ip) && ((offset + len) & PAGE_MASK)) { 1129 if (offset + len >= XFS_ISIZE(ip) && offset_in_page(offset + len) > 0) {
1130 error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, 1130 error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping,
1131 (offset + len) & ~PAGE_MASK, LLONG_MAX); 1131 round_down(offset + len, PAGE_SIZE), LLONG_MAX);
1132 } 1132 }
1133 1133
1134 return error; 1134 return error;
diff --git a/fs/xfs/xfs_qm_bhv.c b/fs/xfs/xfs_qm_bhv.c
index 73a1d77ec187..3091e4bc04ef 100644
--- a/fs/xfs/xfs_qm_bhv.c
+++ b/fs/xfs/xfs_qm_bhv.c
@@ -40,7 +40,7 @@ xfs_fill_statvfs_from_dquot(
40 statp->f_files = limit; 40 statp->f_files = limit;
41 statp->f_ffree = 41 statp->f_ffree =
42 (statp->f_files > dqp->q_res_icount) ? 42 (statp->f_files > dqp->q_res_icount) ?
43 (statp->f_ffree - dqp->q_res_icount) : 0; 43 (statp->f_files - dqp->q_res_icount) : 0;
44 } 44 }
45} 45}
46 46