Commit 4e3299ea authored by Jason A. Donenfeld's avatar Jason A. Donenfeld Committed by Al Viro

fs: do not compare against ->llseek

Now vfs_llseek() can simply check for FMODE_LSEEK; if it's set,
we know that ->llseek() won't be NULL and if it's not we should
just fail with -ESPIPE.

A couple of other places where we used to check for special
values of ->llseek() (somewhat inconsistently) switched to
checking FMODE_LSEEK.
Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent e7478158
...@@ -816,9 +816,9 @@ static int __dump_skip(struct coredump_params *cprm, size_t nr) ...@@ -816,9 +816,9 @@ static int __dump_skip(struct coredump_params *cprm, size_t nr)
{ {
static char zeroes[PAGE_SIZE]; static char zeroes[PAGE_SIZE];
struct file *file = cprm->file; struct file *file = cprm->file;
if (file->f_op->llseek && file->f_op->llseek != no_llseek) { if (file->f_mode & FMODE_LSEEK) {
if (dump_interrupted() || if (dump_interrupted() ||
file->f_op->llseek(file, nr, SEEK_CUR) < 0) vfs_llseek(file, nr, SEEK_CUR) < 0)
return 0; return 0;
cprm->pos += nr; cprm->pos += nr;
return 1; return 1;
......
...@@ -226,8 +226,7 @@ static int ovl_copy_up_data(struct ovl_fs *ofs, struct path *old, ...@@ -226,8 +226,7 @@ static int ovl_copy_up_data(struct ovl_fs *ofs, struct path *old,
/* Couldn't clone, so now we try to copy the data */ /* Couldn't clone, so now we try to copy the data */
/* Check if lower fs supports seek operation */ /* Check if lower fs supports seek operation */
if (old_file->f_mode & FMODE_LSEEK && if (old_file->f_mode & FMODE_LSEEK)
old_file->f_op->llseek)
skip_hole = true; skip_hole = true;
while (len) { while (len) {
......
...@@ -290,14 +290,9 @@ EXPORT_SYMBOL(default_llseek); ...@@ -290,14 +290,9 @@ EXPORT_SYMBOL(default_llseek);
loff_t vfs_llseek(struct file *file, loff_t offset, int whence) loff_t vfs_llseek(struct file *file, loff_t offset, int whence)
{ {
loff_t (*fn)(struct file *, loff_t, int); if (!(file->f_mode & FMODE_LSEEK))
return -ESPIPE;
fn = no_llseek; return file->f_op->llseek(file, offset, whence);
if (file->f_mode & FMODE_LSEEK) {
if (file->f_op->llseek)
fn = file->f_op->llseek;
}
return fn(file, offset, whence);
} }
EXPORT_SYMBOL(vfs_llseek); EXPORT_SYMBOL(vfs_llseek);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment