summaryrefslogtreecommitdiffstats
path: root/fs/read_write.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-04-16 12:02:43 +0200
committerIngo Molnar <mingo@kernel.org>2019-04-16 12:02:43 +0200
commit496156e3647f44e2aab3e64f86b63294afca458a (patch)
treede4c35460ef0249623d45627ad40abad07b8e7cf /fs/read_write.c
parentcabf5ebbabcd4ad59b6eb216876c4c2e56fd3386 (diff)
parent618d919cae2fcaadc752f27ddac8b939da8b441a (diff)
downloadlinux-stable-496156e3647f44e2aab3e64f86b63294afca458a.tar.gz
linux-stable-496156e3647f44e2aab3e64f86b63294afca458a.tar.bz2
linux-stable-496156e3647f44e2aab3e64f86b63294afca458a.zip
Merge branch 'linus' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r--fs/read_write.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 177ccc3d405a..61b43ad7608e 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -560,12 +560,13 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
static inline loff_t file_pos_read(struct file *file)
{
- return file->f_pos;
+ return file->f_mode & FMODE_STREAM ? 0 : file->f_pos;
}
static inline void file_pos_write(struct file *file, loff_t pos)
{
- file->f_pos = pos;
+ if ((file->f_mode & FMODE_STREAM) == 0)
+ file->f_pos = pos;
}
ssize_t ksys_read(unsigned int fd, char __user *buf, size_t count)