aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c4
-rw-r--r--drivers/usb/core/inode.c4
-rw-r--r--fs/9p/vfs_inode.c2
-rw-r--r--fs/autofs/root.c2
-rw-r--r--fs/autofs4/root.c2
-rw-r--r--fs/bfs/dir.c2
-rw-r--r--fs/cifs/inode.c2
-rw-r--r--fs/coda/dir.c2
-rw-r--r--fs/configfs/dir.c4
-rw-r--r--fs/configfs/mount.c2
-rw-r--r--fs/debugfs/inode.c4
-rw-r--r--fs/ext3/namei.c6
-rw-r--r--fs/fuse/control.c2
-rw-r--r--fs/hfsplus/dir.c2
-rw-r--r--fs/hpfs/namei.c4
-rw-r--r--fs/hugetlbfs/inode.c4
-rw-r--r--fs/jffs2/dir.c6
-rw-r--r--fs/jffs2/fs.c6
-rw-r--r--fs/jfs/namei.c6
-rw-r--r--fs/libfs.c4
-rw-r--r--fs/msdos/namei.c4
-rw-r--r--fs/ocfs2/dlm/dlmfs.c6
-rw-r--r--fs/ocfs2/namei.c8
-rw-r--r--fs/ramfs/inode.c4
-rw-r--r--fs/reiserfs/namei.c6
-rw-r--r--fs/sysfs/dir.c4
-rw-r--r--fs/sysfs/mount.c2
-rw-r--r--fs/udf/inode.c2
-rw-r--r--fs/udf/namei.c6
-rw-r--r--fs/vfat/namei.c4
-rw-r--r--include/linux/fs.h7
-rw-r--r--ipc/mqueue.c2
-rw-r--r--kernel/cpuset.c8
-rw-r--r--mm/shmem.c8
-rw-r--r--net/sunrpc/rpc_pipe.c6
-rw-r--r--security/inode.c4
-rw-r--r--security/selinux/selinuxfs.c4
37 files changed, 80 insertions, 75 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index a507d0b5be6c..d9ff283f725e 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -66,8 +66,8 @@ static int ipathfs_mknod(struct inode *dir, struct dentry *dentry,
66 inode->i_private = data; 66 inode->i_private = data;
67 if ((mode & S_IFMT) == S_IFDIR) { 67 if ((mode & S_IFMT) == S_IFDIR) {
68 inode->i_op = &simple_dir_inode_operations; 68 inode->i_op = &simple_dir_inode_operations;
69 inode->i_nlink++; 69 inc_nlink(inode);
70 dir->i_nlink++; 70 inc_nlink(dir);
71 } 71 }
72 72
73 inode->i_fop = fops; 73 inode->i_fop = fops;
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 88002e45a6b4..7c77c2d8d300 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -263,7 +263,7 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de
263 inode->i_fop = &simple_dir_operations; 263 inode->i_fop = &simple_dir_operations;
264 264
265 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 265 /* directory inodes start off with i_nlink == 2 (for "." entry) */
266 inode->i_nlink++; 266 inc_nlink(inode);
267 break; 267 break;
268 } 268 }
269 } 269 }
@@ -295,7 +295,7 @@ static int usbfs_mkdir (struct inode *dir, struct dentry *dentry, int mode)
295 mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR; 295 mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
296 res = usbfs_mknod (dir, dentry, mode, 0); 296 res = usbfs_mknod (dir, dentry, mode, 0);
297 if (!res) 297 if (!res)
298 dir->i_nlink++; 298 inc_nlink(dir);
299 return res; 299 return res;
300} 300}
301 301
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 7a7ec2d1d2f4..5241c600ce28 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -233,7 +233,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
233 inode->i_op = &v9fs_symlink_inode_operations; 233 inode->i_op = &v9fs_symlink_inode_operations;
234 break; 234 break;
235 case S_IFDIR: 235 case S_IFDIR:
236 inode->i_nlink++; 236 inc_nlink(inode);
237 if(v9ses->extended) 237 if(v9ses->extended)
238 inode->i_op = &v9fs_dir_inode_operations_ext; 238 inode->i_op = &v9fs_dir_inode_operations_ext;
239 else 239 else
diff --git a/fs/autofs/root.c b/fs/autofs/root.c
index 54ad70731927..368a1c33a3c8 100644
--- a/fs/autofs/root.c
+++ b/fs/autofs/root.c
@@ -466,7 +466,7 @@ static int autofs_root_mkdir(struct inode *dir, struct dentry *dentry, int mode)
466 ent->dentry = dentry; 466 ent->dentry = dentry;
467 autofs_hash_insert(dh,ent); 467 autofs_hash_insert(dh,ent);
468 468
469 dir->i_nlink++; 469 inc_nlink(dir);
470 d_instantiate(dentry, iget(dir->i_sb,ino)); 470 d_instantiate(dentry, iget(dir->i_sb,ino));
471 unlock_kernel(); 471 unlock_kernel();
472 472
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index 348bec0982b0..e21bb4668201 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -713,7 +713,7 @@ static int autofs4_dir_mkdir(struct inode *dir, struct dentry *dentry, int mode)
713 if (p_ino && dentry->d_parent != dentry) 713 if (p_ino && dentry->d_parent != dentry)
714 atomic_inc(&p_ino->count); 714 atomic_inc(&p_ino->count);
715 ino->inode = inode; 715 ino->inode = inode;
716 dir->i_nlink++; 716 inc_nlink(dir);
717 dir->i_mtime = CURRENT_TIME; 717 dir->i_mtime = CURRENT_TIME;
718 718
719 return 0; 719 return 0;
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index ce05d1643dd1..a650f1d0b85e 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -163,7 +163,7 @@ static int bfs_link(struct dentry * old, struct inode * dir, struct dentry * new
163 unlock_kernel(); 163 unlock_kernel();
164 return err; 164 return err;
165 } 165 }
166 inode->i_nlink++; 166 inc_nlink(inode);
167 inode->i_ctime = CURRENT_TIME_SEC; 167 inode->i_ctime = CURRENT_TIME_SEC;
168 mark_inode_dirty(inode); 168 mark_inode_dirty(inode);
169 atomic_inc(&inode->i_count); 169 atomic_inc(&inode->i_count);
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 74441a17e186..76b7fb34101a 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -735,7 +735,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
735 cFYI(1, ("cifs_mkdir returned 0x%x", rc)); 735 cFYI(1, ("cifs_mkdir returned 0x%x", rc));
736 d_drop(direntry); 736 d_drop(direntry);
737 } else { 737 } else {
738 inode->i_nlink++; 738 inc_nlink(inode);
739 if (pTcon->ses->capabilities & CAP_UNIX) 739 if (pTcon->ses->capabilities & CAP_UNIX)
740 rc = cifs_get_inode_info_unix(&newinode, full_path, 740 rc = cifs_get_inode_info_unix(&newinode, full_path,
741 inode->i_sb,xid); 741 inode->i_sb,xid);
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 0a2fd8bb7579..0102b28a15fb 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -304,7 +304,7 @@ static int coda_link(struct dentry *source_de, struct inode *dir_inode,
304 coda_dir_changed(dir_inode, 0); 304 coda_dir_changed(dir_inode, 0);
305 atomic_inc(&inode->i_count); 305 atomic_inc(&inode->i_count);
306 d_instantiate(de, inode); 306 d_instantiate(de, inode);
307 inode->i_nlink++; 307 inc_nlink(inode);
308 308
309out: 309out:
310 unlock_kernel(); 310 unlock_kernel();
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 816e8ef64560..8a3b6a1a6ad1 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -139,7 +139,7 @@ static int init_dir(struct inode * inode)
139 inode->i_fop = &configfs_dir_operations; 139 inode->i_fop = &configfs_dir_operations;
140 140
141 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 141 /* directory inodes start off with i_nlink == 2 (for "." entry) */
142 inode->i_nlink++; 142 inc_nlink(inode);
143 return 0; 143 return 0;
144} 144}
145 145
@@ -169,7 +169,7 @@ static int create_dir(struct config_item * k, struct dentry * p,
169 if (!error) { 169 if (!error) {
170 error = configfs_create(d, mode, init_dir); 170 error = configfs_create(d, mode, init_dir);
171 if (!error) { 171 if (!error) {
172 p->d_inode->i_nlink++; 172 inc_nlink(p->d_inode);
173 (d)->d_op = &configfs_dentry_ops; 173 (d)->d_op = &configfs_dentry_ops;
174 } else { 174 } else {
175 struct configfs_dirent *sd = d->d_fsdata; 175 struct configfs_dirent *sd = d->d_fsdata;
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 3e5fe843e1df..68bd5c93ca52 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -84,7 +84,7 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent)
84 inode->i_op = &configfs_dir_inode_operations; 84 inode->i_op = &configfs_dir_inode_operations;
85 inode->i_fop = &configfs_dir_operations; 85 inode->i_fop = &configfs_dir_operations;
86 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 86 /* directory inodes start off with i_nlink == 2 (for "." entry) */
87 inode->i_nlink++; 87 inc_nlink(inode);
88 } else { 88 } else {
89 pr_debug("configfs: could not get root inode\n"); 89 pr_debug("configfs: could not get root inode\n");
90 return -ENOMEM; 90 return -ENOMEM;
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 269e649e6dc6..ecf3da9edf21 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -54,7 +54,7 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
54 inode->i_fop = &simple_dir_operations; 54 inode->i_fop = &simple_dir_operations;
55 55
56 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 56 /* directory inodes start off with i_nlink == 2 (for "." entry) */
57 inode->i_nlink++; 57 inc_nlink(inode);
58 break; 58 break;
59 } 59 }
60 } 60 }
@@ -87,7 +87,7 @@ static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
87 mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR; 87 mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
88 res = debugfs_mknod(dir, dentry, mode, 0); 88 res = debugfs_mknod(dir, dentry, mode, 0);
89 if (!res) 89 if (!res)
90 dir->i_nlink++; 90 inc_nlink(dir);
91 return res; 91 return res;
92} 92}
93 93
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 14c55adfae83..b45c88bd5f73 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1616,7 +1616,7 @@ static int ext3_delete_entry (handle_t *handle,
1616 */ 1616 */
1617static inline void ext3_inc_count(handle_t *handle, struct inode *inode) 1617static inline void ext3_inc_count(handle_t *handle, struct inode *inode)
1618{ 1618{
1619 inode->i_nlink++; 1619 inc_nlink(inode);
1620} 1620}
1621 1621
1622static inline void ext3_dec_count(handle_t *handle, struct inode *inode) 1622static inline void ext3_dec_count(handle_t *handle, struct inode *inode)
@@ -1775,7 +1775,7 @@ retry:
1775 iput (inode); 1775 iput (inode);
1776 goto out_stop; 1776 goto out_stop;
1777 } 1777 }
1778 dir->i_nlink++; 1778 inc_nlink(dir);
1779 ext3_update_dx_flag(dir); 1779 ext3_update_dx_flag(dir);
1780 ext3_mark_inode_dirty(handle, dir); 1780 ext3_mark_inode_dirty(handle, dir);
1781 d_instantiate(dentry, inode); 1781 d_instantiate(dentry, inode);
@@ -2341,7 +2341,7 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry,
2341 if (new_inode) { 2341 if (new_inode) {
2342 drop_nlink(new_inode); 2342 drop_nlink(new_inode);
2343 } else { 2343 } else {
2344 new_dir->i_nlink++; 2344 inc_nlink(new_dir);
2345 ext3_update_dx_flag(new_dir); 2345 ext3_update_dx_flag(new_dir);
2346 ext3_mark_inode_dirty(handle, new_dir); 2346 ext3_mark_inode_dirty(handle, new_dir);
2347 } 2347 }
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 79ec1f23d4d2..16b39c053d47 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -116,7 +116,7 @@ int fuse_ctl_add_conn(struct fuse_conn *fc)
116 return 0; 116 return 0;
117 117
118 parent = fuse_control_sb->s_root; 118 parent = fuse_control_sb->s_root;
119 parent->d_inode->i_nlink++; 119 inc_nlink(parent->d_inode);
120 sprintf(name, "%llu", (unsigned long long) fc->id); 120 sprintf(name, "%llu", (unsigned long long) fc->id);
121 parent = fuse_ctl_add_dentry(parent, fc, name, S_IFDIR | 0500, 2, 121 parent = fuse_ctl_add_dentry(parent, fc, name, S_IFDIR | 0500, 2,
122 &simple_dir_inode_operations, 122 &simple_dir_inode_operations,
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 9ceb0dfaa1cc..99b4ed1b87d2 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -298,7 +298,7 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
298 if (res) 298 if (res)
299 return res; 299 return res;
300 300
301 inode->i_nlink++; 301 inc_nlink(inode);
302 hfsplus_instantiate(dst_dentry, inode, cnid); 302 hfsplus_instantiate(dst_dentry, inode, cnid);
303 atomic_inc(&inode->i_count); 303 atomic_inc(&inode->i_count);
304 inode->i_ctime = CURRENT_TIME_SEC; 304 inode->i_ctime = CURRENT_TIME_SEC;
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index 4078b0becc5e..25dd6f81eca7 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -89,7 +89,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
89 brelse(bh); 89 brelse(bh);
90 hpfs_mark_4buffers_dirty(&qbh0); 90 hpfs_mark_4buffers_dirty(&qbh0);
91 hpfs_brelse4(&qbh0); 91 hpfs_brelse4(&qbh0);
92 dir->i_nlink++; 92 inc_nlink(dir);
93 insert_inode_hash(result); 93 insert_inode_hash(result);
94 94
95 if (result->i_uid != current->fsuid || 95 if (result->i_uid != current->fsuid ||
@@ -635,7 +635,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
635 end: 635 end:
636 hpfs_i(i)->i_parent_dir = new_dir->i_ino; 636 hpfs_i(i)->i_parent_dir = new_dir->i_ino;
637 if (S_ISDIR(i->i_mode)) { 637 if (S_ISDIR(i->i_mode)) {
638 new_dir->i_nlink++; 638 inc_nlink(new_dir);
639 drop_nlink(old_dir); 639 drop_nlink(old_dir);
640 } 640 }
641 if ((fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) { 641 if ((fnode = hpfs_map_fnode(i->i_sb, i->i_ino, &bh))) {
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index f5b8f329aca6..5e03b2f67b93 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -377,7 +377,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid,
377 inode->i_fop = &simple_dir_operations; 377 inode->i_fop = &simple_dir_operations;
378 378
379 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 379 /* directory inodes start off with i_nlink == 2 (for "." entry) */
380 inode->i_nlink++; 380 inc_nlink(inode);
381 break; 381 break;
382 case S_IFLNK: 382 case S_IFLNK:
383 inode->i_op = &page_symlink_inode_operations; 383 inode->i_op = &page_symlink_inode_operations;
@@ -418,7 +418,7 @@ static int hugetlbfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
418{ 418{
419 int retval = hugetlbfs_mknod(dir, dentry, mode | S_IFDIR, 0); 419 int retval = hugetlbfs_mknod(dir, dentry, mode | S_IFDIR, 0);
420 if (!retval) 420 if (!retval)
421 dir->i_nlink++; 421 inc_nlink(dir);
422 return retval; 422 return retval;
423} 423}
424 424
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c
index a5e9f2205b33..9def6adf4a5d 100644
--- a/fs/jffs2/dir.c
+++ b/fs/jffs2/dir.c
@@ -588,7 +588,7 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, int mode)
588 } 588 }
589 589
590 dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime)); 590 dir_i->i_mtime = dir_i->i_ctime = ITIME(je32_to_cpu(rd->mctime));
591 dir_i->i_nlink++; 591 inc_nlink(dir_i);
592 592
593 jffs2_free_raw_dirent(rd); 593 jffs2_free_raw_dirent(rd);
594 594
@@ -836,7 +836,7 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
836 /* If it was a directory we moved, and there was no victim, 836 /* If it was a directory we moved, and there was no victim,
837 increase i_nlink on its new parent */ 837 increase i_nlink on its new parent */
838 if (S_ISDIR(old_dentry->d_inode->i_mode) && !victim_f) 838 if (S_ISDIR(old_dentry->d_inode->i_mode) && !victim_f)
839 new_dir_i->i_nlink++; 839 inc_nlink(new_dir_i);
840 840
841 /* Unlink the original */ 841 /* Unlink the original */
842 ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), 842 ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i),
@@ -848,7 +848,7 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
848 /* Oh shit. We really ought to make a single node which can do both atomically */ 848 /* Oh shit. We really ought to make a single node which can do both atomically */
849 struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_dentry->d_inode); 849 struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_dentry->d_inode);
850 down(&f->sem); 850 down(&f->sem);
851 old_dentry->d_inode->i_nlink++; 851 inc_nlink(old_dentry->d_inode);
852 if (f->inocache) 852 if (f->inocache)
853 f->inocache->nlink++; 853 f->inocache->nlink++;
854 up(&f->sem); 854 up(&f->sem);
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 72d9909d95ff..7bc1a4201c0c 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -277,13 +277,13 @@ void jffs2_read_inode (struct inode *inode)
277 277
278 for (fd=f->dents; fd; fd = fd->next) { 278 for (fd=f->dents; fd; fd = fd->next) {
279 if (fd->type == DT_DIR && fd->ino) 279 if (fd->type == DT_DIR && fd->ino)
280 inode->i_nlink++; 280 inc_nlink(inode);
281 } 281 }
282 /* and '..' */ 282 /* and '..' */
283 inode->i_nlink++; 283 inc_nlink(inode);
284 /* Root dir gets i_nlink 3 for some reason */ 284 /* Root dir gets i_nlink 3 for some reason */
285 if (inode->i_ino == 1) 285 if (inode->i_ino == 1)
286 inode->i_nlink++; 286 inc_nlink(inode);
287 287
288 inode->i_op = &jffs2_dir_inode_operations; 288 inode->i_op = &jffs2_dir_inode_operations;
289 inode->i_fop = &jffs2_dir_operations; 289 inode->i_fop = &jffs2_dir_operations;
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 088b85976ac0..8cef88170aa4 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -292,7 +292,7 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, int mode)
292 mark_inode_dirty(ip); 292 mark_inode_dirty(ip);
293 293
294 /* update parent directory inode */ 294 /* update parent directory inode */
295 dip->i_nlink++; /* for '..' from child directory */ 295 inc_nlink(dip); /* for '..' from child directory */
296 dip->i_ctime = dip->i_mtime = CURRENT_TIME; 296 dip->i_ctime = dip->i_mtime = CURRENT_TIME;
297 mark_inode_dirty(dip); 297 mark_inode_dirty(dip);
298 298
@@ -822,7 +822,7 @@ static int jfs_link(struct dentry *old_dentry,
822 goto free_dname; 822 goto free_dname;
823 823
824 /* update object inode */ 824 /* update object inode */
825 ip->i_nlink++; /* for new link */ 825 inc_nlink(ip); /* for new link */
826 ip->i_ctime = CURRENT_TIME; 826 ip->i_ctime = CURRENT_TIME;
827 dir->i_ctime = dir->i_mtime = CURRENT_TIME; 827 dir->i_ctime = dir->i_mtime = CURRENT_TIME;
828 mark_inode_dirty(dir); 828 mark_inode_dirty(dir);
@@ -1206,7 +1206,7 @@ static int jfs_rename(struct inode *old_dir, struct dentry *old_dentry,
1206 goto out4; 1206 goto out4;
1207 } 1207 }
1208 if (S_ISDIR(old_ip->i_mode)) 1208 if (S_ISDIR(old_ip->i_mode))
1209 new_dir->i_nlink++; 1209 inc_nlink(new_dir);
1210 } 1210 }
1211 /* 1211 /*
1212 * Remove old directory entry 1212 * Remove old directory entry
diff --git a/fs/libfs.c b/fs/libfs.c
index 9204feba75ac..bd08e0e64a8c 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -243,7 +243,7 @@ int simple_link(struct dentry *old_dentry, struct inode *dir, struct dentry *den
243 struct inode *inode = old_dentry->d_inode; 243 struct inode *inode = old_dentry->d_inode;
244 244
245 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; 245 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
246 inode->i_nlink++; 246 inc_nlink(inode);
247 atomic_inc(&inode->i_count); 247 atomic_inc(&inode->i_count);
248 dget(dentry); 248 dget(dentry);
249 d_instantiate(dentry, inode); 249 d_instantiate(dentry, inode);
@@ -306,7 +306,7 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry,
306 drop_nlink(old_dir); 306 drop_nlink(old_dir);
307 } else if (they_are_dirs) { 307 } else if (they_are_dirs) {
308 drop_nlink(old_dir); 308 drop_nlink(old_dir);
309 new_dir->i_nlink++; 309 inc_nlink(new_dir);
310 } 310 }
311 311
312 old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime = 312 old_dir->i_ctime = old_dir->i_mtime = new_dir->i_ctime =
diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c
index 635613f2f65a..fa868c755907 100644
--- a/fs/msdos/namei.c
+++ b/fs/msdos/namei.c
@@ -389,7 +389,7 @@ static int msdos_mkdir(struct inode *dir, struct dentry *dentry, int mode)
389 err = msdos_add_entry(dir, msdos_name, 1, is_hid, cluster, &ts, &sinfo); 389 err = msdos_add_entry(dir, msdos_name, 1, is_hid, cluster, &ts, &sinfo);
390 if (err) 390 if (err)
391 goto out_free; 391 goto out_free;
392 dir->i_nlink++; 392 inc_nlink(dir);
393 393
394 inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos); 394 inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
395 brelse(sinfo.bh); 395 brelse(sinfo.bh);
@@ -551,7 +551,7 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
551 } 551 }
552 drop_nlink(old_dir); 552 drop_nlink(old_dir);
553 if (!new_inode) 553 if (!new_inode)
554 new_dir->i_nlink++; 554 inc_nlink(new_dir);
555 } 555 }
556 556
557 err = fat_remove_entries(old_dir, &old_sinfo); /* and releases bh */ 557 err = fat_remove_entries(old_dir, &old_sinfo); /* and releases bh */
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
index 0368c6402182..16b8d1ba7066 100644
--- a/fs/ocfs2/dlm/dlmfs.c
+++ b/fs/ocfs2/dlm/dlmfs.c
@@ -338,7 +338,7 @@ static struct inode *dlmfs_get_root_inode(struct super_block *sb)
338 inode->i_blocks = 0; 338 inode->i_blocks = 0;
339 inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info; 339 inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
340 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 340 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
341 inode->i_nlink++; 341 inc_nlink(inode);
342 342
343 inode->i_fop = &simple_dir_operations; 343 inode->i_fop = &simple_dir_operations;
344 inode->i_op = &dlmfs_root_inode_operations; 344 inode->i_op = &dlmfs_root_inode_operations;
@@ -395,7 +395,7 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
395 395
396 /* directory inodes start off with i_nlink == 396 /* directory inodes start off with i_nlink ==
397 * 2 (for "." entry) */ 397 * 2 (for "." entry) */
398 inode->i_nlink++; 398 inc_nlink(inode);
399 break; 399 break;
400 } 400 }
401 401
@@ -449,7 +449,7 @@ static int dlmfs_mkdir(struct inode * dir,
449 } 449 }
450 ip->ip_dlm = dlm; 450 ip->ip_dlm = dlm;
451 451
452 dir->i_nlink++; 452 inc_nlink(dir);
453 d_instantiate(dentry, inode); 453 d_instantiate(dentry, inode);
454 dget(dentry); /* Extra count - pin the dentry in core */ 454 dget(dentry); /* Extra count - pin the dentry in core */
455 455
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 40f83f53053a..8c370a39e0c1 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -429,7 +429,7 @@ static int ocfs2_mknod(struct inode *dir,
429 mlog_errno(status); 429 mlog_errno(status);
430 goto leave; 430 goto leave;
431 } 431 }
432 dir->i_nlink++; 432 inc_nlink(dir);
433 } 433 }
434 434
435 status = ocfs2_add_entry(handle, dentry, inode, 435 status = ocfs2_add_entry(handle, dentry, inode,
@@ -730,7 +730,7 @@ static int ocfs2_link(struct dentry *old_dentry,
730 goto bail; 730 goto bail;
731 } 731 }
732 732
733 inode->i_nlink++; 733 inc_nlink(inode);
734 inode->i_ctime = CURRENT_TIME; 734 inode->i_ctime = CURRENT_TIME;
735 fe->i_links_count = cpu_to_le16(inode->i_nlink); 735 fe->i_links_count = cpu_to_le16(inode->i_nlink);
736 fe->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); 736 fe->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
@@ -952,7 +952,7 @@ static int ocfs2_unlink(struct inode *dir,
952 parent_node_bh); 952 parent_node_bh);
953 if (status < 0) { 953 if (status < 0) {
954 mlog_errno(status); 954 mlog_errno(status);
955 dir->i_nlink++; 955 inc_nlink(dir);
956 } 956 }
957 } 957 }
958 958
@@ -1382,7 +1382,7 @@ static int ocfs2_rename(struct inode *old_dir,
1382 if (new_inode) { 1382 if (new_inode) {
1383 new_inode->i_nlink--; 1383 new_inode->i_nlink--;
1384 } else { 1384 } else {
1385 new_dir->i_nlink++; 1385 inc_nlink(new_dir);
1386 mark_inode_dirty(new_dir); 1386 mark_inode_dirty(new_dir);
1387 } 1387 }
1388 } 1388 }
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index bc0e51662424..2faf4cdf61b0 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -75,7 +75,7 @@ struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev)
75 inode->i_fop = &simple_dir_operations; 75 inode->i_fop = &simple_dir_operations;
76 76
77 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 77 /* directory inodes start off with i_nlink == 2 (for "." entry) */
78 inode->i_nlink++; 78 inc_nlink(inode);
79 break; 79 break;
80 case S_IFLNK: 80 case S_IFLNK:
81 inode->i_op = &page_symlink_inode_operations; 81 inode->i_op = &page_symlink_inode_operations;
@@ -113,7 +113,7 @@ static int ramfs_mkdir(struct inode * dir, struct dentry * dentry, int mode)
113{ 113{
114 int retval = ramfs_mknod(dir, dentry, mode | S_IFDIR, 0); 114 int retval = ramfs_mknod(dir, dentry, mode | S_IFDIR, 0);
115 if (!retval) 115 if (!retval)
116 dir->i_nlink++; 116 inc_nlink(dir);
117 return retval; 117 return retval;
118} 118}
119 119
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index c76d427e027b..cf92e89515f2 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -19,7 +19,7 @@
19#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
20#include <linux/quotaops.h> 20#include <linux/quotaops.h>
21 21
22#define INC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) { i->i_nlink++; if (i->i_nlink >= REISERFS_LINK_MAX) i->i_nlink=1; } 22#define INC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) { inc_nlink(i); if (i->i_nlink >= REISERFS_LINK_MAX) i->i_nlink=1; }
23#define DEC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) drop_nlink(i); 23#define DEC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) drop_nlink(i);
24 24
25// directory item contains array of entry headers. This performs 25// directory item contains array of entry headers. This performs
@@ -1006,7 +1006,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry)
1006 reiserfs_cut_from_item(&th, &path, &(de.de_entry_key), dir, NULL, 1006 reiserfs_cut_from_item(&th, &path, &(de.de_entry_key), dir, NULL,
1007 0); 1007 0);
1008 if (retval < 0) { 1008 if (retval < 0) {
1009 inode->i_nlink++; 1009 inc_nlink(inode);
1010 goto end_unlink; 1010 goto end_unlink;
1011 } 1011 }
1012 inode->i_ctime = CURRENT_TIME_SEC; 1012 inode->i_ctime = CURRENT_TIME_SEC;
@@ -1143,7 +1143,7 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir,
1143 } 1143 }
1144 1144
1145 /* inc before scheduling so reiserfs_unlink knows we are here */ 1145 /* inc before scheduling so reiserfs_unlink knows we are here */
1146 inode->i_nlink++; 1146 inc_nlink(inode);
1147 1147
1148 retval = journal_begin(&th, dir->i_sb, jbegin_count); 1148 retval = journal_begin(&th, dir->i_sb, jbegin_count);
1149 if (retval) { 1149 if (retval) {
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 5f3d725d1125..3aa3434621ca 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -103,7 +103,7 @@ static int init_dir(struct inode * inode)
103 inode->i_fop = &sysfs_dir_operations; 103 inode->i_fop = &sysfs_dir_operations;
104 104
105 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 105 /* directory inodes start off with i_nlink == 2 (for "." entry) */
106 inode->i_nlink++; 106 inc_nlink(inode);
107 return 0; 107 return 0;
108} 108}
109 109
@@ -137,7 +137,7 @@ static int create_dir(struct kobject * k, struct dentry * p,
137 if (!error) { 137 if (!error) {
138 error = sysfs_create(*d, mode, init_dir); 138 error = sysfs_create(*d, mode, init_dir);
139 if (!error) { 139 if (!error) {
140 p->d_inode->i_nlink++; 140 inc_nlink(p->d_inode);
141 (*d)->d_op = &sysfs_dentry_ops; 141 (*d)->d_op = &sysfs_dentry_ops;
142 d_rehash(*d); 142 d_rehash(*d);
143 } 143 }
diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 40190c489271..20551a1b8a56 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -49,7 +49,7 @@ static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
49 inode->i_op = &sysfs_dir_inode_operations; 49 inode->i_op = &sysfs_dir_inode_operations;
50 inode->i_fop = &sysfs_dir_operations; 50 inode->i_fop = &sysfs_dir_operations;
51 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 51 /* directory inodes start off with i_nlink == 2 (for "." entry) */
52 inode->i_nlink++; 52 inc_nlink(inode);
53 } else { 53 } else {
54 pr_debug("sysfs: could not get root inode\n"); 54 pr_debug("sysfs: could not get root inode\n");
55 return -ENOMEM; 55 return -ENOMEM;
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index b223b32db991..ae21a0e59e95 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1165,7 +1165,7 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1165 inode->i_op = &udf_dir_inode_operations; 1165 inode->i_op = &udf_dir_inode_operations;
1166 inode->i_fop = &udf_dir_operations; 1166 inode->i_fop = &udf_dir_operations;
1167 inode->i_mode |= S_IFDIR; 1167 inode->i_mode |= S_IFDIR;
1168 inode->i_nlink ++; 1168 inc_nlink(inode);
1169 break; 1169 break;
1170 } 1170 }
1171 case ICBTAG_FILE_TYPE_REALTIME: 1171 case ICBTAG_FILE_TYPE_REALTIME:
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index d14d25534aa8..e40c95e65117 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -762,7 +762,7 @@ static int udf_mkdir(struct inode * dir, struct dentry * dentry, int mode)
762 cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL); 762 cpu_to_le32(UDF_I_UNIQUE(inode) & 0x00000000FFFFFFFFUL);
763 cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY; 763 cfi.fileCharacteristics |= FID_FILE_CHAR_DIRECTORY;
764 udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL); 764 udf_write_fi(dir, &cfi, fi, &fibh, NULL, NULL);
765 dir->i_nlink++; 765 inc_nlink(dir);
766 mark_inode_dirty(dir); 766 mark_inode_dirty(dir);
767 d_instantiate(dentry, inode); 767 d_instantiate(dentry, inode);
768 if (fibh.sbh != fibh.ebh) 768 if (fibh.sbh != fibh.ebh)
@@ -1147,7 +1147,7 @@ static int udf_link(struct dentry * old_dentry, struct inode * dir,
1147 if (fibh.sbh != fibh.ebh) 1147 if (fibh.sbh != fibh.ebh)
1148 udf_release_data(fibh.ebh); 1148 udf_release_data(fibh.ebh);
1149 udf_release_data(fibh.sbh); 1149 udf_release_data(fibh.sbh);
1150 inode->i_nlink ++; 1150 inc_nlink(inode);
1151 inode->i_ctime = current_fs_time(inode->i_sb); 1151 inode->i_ctime = current_fs_time(inode->i_sb);
1152 mark_inode_dirty(inode); 1152 mark_inode_dirty(inode);
1153 atomic_inc(&inode->i_count); 1153 atomic_inc(&inode->i_count);
@@ -1282,7 +1282,7 @@ static int udf_rename (struct inode * old_dir, struct dentry * old_dentry,
1282 } 1282 }
1283 else 1283 else
1284 { 1284 {
1285 new_dir->i_nlink ++; 1285 inc_nlink(new_dir);
1286 mark_inode_dirty(new_dir); 1286 mark_inode_dirty(new_dir);
1287 } 1287 }
1288 } 1288 }
diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c
index 090d74ffa061..5846ba2d5d9f 100644
--- a/fs/vfat/namei.c
+++ b/fs/vfat/namei.c
@@ -837,7 +837,7 @@ static int vfat_mkdir(struct inode *dir, struct dentry *dentry, int mode)
837 if (err) 837 if (err)
838 goto out_free; 838 goto out_free;
839 dir->i_version++; 839 dir->i_version++;
840 dir->i_nlink++; 840 inc_nlink(dir);
841 841
842 inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos); 842 inode = fat_build_inode(sb, sinfo.de, sinfo.i_pos);
843 brelse(sinfo.bh); 843 brelse(sinfo.bh);
@@ -932,7 +932,7 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
932 } 932 }
933 drop_nlink(old_dir); 933 drop_nlink(old_dir);
934 if (!new_inode) 934 if (!new_inode)
935 new_dir->i_nlink++; 935 inc_nlink(new_dir);
936 } 936 }
937 937
938 err = fat_remove_entries(old_dir, &old_sinfo); /* and releases bh */ 938 err = fat_remove_entries(old_dir, &old_sinfo); /* and releases bh */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 26d3c61116c0..6a5267da565f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1219,9 +1219,14 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1219 __mark_inode_dirty(inode, I_DIRTY_SYNC); 1219 __mark_inode_dirty(inode, I_DIRTY_SYNC);
1220} 1220}
1221 1221
1222static inline void inode_inc_link_count(struct inode *inode) 1222static inline void inc_nlink(struct inode *inode)
1223{ 1223{
1224 inode->i_nlink++; 1224 inode->i_nlink++;
1225}
1226
1227static inline void inode_inc_link_count(struct inode *inode)
1228{
1229 inc_nlink(inode);
1225 mark_inode_dirty(inode); 1230 mark_inode_dirty(inode);
1226} 1231}
1227 1232
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 10aa8eeeb112..d75d0ba83360 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -168,7 +168,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb, int mode,
168 /* all is ok */ 168 /* all is ok */
169 info->user = get_uid(u); 169 info->user = get_uid(u);
170 } else if (S_ISDIR(mode)) { 170 } else if (S_ISDIR(mode)) {
171 inode->i_nlink++; 171 inc_nlink(inode);
172 /* Some things misbehave if size == 0 on a directory */ 172 /* Some things misbehave if size == 0 on a directory */
173 inode->i_size = 2 * DIRENT_SIZE; 173 inode->i_size = 2 * DIRENT_SIZE;
174 inode->i_op = &mqueue_dir_inode_operations; 174 inode->i_op = &mqueue_dir_inode_operations;
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 8c3c400cce91..9d850ae13b1b 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -377,7 +377,7 @@ static int cpuset_fill_super(struct super_block *sb, void *unused_data,
377 inode->i_op = &simple_dir_inode_operations; 377 inode->i_op = &simple_dir_inode_operations;
378 inode->i_fop = &simple_dir_operations; 378 inode->i_fop = &simple_dir_operations;
379 /* directories start off with i_nlink == 2 (for "." entry) */ 379 /* directories start off with i_nlink == 2 (for "." entry) */
380 inode->i_nlink++; 380 inc_nlink(inode);
381 } else { 381 } else {
382 return -ENOMEM; 382 return -ENOMEM;
383 } 383 }
@@ -1565,7 +1565,7 @@ static int cpuset_create_file(struct dentry *dentry, int mode)
1565 inode->i_fop = &simple_dir_operations; 1565 inode->i_fop = &simple_dir_operations;
1566 1566
1567 /* start off with i_nlink == 2 (for "." entry) */ 1567 /* start off with i_nlink == 2 (for "." entry) */
1568 inode->i_nlink++; 1568 inc_nlink(inode);
1569 } else if (S_ISREG(mode)) { 1569 } else if (S_ISREG(mode)) {
1570 inode->i_size = 0; 1570 inode->i_size = 0;
1571 inode->i_fop = &cpuset_file_operations; 1571 inode->i_fop = &cpuset_file_operations;
@@ -1598,7 +1598,7 @@ static int cpuset_create_dir(struct cpuset *cs, const char *name, int mode)
1598 error = cpuset_create_file(dentry, S_IFDIR | mode); 1598 error = cpuset_create_file(dentry, S_IFDIR | mode);
1599 if (!error) { 1599 if (!error) {
1600 dentry->d_fsdata = cs; 1600 dentry->d_fsdata = cs;
1601 parent->d_inode->i_nlink++; 1601 inc_nlink(parent->d_inode);
1602 cs->dentry = dentry; 1602 cs->dentry = dentry;
1603 } 1603 }
1604 dput(dentry); 1604 dput(dentry);
@@ -2033,7 +2033,7 @@ int __init cpuset_init(void)
2033 } 2033 }
2034 root = cpuset_mount->mnt_sb->s_root; 2034 root = cpuset_mount->mnt_sb->s_root;
2035 root->d_fsdata = &top_cpuset; 2035 root->d_fsdata = &top_cpuset;
2036 root->d_inode->i_nlink++; 2036 inc_nlink(root->d_inode);
2037 top_cpuset.dentry = root; 2037 top_cpuset.dentry = root;
2038 root->d_inode->i_op = &cpuset_dir_inode_operations; 2038 root->d_inode->i_op = &cpuset_dir_inode_operations;
2039 number_of_cpusets = 1; 2039 number_of_cpusets = 1;
diff --git a/mm/shmem.c b/mm/shmem.c
index 908dd947b1ea..bb8ca7ef7094 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1379,7 +1379,7 @@ shmem_get_inode(struct super_block *sb, int mode, dev_t dev)
1379 &sbinfo->policy_nodes); 1379 &sbinfo->policy_nodes);
1380 break; 1380 break;
1381 case S_IFDIR: 1381 case S_IFDIR:
1382 inode->i_nlink++; 1382 inc_nlink(inode);
1383 /* Some things misbehave if size == 0 on a directory */ 1383 /* Some things misbehave if size == 0 on a directory */
1384 inode->i_size = 2 * BOGO_DIRENT_SIZE; 1384 inode->i_size = 2 * BOGO_DIRENT_SIZE;
1385 inode->i_op = &shmem_dir_inode_operations; 1385 inode->i_op = &shmem_dir_inode_operations;
@@ -1715,7 +1715,7 @@ static int shmem_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1715 1715
1716 if ((error = shmem_mknod(dir, dentry, mode | S_IFDIR, 0))) 1716 if ((error = shmem_mknod(dir, dentry, mode | S_IFDIR, 0)))
1717 return error; 1717 return error;
1718 dir->i_nlink++; 1718 inc_nlink(dir);
1719 return 0; 1719 return 0;
1720} 1720}
1721 1721
@@ -1750,7 +1750,7 @@ static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentr
1750 1750
1751 dir->i_size += BOGO_DIRENT_SIZE; 1751 dir->i_size += BOGO_DIRENT_SIZE;
1752 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; 1752 inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
1753 inode->i_nlink++; 1753 inc_nlink(inode);
1754 atomic_inc(&inode->i_count); /* New dentry reference */ 1754 atomic_inc(&inode->i_count); /* New dentry reference */
1755 dget(dentry); /* Extra pinning count for the created dentry */ 1755 dget(dentry); /* Extra pinning count for the created dentry */
1756 d_instantiate(dentry, inode); 1756 d_instantiate(dentry, inode);
@@ -1807,7 +1807,7 @@ static int shmem_rename(struct inode *old_dir, struct dentry *old_dentry, struct
1807 drop_nlink(old_dir); 1807 drop_nlink(old_dir);
1808 } else if (they_are_dirs) { 1808 } else if (they_are_dirs) {
1809 drop_nlink(old_dir); 1809 drop_nlink(old_dir);
1810 new_dir->i_nlink++; 1810 inc_nlink(new_dir);
1811 } 1811 }
1812 1812
1813 old_dir->i_size -= BOGO_DIRENT_SIZE; 1813 old_dir->i_size -= BOGO_DIRENT_SIZE;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 700c6e061a04..9a0b41a97f90 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -494,7 +494,7 @@ rpc_get_inode(struct super_block *sb, int mode)
494 case S_IFDIR: 494 case S_IFDIR:
495 inode->i_fop = &simple_dir_operations; 495 inode->i_fop = &simple_dir_operations;
496 inode->i_op = &simple_dir_inode_operations; 496 inode->i_op = &simple_dir_inode_operations;
497 inode->i_nlink++; 497 inc_nlink(inode);
498 default: 498 default:
499 break; 499 break;
500 } 500 }
@@ -571,7 +571,7 @@ rpc_populate(struct dentry *parent,
571 if (private) 571 if (private)
572 rpc_inode_setowner(inode, private); 572 rpc_inode_setowner(inode, private);
573 if (S_ISDIR(mode)) 573 if (S_ISDIR(mode))
574 dir->i_nlink++; 574 inc_nlink(dir);
575 d_add(dentry, inode); 575 d_add(dentry, inode);
576 } 576 }
577 mutex_unlock(&dir->i_mutex); 577 mutex_unlock(&dir->i_mutex);
@@ -593,7 +593,7 @@ __rpc_mkdir(struct inode *dir, struct dentry *dentry)
593 goto out_err; 593 goto out_err;
594 inode->i_ino = iunique(dir->i_sb, 100); 594 inode->i_ino = iunique(dir->i_sb, 100);
595 d_instantiate(dentry, inode); 595 d_instantiate(dentry, inode);
596 dir->i_nlink++; 596 inc_nlink(dir);
597 inode_dir_notify(dir, DN_CREATE); 597 inode_dir_notify(dir, DN_CREATE);
598 return 0; 598 return 0;
599out_err: 599out_err:
diff --git a/security/inode.c b/security/inode.c
index 49ee51529396..9b16e14f3a80 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -78,7 +78,7 @@ static struct inode *get_inode(struct super_block *sb, int mode, dev_t dev)
78 inode->i_fop = &simple_dir_operations; 78 inode->i_fop = &simple_dir_operations;
79 79
80 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 80 /* directory inodes start off with i_nlink == 2 (for "." entry) */
81 inode->i_nlink++; 81 inc_nlink(inode);
82 break; 82 break;
83 } 83 }
84 } 84 }
@@ -111,7 +111,7 @@ static int mkdir(struct inode *dir, struct dentry *dentry, int mode)
111 mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR; 111 mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
112 res = mknod(dir, dentry, mode, 0); 112 res = mknod(dir, dentry, mode, 0);
113 if (!res) 113 if (!res)
114 dir->i_nlink++; 114 inc_nlink(dir);
115 return res; 115 return res;
116} 116}
117 117
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index bab7b386cb8d..cd244419c980 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1253,10 +1253,10 @@ static int sel_make_dir(struct inode *dir, struct dentry *dentry)
1253 inode->i_op = &simple_dir_inode_operations; 1253 inode->i_op = &simple_dir_inode_operations;
1254 inode->i_fop = &simple_dir_operations; 1254 inode->i_fop = &simple_dir_operations;
1255 /* directory inodes start off with i_nlink == 2 (for "." entry) */ 1255 /* directory inodes start off with i_nlink == 2 (for "." entry) */
1256 inode->i_nlink++; 1256 inc_nlink(inode);
1257 d_add(dentry, inode); 1257 d_add(dentry, inode);
1258 /* bump link count on parent directory, too */ 1258 /* bump link count on parent directory, too */
1259 dir->i_nlink++; 1259 inc_nlink(dir);
1260out: 1260out:
1261 return ret; 1261 return ret;
1262} 1262}