aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/hfsplus/dir.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 7efcf75ea73a..f8ae468f4ab6 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -364,31 +364,29 @@ static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
364static int hfsplus_symlink(struct inode *dir, struct dentry *dentry, 364static int hfsplus_symlink(struct inode *dir, struct dentry *dentry,
365 const char *symname) 365 const char *symname)
366{ 366{
367 struct super_block *sb;
368 struct inode *inode; 367 struct inode *inode;
369 int res; 368 int res;
370 369
371 sb = dir->i_sb; 370 inode = hfsplus_new_inode(dir->i_sb, S_IFLNK | S_IRWXUGO);
372 inode = hfsplus_new_inode(sb, S_IFLNK | S_IRWXUGO);
373 if (!inode) 371 if (!inode)
374 return -ENOSPC; 372 return -ENOSPC;
375 373
376 res = page_symlink(inode, symname, strlen(symname) + 1); 374 res = page_symlink(inode, symname, strlen(symname) + 1);
377 if (res) { 375 if (res)
378 inode->i_nlink = 0; 376 goto out_err;
379 hfsplus_delete_inode(inode);
380 iput(inode);
381 return res;
382 }
383 377
384 mark_inode_dirty(inode);
385 res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode); 378 res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode);
379 if (res)
380 goto out_err;
386 381
387 if (!res) { 382 hfsplus_instantiate(dentry, inode, inode->i_ino);
388 hfsplus_instantiate(dentry, inode, inode->i_ino); 383 mark_inode_dirty(inode);
389 mark_inode_dirty(inode); 384 return 0;
390 }
391 385
386out_err:
387 inode->i_nlink = 0;
388 hfsplus_delete_inode(inode);
389 iput(inode);
392 return res; 390 return res;
393} 391}
394 392