Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147948
b: refs/heads/master
c: d09cb9d
h: refs/heads/master
v: v3
  • Loading branch information
Miklos Szeredi committed Apr 28, 2009
1 parent 48f65e6 commit 7de4d1d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2d698b070382442f817813b9dd0103034e5bca81
refs/heads/master: d09cb9d7f6e4cb1dd0cf12ee0d352440291c74cf
33 changes: 23 additions & 10 deletions trunk/fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,9 +993,6 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
ssize_t res = 0;
struct fuse_req *req;

if (is_bad_inode(inode))
return -EIO;

req = fuse_get_req(fc);
if (IS_ERR(req))
return PTR_ERR(req);
Expand Down Expand Up @@ -1038,33 +1035,49 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
}
}
fuse_put_request(fc, req);
if (res > 0) {
if (write)
fuse_write_update_size(inode, pos);
if (res > 0)
*ppos = pos;
}
fuse_invalidate_attr(inode);

return res;
}

static ssize_t fuse_direct_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
return fuse_direct_io(file, buf, count, ppos, 0);
ssize_t res;
struct inode *inode = file->f_path.dentry->d_inode;

if (is_bad_inode(inode))
return -EIO;

res = fuse_direct_io(file, buf, count, ppos, 0);

fuse_invalidate_attr(inode);

return res;
}

static ssize_t fuse_direct_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct inode *inode = file->f_path.dentry->d_inode;
ssize_t res;

if (is_bad_inode(inode))
return -EIO;

/* Don't allow parallel writes to the same file */
mutex_lock(&inode->i_mutex);
res = generic_write_checks(file, ppos, &count, 0);
if (!res)
if (!res) {
res = fuse_direct_io(file, buf, count, ppos, 1);
if (res > 0)
fuse_write_update_size(inode, *ppos);
}
mutex_unlock(&inode->i_mutex);

fuse_invalidate_attr(inode);

return res;
}

Expand Down

0 comments on commit 7de4d1d

Please sign in to comment.