]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
zero i_uid/i_gid on inode allocation
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 9 Dec 2008 14:34:39 +0000 (09:34 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 5 Jan 2009 16:54:28 +0000 (11:54 -0500)
... and don't bother in callers.  Don't bother with zeroing i_blocks,
while we are at it - it's already been zeroed.

i_mode is not worth the effort; it has no common default value.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
31 files changed:
arch/powerpc/platforms/cell/spufs/inode.c
arch/s390/hypfs/inode.c
drivers/infiniband/hw/ipath/ipath_fs.c
drivers/isdn/capi/capifs.c
drivers/misc/ibmasm/ibmasmfs.c
drivers/oprofile/oprofilefs.c
drivers/usb/core/inode.c
drivers/usb/gadget/inode.c
fs/autofs/inode.c
fs/autofs4/inode.c
fs/binfmt_misc.c
fs/configfs/inode.c
fs/cramfs/inode.c
fs/debugfs/inode.c
fs/devpts/inode.c
fs/hugetlbfs/inode.c
fs/inode.c
fs/libfs.c
fs/ocfs2/dlm/dlmfs.c
fs/omfs/inode.c
fs/openpromfs/inode.c
fs/proc/base.c
fs/proc/proc_sysctl.c
fs/ramfs/inode.c
fs/romfs/inode.c
fs/sysfs/inode.c
ipc/mqueue.c
kernel/cgroup.c
net/sunrpc/rpc_pipe.c
security/inode.c
security/selinux/selinuxfs.c

index 6296bfd9cb0b5646ce7b1cd8d195041f8ed239bf..e309ef70a53140b4e156fbfb1f38f06863b7eee2 100644 (file)
@@ -97,7 +97,6 @@ spufs_new_inode(struct super_block *sb, int mode)
        inode->i_mode = mode;
        inode->i_uid = current_fsuid();
        inode->i_gid = current_fsgid();
-       inode->i_blocks = 0;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 out:
        return inode;
index 9d4f8e6c0800e635c8f10b69b9b81400409b75a9..5a805df216bb22927f8b344c5d2fe8e719913b1c 100644 (file)
@@ -106,7 +106,6 @@ static struct inode *hypfs_make_inode(struct super_block *sb, int mode)
                ret->i_mode = mode;
                ret->i_uid = hypfs_info->uid;
                ret->i_gid = hypfs_info->gid;
-               ret->i_blocks = 0;
                ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
                if (mode & S_IFDIR)
                        ret->i_nlink = 2;
index 53912c327bfea25dc4bab902d788042973441140..8dc2bb781605d5bda70851249234687ea08f62be 100644 (file)
@@ -57,9 +57,6 @@ static int ipathfs_mknod(struct inode *dir, struct dentry *dentry,
        }
 
        inode->i_mode = mode;
-       inode->i_uid = 0;
-       inode->i_gid = 0;
-       inode->i_blocks = 0;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        inode->i_private = data;
        if ((mode & S_IFMT) == S_IFDIR) {
index 0aa66ec4cbdd216789e11c30f8024a219b2e587c..b129409925af59b86c448fafca9ed88266ddd6ff 100644 (file)
@@ -111,8 +111,6 @@ capifs_fill_super(struct super_block *s, void *data, int silent)
                goto fail;
        inode->i_ino = 1;
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
-       inode->i_blocks = 0;
-       inode->i_uid = inode->i_gid = 0;
        inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
        inode->i_op = &simple_dir_inode_operations;
        inode->i_fop = &simple_dir_operations;
index 22a7e8ba211d242dd0b25c477f2ea5b7c4bcd07c..de966a6fb7e634d50abce07bfa82a9c47f6f8ac9 100644 (file)
@@ -146,8 +146,6 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
 
        if (ret) {
                ret->i_mode = mode;
-               ret->i_uid = ret->i_gid = 0;
-               ret->i_blocks = 0;
                ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
        }
        return ret;
index ddc4c59f02dca27adc42d187429543dea4f4da63..b7e4cee24269a2e0a11b66833c6734dcf6f6a959 100644 (file)
@@ -29,9 +29,6 @@ static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
 
        if (inode) {
                inode->i_mode = mode;
-               inode->i_uid = 0;
-               inode->i_gid = 0;
-               inode->i_blocks = 0;
                inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        }
        return inode;
index 185be760833e8b05a2940f13d90af0f9bdcec946..2a129cb7bb568232e2c7869c26bd7061d62e3d9d 100644 (file)
@@ -279,7 +279,6 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de
                inode->i_mode = mode;
                inode->i_uid = current_fsuid();
                inode->i_gid = current_fsgid();
-               inode->i_blocks = 0;
                inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
                switch (mode & S_IFMT) {
                default:
index eeb26c0f88e5846d4c0849e70ddf01eea90fa65d..317b48fdbf01b302bd9442d13b9bb923408a1c17 100644 (file)
@@ -2001,7 +2001,6 @@ gadgetfs_make_inode (struct super_block *sb,
                inode->i_mode = mode;
                inode->i_uid = default_uid;
                inode->i_gid = default_gid;
-               inode->i_blocks = 0;
                inode->i_atime = inode->i_mtime = inode->i_ctime
                                = CURRENT_TIME;
                inode->i_private = data;
index c773680d5c605524b37481fdb4fb7fe83b2e7b7e..e1734f2d6e26de60a89e514ac59d57a7a5fba821 100644 (file)
@@ -251,13 +251,11 @@ struct inode *autofs_iget(struct super_block *sb, unsigned long ino)
        inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO;
        inode->i_nlink = 2;
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
-       inode->i_blocks = 0;
 
        if (ino == AUTOFS_ROOT_INO) {
                inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
                inode->i_op = &autofs_root_inode_operations;
                inode->i_fop = &autofs_root_operations;
-               inode->i_uid = inode->i_gid = 0; /* Changed in read_super */
                goto done;
        } 
        
index 7b19802cfef4b158cee241339c92c8f30ac88dd0..cfc23e53b6f460fef089881acb04dc2087393453 100644 (file)
@@ -455,11 +455,7 @@ struct inode *autofs4_get_inode(struct super_block *sb,
        if (sb->s_root) {
                inode->i_uid = sb->s_root->d_inode->i_uid;
                inode->i_gid = sb->s_root->d_inode->i_gid;
-       } else {
-               inode->i_uid = 0;
-               inode->i_gid = 0;
        }
-       inode->i_blocks = 0;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 
        if (S_ISDIR(inf->mode)) {
index f2744ab4e5b35c415724034f3f5a3a328997cf99..e1158cb4fbd6c9568251696e749dbd56b6bdc588 100644 (file)
@@ -496,9 +496,6 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode)
 
        if (inode) {
                inode->i_mode = mode;
-               inode->i_uid = 0;
-               inode->i_gid = 0;
-               inode->i_blocks = 0;
                inode->i_atime = inode->i_mtime = inode->i_ctime =
                        current_fs_time(inode->i_sb);
        }
index 4803ccc944809a57a452721eed36d6656d90af60..5d349d38e0561c4fd66e67bbda76c5f91ca87c69 100644 (file)
@@ -117,8 +117,6 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
 static inline void set_default_inode_attr(struct inode * inode, mode_t mode)
 {
        inode->i_mode = mode;
-       inode->i_uid = 0;
-       inode->i_gid = 0;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 }
 
@@ -136,7 +134,6 @@ struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent * sd)
 {
        struct inode * inode = new_inode(configfs_sb);
        if (inode) {
-               inode->i_blocks = 0;
                inode->i_mapping->a_ops = &configfs_aops;
                inode->i_mapping->backing_dev_info = &configfs_backing_dev_info;
                inode->i_op = &configfs_inode_operations;
index f40423eb1a14e66b73693f5505a54f00b3bd6f4a..a07338d2d140818770865aca94dfc2337e9527a6 100644 (file)
@@ -83,8 +83,6 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
                        inode->i_op = &page_symlink_inode_operations;
                        inode->i_data.a_ops = &cramfs_aops;
                } else {
-                       inode->i_size = 0;
-                       inode->i_blocks = 0;
                        init_special_inode(inode, inode->i_mode,
                                old_decode_dev(cramfs_inode->size));
                }
index 3dbe2169cf36358730317f3ac563cf985c3cbc0b..81ae9ea3c6e1c34e645e4d2541066ddb1f33a9ad 100644 (file)
@@ -37,9 +37,6 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
 
        if (inode) {
                inode->i_mode = mode;
-               inode->i_uid = 0;
-               inode->i_gid = 0;
-               inode->i_blocks = 0;
                inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
                switch (mode & S_IFMT) {
                default:
index fff96e152c0c16f18c3cecffd4ffae5b0604c2e0..5f3231b9633fd1192c3eb974c49f90e2f7addf89 100644 (file)
@@ -189,8 +189,6 @@ static int mknod_ptmx(struct super_block *sb)
        }
 
        inode->i_ino = 2;
-       inode->i_uid = inode->i_gid = 0;
-       inode->i_blocks = 0;
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
 
        mode = S_IFCHR|opts->ptmxmode;
@@ -300,8 +298,6 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
                goto free_fsi;
        inode->i_ino = 1;
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
-       inode->i_blocks = 0;
-       inode->i_uid = inode->i_gid = 0;
        inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
        inode->i_op = &simple_dir_inode_operations;
        inode->i_fop = &simple_dir_operations;
index 7d479ce3aceb602c687a7f022a7d3d6c1284de0f..0ab0c6f5f4383d177f07ae200163e6a3d80d703b 100644 (file)
@@ -506,7 +506,6 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid,
                inode->i_mode = mode;
                inode->i_uid = uid;
                inode->i_gid = gid;
-               inode->i_blocks = 0;
                inode->i_mapping->a_ops = &hugetlbfs_aops;
                inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info;
                inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
index 7de1cda9248911241ead5c5c08f6033956bbe343..bd48e5e6d3e812b9965e8d2eca8fca0eab9e33ae 100644 (file)
@@ -131,6 +131,8 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode)
        inode->i_op = &empty_iops;
        inode->i_fop = &empty_fops;
        inode->i_nlink = 1;
+       inode->i_uid = 0;
+       inode->i_gid = 0;
        atomic_set(&inode->i_writecount, 0);
        inode->i_size = 0;
        inode->i_blocks = 0;
index e960a8321902cad9398447f3434f31f90a0f2b3c..7de05f7ce746d31dbb18374ba5ef8a37804392ef 100644 (file)
@@ -231,7 +231,6 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name,
         */
        root->i_ino = 1;
        root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
-       root->i_uid = root->i_gid = 0;
        root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME;
        dentry = d_alloc(NULL, &d_name);
        if (!dentry) {
@@ -436,8 +435,6 @@ int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files
         */
        inode->i_ino = 1;
        inode->i_mode = S_IFDIR | 0755;
-       inode->i_uid = inode->i_gid = 0;
-       inode->i_blocks = 0;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        inode->i_op = &simple_dir_inode_operations;
        inode->i_fop = &simple_dir_operations;
@@ -464,8 +461,6 @@ int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files
                if (!inode)
                        goto out;
                inode->i_mode = S_IFREG | files->mode;
-               inode->i_uid = inode->i_gid = 0;
-               inode->i_blocks = 0;
                inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
                inode->i_fop = files->ops;
                inode->i_ino = i;
index 6f7a77d5402001071f4f75a6f7ccbf5cf666a537..1c9efb406a96b98a36fa5ae5450198b6e8e8a067 100644 (file)
@@ -341,7 +341,6 @@ static struct inode *dlmfs_get_root_inode(struct super_block *sb)
                inode->i_mode = mode;
                inode->i_uid = current_fsuid();
                inode->i_gid = current_fsgid();
-               inode->i_blocks = 0;
                inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
                inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
                inc_nlink(inode);
@@ -367,7 +366,6 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
        inode->i_mode = mode;
        inode->i_uid = current_fsuid();
        inode->i_gid = current_fsgid();
-       inode->i_blocks = 0;
        inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 
index 6afe57c84f849f33560981ed87f9d5a3b2c96afd..633e9dc972bbc63edb052e89cd924aad8e25e8c3 100644 (file)
@@ -39,7 +39,6 @@ struct inode *omfs_new_inode(struct inode *dir, int mode)
        inode->i_mode = mode;
        inode->i_uid = current_fsuid();
        inode->i_gid = current_fsgid();
-       inode->i_blocks = 0;
        inode->i_mapping->a_ops = &omfs_aops;
 
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
index d41bdc784de4e920c2966fe0d18d27228df95aed..ffcd04f0012c6aa67dcf2fa5990d4d162f835f5a 100644 (file)
@@ -256,9 +256,6 @@ found:
                break;
        }
 
-       inode->i_gid = 0;
-       inode->i_uid = 0;
-
        d_add(dentry, inode);
        return NULL;
 }
index cad92c1ac2b389c17ac84cbc841bf646592542aa..10fd5223d600aec609a2adb1ea8e1693dd923562 100644 (file)
@@ -1426,8 +1426,6 @@ static struct inode *proc_pid_make_inode(struct super_block * sb, struct task_st
        if (!ei->pid)
                goto out_unlock;
 
-       inode->i_uid = 0;
-       inode->i_gid = 0;
        if (task_dumpable(task)) {
                rcu_read_lock();
                cred = __task_cred(task);
@@ -2349,8 +2347,6 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
        if (!ei->pid)
                goto out_iput;
 
-       inode->i_uid = 0;
-       inode->i_gid = 0;
        inode->i_mode = p->mode;
        if (S_ISDIR(inode->i_mode))
                inode->i_nlink = 2;
index 06ed10b7da9ee17e9dae1d63ec2b09435aefa551..94fcfff6863a5976965b8d4253ff3ad1ac45386b 100644 (file)
@@ -31,7 +31,6 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
        inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
        inode->i_flags |= S_PRIVATE; /* tell selinux to ignore this inode */
        inode->i_mode = table->mode;
-       inode->i_uid = inode->i_gid = 0;
        if (!table->child) {
                inode->i_mode |= S_IFREG;
                inode->i_op = &proc_sys_inode_operations;
index a83a3518ae331134458a72df0208249a90b8ee09..b7e6ac706b87b30ba96701b3bb7820e47f319218 100644 (file)
@@ -57,7 +57,6 @@ struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev)
                inode->i_mode = mode;
                inode->i_uid = current_fsuid();
                inode->i_gid = current_fsgid();
-               inode->i_blocks = 0;
                inode->i_mapping->a_ops = &ramfs_aops;
                inode->i_mapping->backing_dev_info = &ramfs_backing_dev_info;
                mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER);
index 60d2f822e87befa396bb31f78ca53b13a378e7ef..c97d4c931715767bff385ece2600f1504d2483af 100644 (file)
@@ -524,7 +524,6 @@ romfs_iget(struct super_block *sb, unsigned long ino)
        i->i_size = be32_to_cpu(ri.size);
        i->i_mtime.tv_sec = i->i_atime.tv_sec = i->i_ctime.tv_sec = 0;
        i->i_mtime.tv_nsec = i->i_atime.tv_nsec = i->i_ctime.tv_nsec = 0;
-       i->i_uid = i->i_gid = 0;
 
         /* Precalculate the data offset */
         ino = romfs_strnlen(i, ino+ROMFH_SIZE, ROMFS_MAXFN);
index eb53c632f8564a100d92e4670b8c6764776a3514..dfa3d94cfc74a33b5bf342ea1a5e7c9ad346109c 100644 (file)
@@ -107,8 +107,6 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
 static inline void set_default_inode_attr(struct inode * inode, mode_t mode)
 {
        inode->i_mode = mode;
-       inode->i_uid = 0;
-       inode->i_gid = 0;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
 }
 
@@ -149,7 +147,6 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
 {
        struct bin_attribute *bin_attr;
 
-       inode->i_blocks = 0;
        inode->i_mapping->a_ops = &sysfs_aops;
        inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info;
        inode->i_op = &sysfs_inode_operations;
index d9393f8e4c3ebb2ec4a63cd64290f237e45a4f83..41b72f02fa70d31959d3bb85ffdfd1fbe9e46f1d 100644 (file)
@@ -120,7 +120,6 @@ static struct inode *mqueue_get_inode(struct super_block *sb, int mode,
                inode->i_mode = mode;
                inode->i_uid = current_fsuid();
                inode->i_gid = current_fsgid();
-               inode->i_blocks = 0;
                inode->i_mtime = inode->i_ctime = inode->i_atime =
                                CURRENT_TIME;
 
index 48348dde6d814ea52270edee180c3db89da5d0c4..f7c5099a057204a3c9652d494b458d15aa2bf84b 100644 (file)
@@ -573,7 +573,6 @@ static struct inode *cgroup_new_inode(mode_t mode, struct super_block *sb)
                inode->i_mode = mode;
                inode->i_uid = current_fsuid();
                inode->i_gid = current_fsgid();
-               inode->i_blocks = 0;
                inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
                inode->i_mapping->backing_dev_info = &cgroup_backing_dev_info;
        }
index 19245324887011f358adab5baa5a28d38811549f..577385a4a5dc51219f1b2d6c8e6dec8568b3c2af 100644 (file)
@@ -522,8 +522,6 @@ rpc_get_inode(struct super_block *sb, int mode)
        if (!inode)
                return NULL;
        inode->i_mode = mode;
-       inode->i_uid = inode->i_gid = 0;
-       inode->i_blocks = 0;
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        switch(mode & S_IFMT) {
                case S_IFDIR:
index efea5a6054663f2d2aba78930bd3185986e14cdd..007ef252dde7b966661f2d1f9d8df4f47cb72927 100644 (file)
@@ -61,9 +61,6 @@ static struct inode *get_inode(struct super_block *sb, int mode, dev_t dev)
 
        if (inode) {
                inode->i_mode = mode;
-               inode->i_uid = 0;
-               inode->i_gid = 0;
-               inode->i_blocks = 0;
                inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
                switch (mode & S_IFMT) {
                default:
index e5520996a75be16960c09324ac572e36de06eac2..8f612c8becb5de8637644df36c75ffaff632ad9a 100644 (file)
@@ -847,8 +847,6 @@ static struct inode *sel_make_inode(struct super_block *sb, int mode)
 
        if (ret) {
                ret->i_mode = mode;
-               ret->i_uid = ret->i_gid = 0;
-               ret->i_blocks = 0;
                ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
        }
        return ret;