Commit 0ce8c010 authored by Al Viro's avatar Al Viro

ext[34]: avoid i_nlink warnings triggered by drop_nlink/inc_nlink kludge in symlink()

Both ext3 and ext4 put the half-created symlink inode into the orphan list
for a while (see the comment in ext[34]_symlink() for gory details).  Then,
if everything went fine, they pull it out of the orphan list and bump the
link count back to 1.  The thing is, inc_nlink() is going to complain about
seeing somebody changing i_nlink from 0 to 1.  With a good reason, since
normally something like that is a bug.  Explicit set_nlink(inode, 1) does
the same thing as inc_nlink() here, but it does *not* complain - exactly
because it should be usable in strange situations like this one.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent da01636a
...@@ -2272,7 +2272,7 @@ static int ext3_symlink (struct inode * dir, ...@@ -2272,7 +2272,7 @@ static int ext3_symlink (struct inode * dir,
err = PTR_ERR(handle); err = PTR_ERR(handle);
goto err_drop_inode; goto err_drop_inode;
} }
inc_nlink(inode); set_nlink(inode, 1);
err = ext3_orphan_del(handle, inode); err = ext3_orphan_del(handle, inode);
if (err) { if (err) {
ext3_journal_stop(handle); ext3_journal_stop(handle);
......
...@@ -2315,7 +2315,7 @@ static int ext4_symlink(struct inode *dir, ...@@ -2315,7 +2315,7 @@ static int ext4_symlink(struct inode *dir,
err = PTR_ERR(handle); err = PTR_ERR(handle);
goto err_drop_inode; goto err_drop_inode;
} }
inc_nlink(inode); set_nlink(inode, 1);
err = ext4_orphan_del(handle, inode); err = ext4_orphan_del(handle, inode);
if (err) { if (err) {
ext4_journal_stop(handle); ext4_journal_stop(handle);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment