diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-09-27 05:17:52 +0400 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2018-10-21 10:46:02 +0300 |
commit | 8a5ba77a3220fbb04f79ee874fdfea6aa81db1a2 (patch) | |
tree | 1c900b4858a17ec863334d8d2a43e787cb6835b9 | |
parent | a04784d0aea523e9e288ba9ba1077057e5f6a0ef (diff) | |
download | linux-8a5ba77a3220fbb04f79ee874fdfea6aa81db1a2.tar.xz |
ufs: deal with nfsd/iget races
commit e4502c63f56aeca887ced37f24e0def1ef11cec8 upstream.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | fs/ufs/ialloc.c | 6 | ||||
-rw-r--r-- | fs/ufs/namei.c | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index 758ab7c305a4..fd0203ce1f7f 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c @@ -298,7 +298,10 @@ cg_found: ufsi->i_oeftflag = 0; ufsi->i_dir_start_lookup = 0; memset(&ufsi->i_u1, 0, sizeof(ufsi->i_u1)); - insert_inode_hash(inode); + if (insert_inode_locked(inode) < 0) { + err = -EIO; + goto failed; + } mark_inode_dirty(inode); if (uspi->fs_magic == UFS2_MAGIC) { @@ -337,6 +340,7 @@ cg_found: fail_remove_inode: mutex_unlock(&sbi->s_lock); clear_nlink(inode); + unlock_new_inode(inode); iput(inode); UFSD("EXIT (FAILED): err %d\n", err); return ERR_PTR(err); diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index 90d74b8f8eba..65158994af19 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c @@ -38,10 +38,12 @@ static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) { int err = ufs_add_link(dentry, inode); if (!err) { + unlock_new_inode(inode); d_instantiate(dentry, inode); return 0; } inode_dec_link_count(inode); + unlock_new_inode(inode); iput(inode); return err; } @@ -155,6 +157,7 @@ out_notlocked: out_fail: inode_dec_link_count(inode); + unlock_new_inode(inode); iput(inode); goto out; } @@ -211,6 +214,7 @@ out: out_fail: inode_dec_link_count(inode); inode_dec_link_count(inode); + unlock_new_inode(inode); iput (inode); out_dir: inode_dec_link_count(dir); |