Commit 30aaca45 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
  fuse: llseek fix race
  fuse: fix llseek bug
  fuse: fix fuse_retrieve
parents ddb36077 73104b6e
...@@ -1512,7 +1512,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, ...@@ -1512,7 +1512,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
else if (outarg->offset + num > file_size) else if (outarg->offset + num > file_size)
num = file_size - outarg->offset; num = file_size - outarg->offset;
while (num) { while (num && req->num_pages < FUSE_MAX_PAGES_PER_REQ) {
struct page *page; struct page *page;
unsigned int this_num; unsigned int this_num;
...@@ -1526,6 +1526,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, ...@@ -1526,6 +1526,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
num -= this_num; num -= this_num;
total_len += this_num; total_len += this_num;
index++;
} }
req->misc.retrieve_in.offset = outarg->offset; req->misc.retrieve_in.offset = outarg->offset;
req->misc.retrieve_in.size = total_len; req->misc.retrieve_in.size = total_len;
......
...@@ -1556,7 +1556,7 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin) ...@@ -1556,7 +1556,7 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin)
struct inode *inode = file->f_path.dentry->d_inode; struct inode *inode = file->f_path.dentry->d_inode;
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
if (origin != SEEK_CUR || origin != SEEK_SET) { if (origin != SEEK_CUR && origin != SEEK_SET) {
retval = fuse_update_attributes(inode, NULL, file, NULL); retval = fuse_update_attributes(inode, NULL, file, NULL);
if (retval) if (retval)
goto exit; goto exit;
...@@ -1567,6 +1567,10 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin) ...@@ -1567,6 +1567,10 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin)
offset += i_size_read(inode); offset += i_size_read(inode);
break; break;
case SEEK_CUR: case SEEK_CUR:
if (offset == 0) {
retval = file->f_pos;
goto exit;
}
offset += file->f_pos; offset += file->f_pos;
break; break;
case SEEK_DATA: case SEEK_DATA:
......
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