summaryrefslogtreecommitdiffstats
path: root/fs/inode.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-06-11 08:34:36 +0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-06-29 12:57:11 +0400
commitf4e0c30c191f87851c4a53454abb55ee276f4a7e (patch)
tree8bdb4f81dea303f93f1d646034653c8af3fba323 /fs/inode.c
parent60545d0d4610b02e55f65d141c95b18ccf855b6e (diff)
downloadlinux-stable-f4e0c30c191f87851c4a53454abb55ee276f4a7e.tar.gz
linux-stable-f4e0c30c191f87851c4a53454abb55ee276f4a7e.tar.bz2
linux-stable-f4e0c30c191f87851c4a53454abb55ee276f4a7e.zip
allow the temp files created by open() to be linked to
O_TMPFILE | O_CREAT => linkat() with AT_SYMLINK_FOLLOW and /proc/self/fd/<n> as oldpath (i.e. flink()) will create a link O_TMPFILE | O_CREAT | O_EXCL => ENOENT on attempt to link those guys Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/inode.c')
-rw-r--r--fs/inode.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/inode.c b/fs/inode.c
index 00d5fc3b86e1..d6dfb09c8280 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -333,8 +333,10 @@ EXPORT_SYMBOL(set_nlink);
*/
void inc_nlink(struct inode *inode)
{
- if (WARN_ON(inode->i_nlink == 0))
+ if (unlikely(inode->i_nlink == 0)) {
+ WARN_ON(!(inode->i_state & I_LINKABLE));
atomic_long_dec(&inode->i_sb->s_remove_count);
+ }
inode->__i_nlink++;
}