summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-01-09 01:50:23 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-09 02:19:30 +0100
commit0ce8c0109f548ed75535d96ec5a347b410ed1472 (patch)
treec82c28de75da5b73c224cce18602d1a5680d27d7 /fs
parentexofs: oops after late failure in mount (diff)
downloadlinux-0ce8c0109f548ed75535d96ec5a347b410ed1472.tar.xz
linux-0ce8c0109f548ed75535d96ec5a347b410ed1472.zip
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: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext3/namei.c2
-rw-r--r--fs/ext4/namei.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 4f35b2f315d4..d269821203fd 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -2272,7 +2272,7 @@ retry:
err = PTR_ERR(handle);
goto err_drop_inode;
}
- inc_nlink(inode);
+ set_nlink(inode, 1);
err = ext3_orphan_del(handle, inode);
if (err) {
ext3_journal_stop(handle);
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 86edc45b52a4..2043f482375d 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2315,7 +2315,7 @@ retry:
err = PTR_ERR(handle);
goto err_drop_inode;
}
- inc_nlink(inode);
+ set_nlink(inode, 1);
err = ext4_orphan_del(handle, inode);
if (err) {
ext4_journal_stop(handle);