summaryrefslogtreecommitdiff
path: root/fs/pipe.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
committerScott Wood <scottwood@freescale.com>2014-04-07 23:49:35 (GMT)
commit62b8c978ee6b8d135d9e7953221de58000dba986 (patch)
tree683b04b2e627f6710c22c151b23c8cc9a165315e /fs/pipe.c
parent78fd82238d0e5716578c326404184a27ba67fd6e (diff)
downloadlinux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'fs/pipe.c')
-rw-r--r--fs/pipe.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/fs/pipe.c b/fs/pipe.c
index 0e0752e..d2c45e1 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -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;
}