diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
commit | 62b8c978ee6b8d135d9e7953221de58000dba986 (patch) | |
tree | 683b04b2e627f6710c22c151b23c8cc9a165315e /fs/pipe.c | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'fs/pipe.c')
-rw-r--r-- | fs/pipe.c | 39 |
1 files changed, 20 insertions, 19 deletions
@@ -726,25 +726,11 @@ pipe_poll(struct file *filp, poll_table *wait) return mask; } -static void put_pipe_info(struct inode *inode, struct pipe_inode_info *pipe) -{ - int kill = 0; - - spin_lock(&inode->i_lock); - if (!--pipe->files) { - inode->i_pipe = NULL; - kill = 1; - } - spin_unlock(&inode->i_lock); - - if (kill) - free_pipe_info(pipe); -} - static int pipe_release(struct inode *inode, struct file *file) { - struct pipe_inode_info *pipe = file->private_data; + struct pipe_inode_info *pipe = inode->i_pipe; + int kill = 0; __pipe_lock(pipe); if (file->f_mode & FMODE_READ) @@ -757,9 +743,17 @@ pipe_release(struct inode *inode, struct file *file) kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); } + spin_lock(&inode->i_lock); + if (!--pipe->files) { + inode->i_pipe = NULL; + kill = 1; + } + spin_unlock(&inode->i_lock); __pipe_unlock(pipe); - put_pipe_info(inode, pipe); + if (kill) + free_pipe_info(pipe); + return 0; } @@ -1020,6 +1014,7 @@ static int fifo_open(struct inode *inode, struct file *filp) { struct pipe_inode_info *pipe; bool is_pipe = inode->i_sb->s_magic == PIPEFS_MAGIC; + int kill = 0; int ret; filp->f_version = 0; @@ -1135,9 +1130,15 @@ err_wr: goto err; err: + spin_lock(&inode->i_lock); + if (!--pipe->files) { + inode->i_pipe = NULL; + kill = 1; + } + spin_unlock(&inode->i_lock); __pipe_unlock(pipe); - - put_pipe_info(inode, pipe); + if (kill) + free_pipe_info(pipe); return ret; } |