fs/pipe.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/pipe.c b/fs/pipe.c index d2c45e14e6d8..18f1a4b2dbbc 100644 --- a/fs/pipe.c +++ b/fs/pipe.c @@ -743,13 +743,14 @@ pipe_release(struct inode *inode, struct file *file) kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); } + __pipe_unlock(pipe); + spin_lock(&inode->i_lock); if (!--pipe->files) { inode->i_pipe = NULL; kill = 1; } spin_unlock(&inode->i_lock); - __pipe_unlock(pipe); if (kill) free_pipe_info(pipe); @@ -1130,13 +1131,14 @@ err_wr: goto err; err: + __pipe_unlock(pipe); + spin_lock(&inode->i_lock); if (!--pipe->files) { inode->i_pipe = NULL; kill = 1; } spin_unlock(&inode->i_lock); - __pipe_unlock(pipe); if (kill) free_pipe_info(pipe); return ret;