diff options
Diffstat (limited to 'fs/ext2')
-rw-r--r-- | fs/ext2/ialloc.c | 6 | ||||
-rw-r--r-- | fs/ext2/inode.c | 7 | ||||
-rw-r--r-- | fs/ext2/namei.c | 15 |
3 files changed, 24 insertions, 4 deletions
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index 8d0add625870..c454d5db28a5 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c | |||
@@ -585,7 +585,10 @@ got: | |||
585 | spin_lock(&sbi->s_next_gen_lock); | 585 | spin_lock(&sbi->s_next_gen_lock); |
586 | inode->i_generation = sbi->s_next_generation++; | 586 | inode->i_generation = sbi->s_next_generation++; |
587 | spin_unlock(&sbi->s_next_gen_lock); | 587 | spin_unlock(&sbi->s_next_gen_lock); |
588 | insert_inode_hash(inode); | 588 | if (insert_inode_locked(inode) < 0) { |
589 | err = -EINVAL; | ||
590 | goto fail_drop; | ||
591 | } | ||
589 | 592 | ||
590 | if (DQUOT_ALLOC_INODE(inode)) { | 593 | if (DQUOT_ALLOC_INODE(inode)) { |
591 | err = -EDQUOT; | 594 | err = -EDQUOT; |
@@ -612,6 +615,7 @@ fail_drop: | |||
612 | DQUOT_DROP(inode); | 615 | DQUOT_DROP(inode); |
613 | inode->i_flags |= S_NOQUOTA; | 616 | inode->i_flags |= S_NOQUOTA; |
614 | inode->i_nlink = 0; | 617 | inode->i_nlink = 0; |
618 | unlock_new_inode(inode); | ||
615 | iput(inode); | 619 | iput(inode); |
616 | return ERR_PTR(err); | 620 | return ERR_PTR(err); |
617 | 621 | ||
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 7658b33e2653..02b39a5deb74 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/buffer_head.h> | 32 | #include <linux/buffer_head.h> |
33 | #include <linux/mpage.h> | 33 | #include <linux/mpage.h> |
34 | #include <linux/fiemap.h> | 34 | #include <linux/fiemap.h> |
35 | #include <linux/namei.h> | ||
35 | #include "ext2.h" | 36 | #include "ext2.h" |
36 | #include "acl.h" | 37 | #include "acl.h" |
37 | #include "xip.h" | 38 | #include "xip.h" |
@@ -1286,9 +1287,11 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino) | |||
1286 | else | 1287 | else |
1287 | inode->i_mapping->a_ops = &ext2_aops; | 1288 | inode->i_mapping->a_ops = &ext2_aops; |
1288 | } else if (S_ISLNK(inode->i_mode)) { | 1289 | } else if (S_ISLNK(inode->i_mode)) { |
1289 | if (ext2_inode_is_fast_symlink(inode)) | 1290 | if (ext2_inode_is_fast_symlink(inode)) { |
1290 | inode->i_op = &ext2_fast_symlink_inode_operations; | 1291 | inode->i_op = &ext2_fast_symlink_inode_operations; |
1291 | else { | 1292 | nd_terminate_link(ei->i_data, inode->i_size, |
1293 | sizeof(ei->i_data) - 1); | ||
1294 | } else { | ||
1292 | inode->i_op = &ext2_symlink_inode_operations; | 1295 | inode->i_op = &ext2_symlink_inode_operations; |
1293 | if (test_opt(inode->i_sb, NOBH)) | 1296 | if (test_opt(inode->i_sb, NOBH)) |
1294 | inode->i_mapping->a_ops = &ext2_nobh_aops; | 1297 | inode->i_mapping->a_ops = &ext2_nobh_aops; |
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index 2a747252ec12..90ea17998a73 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
@@ -41,9 +41,11 @@ static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode) | |||
41 | int err = ext2_add_link(dentry, inode); | 41 | int err = ext2_add_link(dentry, inode); |
42 | if (!err) { | 42 | if (!err) { |
43 | d_instantiate(dentry, inode); | 43 | d_instantiate(dentry, inode); |
44 | unlock_new_inode(inode); | ||
44 | return 0; | 45 | return 0; |
45 | } | 46 | } |
46 | inode_dec_link_count(inode); | 47 | inode_dec_link_count(inode); |
48 | unlock_new_inode(inode); | ||
47 | iput(inode); | 49 | iput(inode); |
48 | return err; | 50 | return err; |
49 | } | 51 | } |
@@ -170,6 +172,7 @@ out: | |||
170 | 172 | ||
171 | out_fail: | 173 | out_fail: |
172 | inode_dec_link_count(inode); | 174 | inode_dec_link_count(inode); |
175 | unlock_new_inode(inode); | ||
173 | iput (inode); | 176 | iput (inode); |
174 | goto out; | 177 | goto out; |
175 | } | 178 | } |
@@ -178,6 +181,7 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir, | |||
178 | struct dentry *dentry) | 181 | struct dentry *dentry) |
179 | { | 182 | { |
180 | struct inode *inode = old_dentry->d_inode; | 183 | struct inode *inode = old_dentry->d_inode; |
184 | int err; | ||
181 | 185 | ||
182 | if (inode->i_nlink >= EXT2_LINK_MAX) | 186 | if (inode->i_nlink >= EXT2_LINK_MAX) |
183 | return -EMLINK; | 187 | return -EMLINK; |
@@ -186,7 +190,14 @@ static int ext2_link (struct dentry * old_dentry, struct inode * dir, | |||
186 | inode_inc_link_count(inode); | 190 | inode_inc_link_count(inode); |
187 | atomic_inc(&inode->i_count); | 191 | atomic_inc(&inode->i_count); |
188 | 192 | ||
189 | return ext2_add_nondir(dentry, inode); | 193 | err = ext2_add_link(dentry, inode); |
194 | if (!err) { | ||
195 | d_instantiate(dentry, inode); | ||
196 | return 0; | ||
197 | } | ||
198 | inode_dec_link_count(inode); | ||
199 | iput(inode); | ||
200 | return err; | ||
190 | } | 201 | } |
191 | 202 | ||
192 | static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode) | 203 | static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode) |
@@ -222,12 +233,14 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, int mode) | |||
222 | goto out_fail; | 233 | goto out_fail; |
223 | 234 | ||
224 | d_instantiate(dentry, inode); | 235 | d_instantiate(dentry, inode); |
236 | unlock_new_inode(inode); | ||
225 | out: | 237 | out: |
226 | return err; | 238 | return err; |
227 | 239 | ||
228 | out_fail: | 240 | out_fail: |
229 | inode_dec_link_count(inode); | 241 | inode_dec_link_count(inode); |
230 | inode_dec_link_count(inode); | 242 | inode_dec_link_count(inode); |
243 | unlock_new_inode(inode); | ||
231 | iput(inode); | 244 | iput(inode); |
232 | out_dir: | 245 | out_dir: |
233 | inode_dec_link_count(dir); | 246 | inode_dec_link_count(dir); |