diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2010-06-03 08:09:12 +0100 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-06-03 08:22:04 +0100 |
commit | e72e6497e74811e01d72b4c1b7537b3aea3ee857 (patch) | |
tree | d78dec67d0aaeea807e5ab32141802620ec7ae41 /fs/jffs2/fs.c | |
parent | f324e4cb2cadd9a42932c8a158e761ae31b88e72 (diff) |
jffs2: Fix NFS race by using insert_inode_locked()
New inodes need to be locked as we're creating them, so they don't get used
by other things (like NFSd) before they're ready.
Pointed out by Al Viro.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'fs/jffs2/fs.c')
-rw-r--r-- | fs/jffs2/fs.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 86e0821fc989..26037e2d6154 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c @@ -465,7 +465,12 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i inode->i_blocks = 0; inode->i_size = 0; - insert_inode_hash(inode); + if (insert_inode_locked(inode) < 0) { + make_bad_inode(inode); + unlock_new_inode(inode); + iput(inode); + return ERR_PTR(-EINVAL); + } return inode; } |