From 08fce28a68d6f93f6e31cceaf358811e962d89da Mon Sep 17 00:00:00 2001 From: Jeff Liu Date: Sun, 18 Sep 2011 10:34:02 -0400 Subject: [PATCH] --- yaml --- r: 263982 b: refs/heads/master c: 48802c8ae2a9d618ec734a61283d645ad527e06c h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/btrfs/file.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index d903c1859201..9b4f67520089 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2cf4ce7c2a07782c3f4d899b380a78522bca3238 +refs/heads/master: 48802c8ae2a9d618ec734a61283d645ad527e06c diff --git a/trunk/fs/btrfs/file.c b/trunk/fs/btrfs/file.c index 3c3abff731a7..a381cd22f518 100644 --- a/trunk/fs/btrfs/file.c +++ b/trunk/fs/btrfs/file.c @@ -1817,6 +1817,11 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin) goto out; case SEEK_DATA: case SEEK_HOLE: + if (offset >= i_size_read(inode)) { + mutex_unlock(&inode->i_mutex); + return -ENXIO; + } + ret = find_desired_extent(inode, &offset, origin); if (ret) { mutex_unlock(&inode->i_mutex); @@ -1825,11 +1830,11 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin) } if (offset < 0 && !(file->f_mode & FMODE_UNSIGNED_OFFSET)) { - ret = -EINVAL; + offset = -EINVAL; goto out; } if (offset > inode->i_sb->s_maxbytes) { - ret = -EINVAL; + offset = -EINVAL; goto out; }