Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 40102
b: refs/heads/master
c: 8c34e2d
h: refs/heads/master
v: v3
  • Loading branch information
Jens Axboe authored and Jens Axboe committed Oct 19, 2006
1 parent 7ed85d0 commit 361689c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 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: 01de85e057328ecbef36e108673b1e81059d54c1
refs/heads/master: 8c34e2d63231d4bf4852bac8521883944d770fe3
19 changes: 15 additions & 4 deletions trunk/fs/splice.c
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,10 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out,
ssize_t ret;
int err;

err = remove_suid(out->f_dentry);
if (unlikely(err))
return err;

ret = __splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);
if (ret > 0) {
*ppos += ret;
Expand Down Expand Up @@ -883,21 +887,28 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
loff_t *ppos, size_t len, unsigned int flags)
{
struct address_space *mapping = out->f_mapping;
struct inode *inode = mapping->host;
ssize_t ret;
int err;

err = should_remove_suid(out->f_dentry);
if (unlikely(err)) {
mutex_lock(&inode->i_mutex);
err = __remove_suid(out->f_dentry, err);
mutex_unlock(&inode->i_mutex);
if (err)
return err;
}

ret = splice_from_pipe(pipe, out, ppos, len, flags, pipe_to_file);
if (ret > 0) {
struct inode *inode = mapping->host;

*ppos += ret;

/*
* If file or inode is SYNC and we actually wrote some data,
* sync it.
*/
if (unlikely((out->f_flags & O_SYNC) || IS_SYNC(inode))) {
int err;

mutex_lock(&inode->i_mutex);
err = generic_osync_inode(inode, mapping,
OSYNC_METADATA|OSYNC_DATA);
Expand Down

0 comments on commit 361689c

Please sign in to comment.