diff mbox series

[SRU,Focal,3/3] Revert "fs: check FMODE_LSEEK to control internal pipe splicing"

Message ID 20221123174836.1973558-4-cascardo@canonical.com
State New
Headers show
Series LP: #1996678 - containerd regressions | expand

Commit Message

Thadeu Lima de Souza Cascardo Nov. 23, 2022, 5:48 p.m. UTC
From: Sasha Levin <sashal@kernel.org>

BugLink: https://bugs.launchpad.net/bugs/1996678

This reverts commit fd0a6e99b61e6c08fa5cf585d54fd956f70c73a6.

Which was upstream commit 97ef77c52b789ec1411d360ed99dca1efe4b2c81.

The commit is missing dependencies and breaks NFS tests, remove it for
now.

Reported-by: Saeed Mirzamohammadi <saeed.mirzamohammadi@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit c248c3330d5f09cbf08fb0d2025bcd075b0f8672 linux-5.4.y)
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 fs/splice.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/fs/splice.c b/fs/splice.c
index 665bbaa4d346..d47bcda3ae68 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -897,15 +897,17 @@  ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
 {
 	struct pipe_inode_info *pipe;
 	long ret, bytes;
+	umode_t i_mode;
 	size_t len;
 	int i, flags, more;
 
 	/*
-	 * We require the input to be seekable, as we don't want to randomly
-	 * drop data for eg socket -> socket splicing. Use the piped splicing
-	 * for that!
+	 * We require the input being a regular file, as we don't want to
+	 * randomly drop data for eg socket -> socket splicing. Use the
+	 * piped splicing for that!
 	 */
-	if (unlikely(!(in->f_mode & FMODE_LSEEK)))
+	i_mode = file_inode(in)->i_mode;
+	if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode)))
 		return -EINVAL;
 
 	/*