diff options
author | Christoph Hellwig <hch@lst.de> | 2010-10-23 11:19:54 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-10-25 21:26:11 -0400 |
commit | 85fe4025c616a7c0ed07bc2fc8c5371b07f3888c (patch) | |
tree | 7a5db7accb6192f2911f2473b4e3191227b914cc | |
parent | f991bd2e14210fb93d722cb23e54991de20e8a3d (diff) |
fs: do not assign default i_ino in new_inode
Instead of always assigning an increasing inode number in new_inode
move the call to assign it into those callers that actually need it.
For now callers that need it is estimated conservatively, that is
the call is added to all filesystems that do not assign an i_ino
by themselves. For a few more filesystems we can avoid assigning
any inode number given that they aren't user visible, and for others
it could be done lazily when an inode number is actually needed,
but that's left for later patches.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_fs.c | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_fs.c | 1 | ||||
-rw-r--r-- | drivers/misc/ibmasm/ibmasmfs.c | 1 | ||||
-rw-r--r-- | drivers/oprofile/oprofilefs.c | 1 | ||||
-rw-r--r-- | drivers/usb/core/inode.c | 1 | ||||
-rw-r--r-- | drivers/usb/gadget/f_fs.c | 1 | ||||
-rw-r--r-- | drivers/usb/gadget/inode.c | 1 | ||||
-rw-r--r-- | fs/anon_inodes.c | 1 | ||||
-rw-r--r-- | fs/autofs4/inode.c | 1 | ||||
-rw-r--r-- | fs/binfmt_misc.c | 1 | ||||
-rw-r--r-- | fs/configfs/inode.c | 1 | ||||
-rw-r--r-- | fs/debugfs/inode.c | 1 | ||||
-rw-r--r-- | fs/ext4/mballoc.c | 1 | ||||
-rw-r--r-- | fs/freevxfs/vxfs_inode.c | 1 | ||||
-rw-r--r-- | fs/fuse/control.c | 1 | ||||
-rw-r--r-- | fs/hugetlbfs/inode.c | 1 | ||||
-rw-r--r-- | fs/inode.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/dlmfs/dlmfs.c | 2 | ||||
-rw-r--r-- | fs/pipe.c | 2 | ||||
-rw-r--r-- | fs/proc/base.c | 2 | ||||
-rw-r--r-- | fs/proc/proc_sysctl.c | 2 | ||||
-rw-r--r-- | fs/ramfs/inode.c | 1 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 1 | ||||
-rw-r--r-- | include/linux/fs.h | 1 | ||||
-rw-r--r-- | ipc/mqueue.c | 1 | ||||
-rw-r--r-- | kernel/cgroup.c | 1 | ||||
-rw-r--r-- | mm/shmem.c | 1 | ||||
-rw-r--r-- | net/socket.c | 1 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 1 | ||||
-rw-r--r-- | security/inode.c | 1 | ||||
-rw-r--r-- | security/selinux/selinuxfs.c | 1 |
31 files changed, 36 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c index d13e72685dcf..12d5bf76302c 100644 --- a/drivers/infiniband/hw/ipath/ipath_fs.c +++ b/drivers/infiniband/hw/ipath/ipath_fs.c | |||
@@ -57,6 +57,7 @@ static int ipathfs_mknod(struct inode *dir, struct dentry *dentry, | |||
57 | goto bail; | 57 | goto bail; |
58 | } | 58 | } |
59 | 59 | ||
60 | inode->i_ino = get_next_ino(); | ||
60 | inode->i_mode = mode; | 61 | inode->i_mode = mode; |
61 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 62 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
62 | inode->i_private = data; | 63 | inode->i_private = data; |
diff --git a/drivers/infiniband/hw/qib/qib_fs.c b/drivers/infiniband/hw/qib/qib_fs.c index a0e6613e8be6..7e433d75c775 100644 --- a/drivers/infiniband/hw/qib/qib_fs.c +++ b/drivers/infiniband/hw/qib/qib_fs.c | |||
@@ -58,6 +58,7 @@ static int qibfs_mknod(struct inode *dir, struct dentry *dentry, | |||
58 | goto bail; | 58 | goto bail; |
59 | } | 59 | } |
60 | 60 | ||
61 | inode->i_ino = get_next_ino(); | ||
61 | inode->i_mode = mode; | 62 | inode->i_mode = mode; |
62 | inode->i_uid = 0; | 63 | inode->i_uid = 0; |
63 | inode->i_gid = 0; | 64 | inode->i_gid = 0; |
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c index af2497ae5fe3..0a53500636c9 100644 --- a/drivers/misc/ibmasm/ibmasmfs.c +++ b/drivers/misc/ibmasm/ibmasmfs.c | |||
@@ -146,6 +146,7 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode) | |||
146 | struct inode *ret = new_inode(sb); | 146 | struct inode *ret = new_inode(sb); |
147 | 147 | ||
148 | if (ret) { | 148 | if (ret) { |
149 | ret->i_ino = get_next_ino(); | ||
149 | ret->i_mode = mode; | 150 | ret->i_mode = mode; |
150 | ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; | 151 | ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; |
151 | } | 152 | } |
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index 95f711b251ad..449de59bf35b 100644 --- a/drivers/oprofile/oprofilefs.c +++ b/drivers/oprofile/oprofilefs.c | |||
@@ -28,6 +28,7 @@ static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode) | |||
28 | struct inode *inode = new_inode(sb); | 28 | struct inode *inode = new_inode(sb); |
29 | 29 | ||
30 | if (inode) { | 30 | if (inode) { |
31 | inode->i_ino = get_next_ino(); | ||
31 | inode->i_mode = mode; | 32 | inode->i_mode = mode; |
32 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 33 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
33 | } | 34 | } |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 095fa5366690..e2f63c0ea09d 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -276,6 +276,7 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de | |||
276 | struct inode *inode = new_inode(sb); | 276 | struct inode *inode = new_inode(sb); |
277 | 277 | ||
278 | if (inode) { | 278 | if (inode) { |
279 | inode->i_ino = get_next_ino(); | ||
279 | inode->i_mode = mode; | 280 | inode->i_mode = mode; |
280 | inode->i_uid = current_fsuid(); | 281 | inode->i_uid = current_fsuid(); |
281 | inode->i_gid = current_fsgid(); | 282 | inode->i_gid = current_fsgid(); |
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index e4f595055208..e093fd8d04d3 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -980,6 +980,7 @@ ffs_sb_make_inode(struct super_block *sb, void *data, | |||
980 | if (likely(inode)) { | 980 | if (likely(inode)) { |
981 | struct timespec current_time = CURRENT_TIME; | 981 | struct timespec current_time = CURRENT_TIME; |
982 | 982 | ||
983 | inode->i_ino = usbfs_get_inode(); | ||
983 | inode->i_mode = perms->mode; | 984 | inode->i_mode = perms->mode; |
984 | inode->i_uid = perms->uid; | 985 | inode->i_uid = perms->uid; |
985 | inode->i_gid = perms->gid; | 986 | inode->i_gid = perms->gid; |
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index d1d72d946b04..ba145e7fbe03 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1991,6 +1991,7 @@ gadgetfs_make_inode (struct super_block *sb, | |||
1991 | struct inode *inode = new_inode (sb); | 1991 | struct inode *inode = new_inode (sb); |
1992 | 1992 | ||
1993 | if (inode) { | 1993 | if (inode) { |
1994 | inode->i_ino = get_next_ino(); | ||
1994 | inode->i_mode = mode; | 1995 | inode->i_mode = mode; |
1995 | inode->i_uid = default_uid; | 1996 | inode->i_uid = default_uid; |
1996 | inode->i_gid = default_gid; | 1997 | inode->i_gid = default_gid; |
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 9c8e87b0361f..5365527ca43f 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c | |||
@@ -193,6 +193,7 @@ static struct inode *anon_inode_mkinode(void) | |||
193 | if (!inode) | 193 | if (!inode) |
194 | return ERR_PTR(-ENOMEM); | 194 | return ERR_PTR(-ENOMEM); |
195 | 195 | ||
196 | inode->i_ino = get_next_ino(); | ||
196 | inode->i_fop = &anon_inode_fops; | 197 | inode->i_fop = &anon_inode_fops; |
197 | 198 | ||
198 | inode->i_mapping->a_ops = &anon_aops; | 199 | inode->i_mapping->a_ops = &anon_aops; |
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c index 821b2b955dac..ac87e49fa706 100644 --- a/fs/autofs4/inode.c +++ b/fs/autofs4/inode.c | |||
@@ -398,6 +398,7 @@ struct inode *autofs4_get_inode(struct super_block *sb, | |||
398 | inode->i_gid = sb->s_root->d_inode->i_gid; | 398 | inode->i_gid = sb->s_root->d_inode->i_gid; |
399 | } | 399 | } |
400 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 400 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
401 | inode->i_ino = get_next_ino(); | ||
401 | 402 | ||
402 | if (S_ISDIR(inf->mode)) { | 403 | if (S_ISDIR(inf->mode)) { |
403 | inode->i_nlink = 2; | 404 | inode->i_nlink = 2; |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 139fc8083f53..29990f0eee0c 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
@@ -495,6 +495,7 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode) | |||
495 | struct inode * inode = new_inode(sb); | 495 | struct inode * inode = new_inode(sb); |
496 | 496 | ||
497 | if (inode) { | 497 | if (inode) { |
498 | inode->i_ino = get_next_ino(); | ||
498 | inode->i_mode = mode; | 499 | inode->i_mode = mode; |
499 | inode->i_atime = inode->i_mtime = inode->i_ctime = | 500 | inode->i_atime = inode->i_mtime = inode->i_ctime = |
500 | current_fs_time(inode->i_sb); | 501 | current_fs_time(inode->i_sb); |
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index cf78d44a8d6a..253476d78ed8 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c | |||
@@ -135,6 +135,7 @@ struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent * sd) | |||
135 | { | 135 | { |
136 | struct inode * inode = new_inode(configfs_sb); | 136 | struct inode * inode = new_inode(configfs_sb); |
137 | if (inode) { | 137 | if (inode) { |
138 | inode->i_ino = get_next_ino(); | ||
138 | inode->i_mapping->a_ops = &configfs_aops; | 139 | inode->i_mapping->a_ops = &configfs_aops; |
139 | inode->i_mapping->backing_dev_info = &configfs_backing_dev_info; | 140 | inode->i_mapping->backing_dev_info = &configfs_backing_dev_info; |
140 | inode->i_op = &configfs_inode_operations; | 141 | inode->i_op = &configfs_inode_operations; |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 30a87b3dbcac..a4ed8380e98a 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -40,6 +40,7 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d | |||
40 | struct inode *inode = new_inode(sb); | 40 | struct inode *inode = new_inode(sb); |
41 | 41 | ||
42 | if (inode) { | 42 | if (inode) { |
43 | inode->i_ino = get_next_ino(); | ||
43 | inode->i_mode = mode; | 44 | inode->i_mode = mode; |
44 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 45 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
45 | switch (mode & S_IFMT) { | 46 | switch (mode & S_IFMT) { |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 19aa0d44d822..42f77b1dc72d 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2373,6 +2373,7 @@ static int ext4_mb_init_backend(struct super_block *sb) | |||
2373 | printk(KERN_ERR "EXT4-fs: can't get new inode\n"); | 2373 | printk(KERN_ERR "EXT4-fs: can't get new inode\n"); |
2374 | goto err_freesgi; | 2374 | goto err_freesgi; |
2375 | } | 2375 | } |
2376 | sbi->s_buddy_cache->i_ino = get_next_ino(); | ||
2376 | EXT4_I(sbi->s_buddy_cache)->i_disksize = 0; | 2377 | EXT4_I(sbi->s_buddy_cache)->i_disksize = 0; |
2377 | for (i = 0; i < ngroups; i++) { | 2378 | for (i = 0; i < ngroups; i++) { |
2378 | desc = ext4_get_group_desc(sb, i, NULL); | 2379 | desc = ext4_get_group_desc(sb, i, NULL); |
diff --git a/fs/freevxfs/vxfs_inode.c b/fs/freevxfs/vxfs_inode.c index 79d1b4ea13e7..8c04eac5079d 100644 --- a/fs/freevxfs/vxfs_inode.c +++ b/fs/freevxfs/vxfs_inode.c | |||
@@ -260,6 +260,7 @@ vxfs_get_fake_inode(struct super_block *sbp, struct vxfs_inode_info *vip) | |||
260 | struct inode *ip = NULL; | 260 | struct inode *ip = NULL; |
261 | 261 | ||
262 | if ((ip = new_inode(sbp))) { | 262 | if ((ip = new_inode(sbp))) { |
263 | ip->i_ino = get_next_ino(); | ||
263 | vxfs_iinit(ip, vip); | 264 | vxfs_iinit(ip, vip); |
264 | ip->i_mapping->a_ops = &vxfs_aops; | 265 | ip->i_mapping->a_ops = &vxfs_aops; |
265 | } | 266 | } |
diff --git a/fs/fuse/control.c b/fs/fuse/control.c index 7367e177186f..4eba07661e5c 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c | |||
@@ -222,6 +222,7 @@ static struct dentry *fuse_ctl_add_dentry(struct dentry *parent, | |||
222 | if (!inode) | 222 | if (!inode) |
223 | return NULL; | 223 | return NULL; |
224 | 224 | ||
225 | inode->i_ino = get_next_ino(); | ||
225 | inode->i_mode = mode; | 226 | inode->i_mode = mode; |
226 | inode->i_uid = fc->user_id; | 227 | inode->i_uid = fc->user_id; |
227 | inode->i_gid = fc->group_id; | 228 | inode->i_gid = fc->group_id; |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 113eba3d3c38..8d0607b37266 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -455,6 +455,7 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid, | |||
455 | inode = new_inode(sb); | 455 | inode = new_inode(sb); |
456 | if (inode) { | 456 | if (inode) { |
457 | struct hugetlbfs_inode_info *info; | 457 | struct hugetlbfs_inode_info *info; |
458 | inode->i_ino = get_next_ino(); | ||
458 | inode->i_mode = mode; | 459 | inode->i_mode = mode; |
459 | inode->i_uid = uid; | 460 | inode->i_uid = uid; |
460 | inode->i_gid = gid; | 461 | inode->i_gid = gid; |
diff --git a/fs/inode.c b/fs/inode.c index 46a3e120b196..2cd2e48f7a20 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -735,7 +735,7 @@ repeat: | |||
735 | #define LAST_INO_BATCH 1024 | 735 | #define LAST_INO_BATCH 1024 |
736 | static DEFINE_PER_CPU(unsigned int, last_ino); | 736 | static DEFINE_PER_CPU(unsigned int, last_ino); |
737 | 737 | ||
738 | static unsigned int get_next_ino(void) | 738 | unsigned int get_next_ino(void) |
739 | { | 739 | { |
740 | unsigned int *p = &get_cpu_var(last_ino); | 740 | unsigned int *p = &get_cpu_var(last_ino); |
741 | unsigned int res = *p; | 741 | unsigned int res = *p; |
@@ -753,6 +753,7 @@ static unsigned int get_next_ino(void) | |||
753 | put_cpu_var(last_ino); | 753 | put_cpu_var(last_ino); |
754 | return res; | 754 | return res; |
755 | } | 755 | } |
756 | EXPORT_SYMBOL(get_next_ino); | ||
756 | 757 | ||
757 | /** | 758 | /** |
758 | * new_inode - obtain an inode | 759 | * new_inode - obtain an inode |
@@ -776,7 +777,6 @@ struct inode *new_inode(struct super_block *sb) | |||
776 | if (inode) { | 777 | if (inode) { |
777 | spin_lock(&inode_lock); | 778 | spin_lock(&inode_lock); |
778 | __inode_sb_list_add(inode); | 779 | __inode_sb_list_add(inode); |
779 | inode->i_ino = get_next_ino(); | ||
780 | inode->i_state = 0; | 780 | inode->i_state = 0; |
781 | spin_unlock(&inode_lock); | 781 | spin_unlock(&inode_lock); |
782 | } | 782 | } |
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c index a7ebd9d42dc8..75e115f1bd73 100644 --- a/fs/ocfs2/dlmfs/dlmfs.c +++ b/fs/ocfs2/dlmfs/dlmfs.c | |||
@@ -400,6 +400,7 @@ static struct inode *dlmfs_get_root_inode(struct super_block *sb) | |||
400 | if (inode) { | 400 | if (inode) { |
401 | ip = DLMFS_I(inode); | 401 | ip = DLMFS_I(inode); |
402 | 402 | ||
403 | inode->i_ino = get_next_ino(); | ||
403 | inode->i_mode = mode; | 404 | inode->i_mode = mode; |
404 | inode->i_uid = current_fsuid(); | 405 | inode->i_uid = current_fsuid(); |
405 | inode->i_gid = current_fsgid(); | 406 | inode->i_gid = current_fsgid(); |
@@ -425,6 +426,7 @@ static struct inode *dlmfs_get_inode(struct inode *parent, | |||
425 | if (!inode) | 426 | if (!inode) |
426 | return NULL; | 427 | return NULL; |
427 | 428 | ||
429 | inode->i_ino = get_next_ino(); | ||
428 | inode->i_mode = mode; | 430 | inode->i_mode = mode; |
429 | inode->i_uid = current_fsuid(); | 431 | inode->i_uid = current_fsuid(); |
430 | inode->i_gid = current_fsgid(); | 432 | inode->i_gid = current_fsgid(); |
@@ -954,6 +954,8 @@ static struct inode * get_pipe_inode(void) | |||
954 | if (!inode) | 954 | if (!inode) |
955 | goto fail_inode; | 955 | goto fail_inode; |
956 | 956 | ||
957 | inode->i_ino = get_next_ino(); | ||
958 | |||
957 | pipe = alloc_pipe_info(inode); | 959 | pipe = alloc_pipe_info(inode); |
958 | if (!pipe) | 960 | if (!pipe) |
959 | goto fail_iput; | 961 | goto fail_iput; |
diff --git a/fs/proc/base.c b/fs/proc/base.c index fb2a5abd4e4f..9883f1e18332 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1603,6 +1603,7 @@ static struct inode *proc_pid_make_inode(struct super_block * sb, struct task_st | |||
1603 | 1603 | ||
1604 | /* Common stuff */ | 1604 | /* Common stuff */ |
1605 | ei = PROC_I(inode); | 1605 | ei = PROC_I(inode); |
1606 | inode->i_ino = get_next_ino(); | ||
1606 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 1607 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
1607 | inode->i_op = &proc_def_inode_operations; | 1608 | inode->i_op = &proc_def_inode_operations; |
1608 | 1609 | ||
@@ -2549,6 +2550,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir, | |||
2549 | 2550 | ||
2550 | /* Initialize the inode */ | 2551 | /* Initialize the inode */ |
2551 | ei = PROC_I(inode); | 2552 | ei = PROC_I(inode); |
2553 | inode->i_ino = get_next_ino(); | ||
2552 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 2554 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
2553 | 2555 | ||
2554 | /* | 2556 | /* |
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 2fc52552271d..b652cb00906b 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -23,6 +23,8 @@ static struct inode *proc_sys_make_inode(struct super_block *sb, | |||
23 | if (!inode) | 23 | if (!inode) |
24 | goto out; | 24 | goto out; |
25 | 25 | ||
26 | inode->i_ino = get_next_ino(); | ||
27 | |||
26 | sysctl_head_get(head); | 28 | sysctl_head_get(head); |
27 | ei = PROC_I(inode); | 29 | ei = PROC_I(inode); |
28 | ei->sysctl = head; | 30 | ei->sysctl = head; |
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c index a5ebae70dc6d..67fadb1ad2c1 100644 --- a/fs/ramfs/inode.c +++ b/fs/ramfs/inode.c | |||
@@ -58,6 +58,7 @@ struct inode *ramfs_get_inode(struct super_block *sb, | |||
58 | struct inode * inode = new_inode(sb); | 58 | struct inode * inode = new_inode(sb); |
59 | 59 | ||
60 | if (inode) { | 60 | if (inode) { |
61 | inode->i_ino = get_next_ino(); | ||
61 | inode_init_owner(inode, dir, mode); | 62 | inode_init_owner(inode, dir, mode); |
62 | inode->i_mapping->a_ops = &ramfs_aops; | 63 | inode->i_mapping->a_ops = &ramfs_aops; |
63 | inode->i_mapping->backing_dev_info = &ramfs_backing_dev_info; | 64 | inode->i_mapping->backing_dev_info = &ramfs_backing_dev_info; |
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index ba5312802aa9..63fd2c07cb57 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -1580,6 +1580,7 @@ xfs_mapping_buftarg( | |||
1580 | XFS_BUFTARG_NAME(btp)); | 1580 | XFS_BUFTARG_NAME(btp)); |
1581 | return ENOMEM; | 1581 | return ENOMEM; |
1582 | } | 1582 | } |
1583 | inode->i_ino = get_next_ino(); | ||
1583 | inode->i_mode = S_IFBLK; | 1584 | inode->i_mode = S_IFBLK; |
1584 | inode->i_bdev = bdev; | 1585 | inode->i_bdev = bdev; |
1585 | inode->i_rdev = bdev->bd_dev; | 1586 | inode->i_rdev = bdev->bd_dev; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index bd6ae6c71fc8..4a573cf13f51 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2191,6 +2191,7 @@ extern struct inode * iget_locked(struct super_block *, unsigned long); | |||
2191 | extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); | 2191 | extern int insert_inode_locked4(struct inode *, unsigned long, int (*test)(struct inode *, void *), void *); |
2192 | extern int insert_inode_locked(struct inode *); | 2192 | extern int insert_inode_locked(struct inode *); |
2193 | extern void unlock_new_inode(struct inode *); | 2193 | extern void unlock_new_inode(struct inode *); |
2194 | extern unsigned int get_next_ino(void); | ||
2194 | 2195 | ||
2195 | extern void __iget(struct inode * inode); | 2196 | extern void __iget(struct inode * inode); |
2196 | extern void iget_failed(struct inode *); | 2197 | extern void iget_failed(struct inode *); |
diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 80b35ffca25d..3a61ffefe884 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c | |||
@@ -116,6 +116,7 @@ static struct inode *mqueue_get_inode(struct super_block *sb, | |||
116 | 116 | ||
117 | inode = new_inode(sb); | 117 | inode = new_inode(sb); |
118 | if (inode) { | 118 | if (inode) { |
119 | inode->i_ino = get_next_ino(); | ||
119 | inode->i_mode = mode; | 120 | inode->i_mode = mode; |
120 | inode->i_uid = current_fsuid(); | 121 | inode->i_uid = current_fsuid(); |
121 | inode->i_gid = current_fsgid(); | 122 | inode->i_gid = current_fsgid(); |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 7b69b8d0313d..9270d532ec3c 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -777,6 +777,7 @@ static struct inode *cgroup_new_inode(mode_t mode, struct super_block *sb) | |||
777 | struct inode *inode = new_inode(sb); | 777 | struct inode *inode = new_inode(sb); |
778 | 778 | ||
779 | if (inode) { | 779 | if (inode) { |
780 | inode->i_ino = get_next_ino(); | ||
780 | inode->i_mode = mode; | 781 | inode->i_mode = mode; |
781 | inode->i_uid = current_fsuid(); | 782 | inode->i_uid = current_fsuid(); |
782 | inode->i_gid = current_fsgid(); | 783 | inode->i_gid = current_fsgid(); |
diff --git a/mm/shmem.c b/mm/shmem.c index d4e2852526e6..f6d350e8adc5 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1586,6 +1586,7 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode | |||
1586 | 1586 | ||
1587 | inode = new_inode(sb); | 1587 | inode = new_inode(sb); |
1588 | if (inode) { | 1588 | if (inode) { |
1589 | inode->i_ino = get_next_ino(); | ||
1589 | inode_init_owner(inode, dir, mode); | 1590 | inode_init_owner(inode, dir, mode); |
1590 | inode->i_blocks = 0; | 1591 | inode->i_blocks = 0; |
1591 | inode->i_mapping->backing_dev_info = &shmem_backing_dev_info; | 1592 | inode->i_mapping->backing_dev_info = &shmem_backing_dev_info; |
diff --git a/net/socket.c b/net/socket.c index d223725f99e5..5cac1c707755 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -480,6 +480,7 @@ static struct socket *sock_alloc(void) | |||
480 | sock = SOCKET_I(inode); | 480 | sock = SOCKET_I(inode); |
481 | 481 | ||
482 | kmemcheck_annotate_bitfield(sock, type); | 482 | kmemcheck_annotate_bitfield(sock, type); |
483 | inode->i_ino = get_next_ino(); | ||
483 | inode->i_mode = S_IFSOCK | S_IRWXUGO; | 484 | inode->i_mode = S_IFSOCK | S_IRWXUGO; |
484 | inode->i_uid = current_fsuid(); | 485 | inode->i_uid = current_fsuid(); |
485 | inode->i_gid = current_fsgid(); | 486 | inode->i_gid = current_fsgid(); |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 52f252432144..7df92d237cb8 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -445,6 +445,7 @@ rpc_get_inode(struct super_block *sb, umode_t mode) | |||
445 | struct inode *inode = new_inode(sb); | 445 | struct inode *inode = new_inode(sb); |
446 | if (!inode) | 446 | if (!inode) |
447 | return NULL; | 447 | return NULL; |
448 | inode->i_ino = get_next_ino(); | ||
448 | inode->i_mode = mode; | 449 | inode->i_mode = mode; |
449 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 450 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
450 | switch(mode & S_IFMT) { | 451 | switch(mode & S_IFMT) { |
diff --git a/security/inode.c b/security/inode.c index 88839866cbcd..cb8f47c66a58 100644 --- a/security/inode.c +++ b/security/inode.c | |||
@@ -61,6 +61,7 @@ static struct inode *get_inode(struct super_block *sb, int mode, dev_t dev) | |||
61 | struct inode *inode = new_inode(sb); | 61 | struct inode *inode = new_inode(sb); |
62 | 62 | ||
63 | if (inode) { | 63 | if (inode) { |
64 | inode->i_ino = get_next_ino(); | ||
64 | inode->i_mode = mode; | 65 | inode->i_mode = mode; |
65 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 66 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
66 | switch (mode & S_IFMT) { | 67 | switch (mode & S_IFMT) { |
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 87e0556bae70..55a755c1a1bd 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
@@ -978,6 +978,7 @@ static struct inode *sel_make_inode(struct super_block *sb, int mode) | |||
978 | struct inode *ret = new_inode(sb); | 978 | struct inode *ret = new_inode(sb); |
979 | 979 | ||
980 | if (ret) { | 980 | if (ret) { |
981 | ret->i_ino = get_next_ino(); | ||
981 | ret->i_mode = mode; | 982 | ret->i_mode = mode; |
982 | ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; | 983 | ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; |
983 | } | 984 | } |