diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fuse/file.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 2d3649e42599..9ced35b00686 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -1431,8 +1431,33 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block) | |||
1431 | return err ? 0 : outarg.block; | 1431 | return err ? 0 : outarg.block; |
1432 | } | 1432 | } |
1433 | 1433 | ||
1434 | static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin) | ||
1435 | { | ||
1436 | loff_t retval; | ||
1437 | struct inode *inode = file->f_path.dentry->d_inode; | ||
1438 | |||
1439 | mutex_lock(&inode->i_mutex); | ||
1440 | switch (origin) { | ||
1441 | case SEEK_END: | ||
1442 | offset += i_size_read(inode); | ||
1443 | break; | ||
1444 | case SEEK_CUR: | ||
1445 | offset += file->f_pos; | ||
1446 | } | ||
1447 | retval = -EINVAL; | ||
1448 | if (offset >= 0 && offset <= inode->i_sb->s_maxbytes) { | ||
1449 | if (offset != file->f_pos) { | ||
1450 | file->f_pos = offset; | ||
1451 | file->f_version = 0; | ||
1452 | } | ||
1453 | retval = offset; | ||
1454 | } | ||
1455 | mutex_unlock(&inode->i_mutex); | ||
1456 | return retval; | ||
1457 | } | ||
1458 | |||
1434 | static const struct file_operations fuse_file_operations = { | 1459 | static const struct file_operations fuse_file_operations = { |
1435 | .llseek = generic_file_llseek, | 1460 | .llseek = fuse_file_llseek, |
1436 | .read = do_sync_read, | 1461 | .read = do_sync_read, |
1437 | .aio_read = fuse_file_aio_read, | 1462 | .aio_read = fuse_file_aio_read, |
1438 | .write = do_sync_write, | 1463 | .write = do_sync_write, |
@@ -1448,7 +1473,7 @@ static const struct file_operations fuse_file_operations = { | |||
1448 | }; | 1473 | }; |
1449 | 1474 | ||
1450 | static const struct file_operations fuse_direct_io_file_operations = { | 1475 | static const struct file_operations fuse_direct_io_file_operations = { |
1451 | .llseek = generic_file_llseek, | 1476 | .llseek = fuse_file_llseek, |
1452 | .read = fuse_direct_read, | 1477 | .read = fuse_direct_read, |
1453 | .write = fuse_direct_write, | 1478 | .write = fuse_direct_write, |
1454 | .open = fuse_open, | 1479 | .open = fuse_open, |