Skip to content

Commit

Permalink
tmpfs: fix SEEK_DATA/SEEK_HOLE regression
Browse files Browse the repository at this point in the history
Commit 46a1c2c ("vfs: export lseek_execute() to modules") broke the
tmpfs SEEK_DATA/SEEK_HOLE implementation, because vfs_setpos() converts
the carefully prepared -ENXIO to -EINVAL.  Other filesystems avoid it in
error cases: do the same in tmpfs.

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Jie Liu <jeff.liu@oracle.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Aug 4, 2013
1 parent 2f85399 commit 387aae6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,8 @@ static loff_t shmem_file_llseek(struct file *file, loff_t offset, int whence)
}
}

offset = vfs_setpos(file, offset, MAX_LFS_FILESIZE);
if (offset >= 0)
offset = vfs_setpos(file, offset, MAX_LFS_FILESIZE);
mutex_unlock(&inode->i_mutex);
return offset;
}
Expand Down

0 comments on commit 387aae6

Please sign in to comment.