* [PATCH 16/19] sysv: replace inode uid,gid,mode initialization with helper function
2010-02-17 18:29 [PATCH 00/19] fs cleanup: remove duplicated code on inode init Dmitry Monakhov
@ 2010-02-17 18:45 ` Dmitry Monakhov
0 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-02-17 18:45 UTC (permalink / raw)
To: linux-fsdevel; +Cc: hch, Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/sysv/ialloc.c | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/fs/sysv/ialloc.c b/fs/sysv/ialloc.c
index 241e976..bbd69bd 100644
--- a/fs/sysv/ialloc.c
+++ b/fs/sysv/ialloc.c
@@ -159,15 +159,7 @@ struct inode * sysv_new_inode(const struct inode * dir, mode_t mode)
*sbi->s_sb_fic_count = cpu_to_fs16(sbi, count);
fs16_add(sbi, sbi->s_sb_total_free_inodes, -1);
dirty_sb(sb);
-
- if (dir->i_mode & S_ISGID) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- mode |= S_ISGID;
- } else
- inode->i_gid = current_fsgid();
-
- inode->i_uid = current_fsuid();
+ inode_init_owner(inode, dir, mode);
inode->i_ino = fs16_to_cpu(sbi, ino);
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
inode->i_blocks = 0;
@@ -176,7 +168,6 @@ struct inode * sysv_new_inode(const struct inode * dir, mode_t mode)
insert_inode_hash(inode);
mark_inode_dirty(inode);
- inode->i_mode = mode; /* for sysv_write_inode() */
sysv_write_inode(inode, 0); /* ensure inode not allocated again */
mark_inode_dirty(inode); /* cleared by sysv_write_inode() */
/* That's it. */
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2
@ 2010-03-04 14:28 Dmitry Monakhov
2010-03-04 14:29 ` [PATCH 01/19] vfs: Add inode uid,gid,mode init helper v2 Dmitry Monakhov
` (18 more replies)
0 siblings, 19 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:28 UTC (permalink / raw)
To: linux-fsdevel; +Cc: viro, Dmitry Monakhov
Al Please take care of the first patch(the vfs helper).
But it will be good if you also take the others.
Each filesystem init uid,gid,mode on inode creation.
gid inheritance is obey to posix rules. Usually this code is
copy-pasted. Some times it was done in wrong way.
Let's move this logic to separate function.
In some filesystems it is not easy to replace the code, so i've
simply skipped such fs.
Skipped fs: xfs, hugetlbfs, gfs2, cifs, affs
Some filesystems require less trivial code replacement
so i've split the patch on to per-fs basis.
Patch prepared against vfs/untested tree, but it also may
be applied on top of linux-next-2010-03-04.
There was some rejects from ocfs2's patch on linux-next tree
because of dlm changes. So i've skipp dlm changes in ocfs2's patch.
I'll send dlm changes to ocfs2 mainainers directly after
core vfs helpers changes appears in linux-next tree.
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 01/19] vfs: Add inode uid,gid,mode init helper v2
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
@ 2010-03-04 14:29 ` Dmitry Monakhov
2010-03-04 14:30 ` [PATCH 02/19] 9p: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
` (17 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:29 UTC (permalink / raw)
To: linux-fsdevel; +Cc: viro, Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/namei.c | 19 +++++++++++++++++++
include/linux/fs.h | 3 ++-
2 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index 644cc66..ad1eb1c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1391,6 +1391,25 @@ void unlock_rename(struct dentry *p1, struct dentry *p2)
mutex_unlock(&p1->d_inode->i_sb->s_vfs_rename_mutex);
}
}
+/**
+ * Init uid,gid,mode for new inode according to posix standards
+ * @inode: New inode
+ * @dir: Directory inode
+ * @mode: mode of the new inode
+ */
+void inode_init_owner(struct inode *inode, const struct inode *dir,
+ int mode)
+{
+ inode->i_uid = current_fsuid();
+ if (dir && dir->i_mode & S_ISGID) {
+ inode->i_gid = dir->i_gid;
+ if (S_ISDIR(mode))
+ mode |= S_ISGID;
+ } else
+ inode->i_gid = current_fsgid();
+ inode->i_mode = mode;
+}
+EXPORT_SYMBOL(inode_init_owner);
int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
struct nameidata *nd)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index cd32f1b..22e4b53 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1426,7 +1426,8 @@ extern void dentry_unhash(struct dentry *dentry);
* VFS file helper functions.
*/
extern int file_permission(struct file *, int);
-
+extern void inode_init_owner(struct inode *inode, const struct inode *dir,
+ int mode);
/*
* VFS FS_IOC_FIEMAP helper definitions.
*/
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 02/19] 9p: replace inode uid,gid,mode initialization with helper function
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
2010-03-04 14:29 ` [PATCH 01/19] vfs: Add inode uid,gid,mode init helper v2 Dmitry Monakhov
@ 2010-03-04 14:30 ` Dmitry Monakhov
2010-03-04 14:30 ` [PATCH 09/19] jfs: replace inode uid,gid,mode init with helper v2 Dmitry Monakhov
` (16 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:30 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/9p/vfs_inode.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 9d03d1e..037b67e 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -252,9 +252,7 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
return ERR_PTR(-ENOMEM);
}
- inode->i_mode = mode;
- inode->i_uid = current_fsuid();
- inode->i_gid = current_fsgid();
+ inode_init_owner(inode, NULL, mode);
inode->i_blocks = 0;
inode->i_rdev = 0;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 09/19] jfs: replace inode uid,gid,mode init with helper v2
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
2010-03-04 14:29 ` [PATCH 01/19] vfs: Add inode uid,gid,mode init helper v2 Dmitry Monakhov
2010-03-04 14:30 ` [PATCH 02/19] 9p: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
@ 2010-03-04 14:30 ` Dmitry Monakhov
2010-03-04 14:31 ` [PATCH 03/19] bfs: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
` (15 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:30 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Acked-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/jfs/jfs_inode.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c
index dc0e021..705646d 100644
--- a/fs/jfs/jfs_inode.c
+++ b/fs/jfs/jfs_inode.c
@@ -98,14 +98,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
goto fail_unlock;
}
- inode->i_uid = current_fsuid();
- if (parent->i_mode & S_ISGID) {
- inode->i_gid = parent->i_gid;
- if (S_ISDIR(mode))
- mode |= S_ISGID;
- } else
- inode->i_gid = current_fsgid();
-
+ inode_init_owner(inode, parent, mode);
/*
* New inodes need to save sane values on disk when
* uid & gid mount options are used
@@ -121,7 +114,6 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
goto fail_drop;
}
- inode->i_mode = mode;
/* inherit flags from parent */
jfs_inode->mode2 = JFS_IP(parent)->mode2 & JFS_FL_INHERIT;
@@ -134,7 +126,7 @@ struct inode *ialloc(struct inode *parent, umode_t mode)
if (S_ISLNK(mode))
jfs_inode->mode2 &= ~(JFS_IMMUTABLE_FL|JFS_APPEND_FL);
}
- jfs_inode->mode2 |= mode;
+ jfs_inode->mode2 |= inode->i_mode;
inode->i_blocks = 0;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 03/19] bfs: replace inode uid,gid,mode initialization with helper function
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (2 preceding siblings ...)
2010-03-04 14:30 ` [PATCH 09/19] jfs: replace inode uid,gid,mode init with helper v2 Dmitry Monakhov
@ 2010-03-04 14:31 ` Dmitry Monakhov
2010-03-04 14:31 ` [PATCH 04/19] btrfs: " Dmitry Monakhov
` (14 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:31 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/bfs/dir.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index 1e41aad..8f73841 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -105,14 +105,12 @@ static int bfs_create(struct inode *dir, struct dentry *dentry, int mode,
}
set_bit(ino, info->si_imap);
info->si_freei--;
- inode->i_uid = current_fsuid();
- inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current_fsgid();
+ inode_init_owner(inode, dir, mode);
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
inode->i_blocks = 0;
inode->i_op = &bfs_file_inops;
inode->i_fop = &bfs_file_operations;
inode->i_mapping->a_ops = &bfs_aops;
- inode->i_mode = mode;
inode->i_ino = ino;
BFS_I(inode)->i_dsk_ino = ino;
BFS_I(inode)->i_sblock = 0;
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 04/19] btrfs: replace inode uid,gid,mode initialization with helper function
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (3 preceding siblings ...)
2010-03-04 14:31 ` [PATCH 03/19] bfs: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
@ 2010-03-04 14:31 ` Dmitry Monakhov
2010-03-04 14:31 ` [PATCH 05/19] exofs: " Dmitry Monakhov
` (13 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:31 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/btrfs/inode.c | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c41db6d..a54561f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4145,16 +4145,7 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
if (ret != 0)
goto fail;
- inode->i_uid = current_fsuid();
-
- if (dir && (dir->i_mode & S_ISGID)) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- mode |= S_ISGID;
- } else
- inode->i_gid = current_fsgid();
-
- inode->i_mode = mode;
+ inode_init_owner(inode, dir, mode);
inode->i_ino = objectid;
inode_set_bytes(inode, 0);
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 05/19] exofs: replace inode uid,gid,mode initialization with helper function
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (4 preceding siblings ...)
2010-03-04 14:31 ` [PATCH 04/19] btrfs: " Dmitry Monakhov
@ 2010-03-04 14:31 ` Dmitry Monakhov
2010-03-04 14:31 ` [PATCH 06/19] ext2: replace inode uid,gid,mode init with helper v2 Dmitry Monakhov
` (12 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:31 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Ack-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/exofs/inode.c | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 316e3af..5a7064a 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -1083,16 +1083,7 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
sbi = sb->s_fs_info;
sb->s_dirt = 1;
- inode->i_uid = current->cred->fsuid;
- if (dir->i_mode & S_ISGID) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- mode |= S_ISGID;
- } else {
- inode->i_gid = current->cred->fsgid;
- }
- inode->i_mode = mode;
-
+ inode_init_owner(inode, dir, mode);
inode->i_ino = sbi->s_nextid++;
inode->i_blkbits = EXOFS_BLKSHIFT;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 06/19] ext2: replace inode uid,gid,mode init with helper v2
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (5 preceding siblings ...)
2010-03-04 14:31 ` [PATCH 05/19] exofs: " Dmitry Monakhov
@ 2010-03-04 14:31 ` Dmitry Monakhov
2010-03-04 14:31 ` [PATCH 07/19] ext3: " Dmitry Monakhov
` (11 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:31 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ext2/ialloc.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 15387c9..2c484c6 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -550,16 +550,12 @@ got:
sb->s_dirt = 1;
mark_buffer_dirty(bh2);
- inode->i_uid = current_fsuid();
- if (test_opt (sb, GRPID))
+ if (test_opt(sb, GRPID)) {
+ inode->i_mode = mode;
+ inode->i_uid = current_fsuid();
inode->i_gid = dir->i_gid;
- else if (dir->i_mode & S_ISGID) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- mode |= S_ISGID;
} else
- inode->i_gid = current_fsgid();
- inode->i_mode = mode;
+ inode_init_owner(inode, dir, mode);
inode->i_ino = ino;
inode->i_blocks = 0;
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 07/19] ext3: replace inode uid,gid,mode init with helper v2
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (6 preceding siblings ...)
2010-03-04 14:31 ` [PATCH 06/19] ext2: replace inode uid,gid,mode init with helper v2 Dmitry Monakhov
@ 2010-03-04 14:31 ` Dmitry Monakhov
2010-03-04 14:31 ` [PATCH 08/19] ext4: " Dmitry Monakhov
` (10 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:31 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ext3/ialloc.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index b399912..1a48294 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -538,16 +538,13 @@ got:
if (S_ISDIR(mode))
percpu_counter_inc(&sbi->s_dirs_counter);
- inode->i_uid = current_fsuid();
- if (test_opt (sb, GRPID))
- inode->i_gid = dir->i_gid;
- else if (dir->i_mode & S_ISGID) {
+
+ if (test_opt(sb, GRPID)) {
+ inode->i_mode = mode;
+ inode->i_uid = current_fsuid();
inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- mode |= S_ISGID;
} else
- inode->i_gid = current_fsgid();
- inode->i_mode = mode;
+ inode_init_owner(inode, dir, mode);
inode->i_ino = ino;
/* This is the optimal IO size (for stat), not the fs block size */
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 08/19] ext4: replace inode uid,gid,mode init with helper v2
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (7 preceding siblings ...)
2010-03-04 14:31 ` [PATCH 07/19] ext3: " Dmitry Monakhov
@ 2010-03-04 14:31 ` Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 10/19] minix: replace inode uid,gid,mode init with helper Dmitry Monakhov
` (9 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:31 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ext4/ialloc.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index f3624ea..a2a35d3 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -985,16 +985,12 @@ got:
atomic_dec(&sbi->s_flex_groups[flex_group].free_inodes);
}
- inode->i_uid = current_fsuid();
- if (test_opt(sb, GRPID))
+ if (test_opt(sb, GRPID)) {
+ inode->i_mode = mode;
+ inode->i_uid = current_fsuid();
inode->i_gid = dir->i_gid;
- else if (dir->i_mode & S_ISGID) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- mode |= S_ISGID;
} else
- inode->i_gid = current_fsgid();
- inode->i_mode = mode;
+ inode_init_owner(inode, dir, mode);
inode->i_ino = ino + group * EXT4_INODES_PER_GROUP(sb);
/* This is the optimal IO size (for stat), not the fs block size */
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 10/19] minix: replace inode uid,gid,mode init with helper
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (8 preceding siblings ...)
2010-03-04 14:31 ` [PATCH 08/19] ext4: " Dmitry Monakhov
@ 2010-03-04 14:32 ` Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 11/19] nilfs2: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
` (8 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:32 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
- also redesign minix_new_inode interface
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/minix/bitmap.c | 5 ++---
fs/minix/minix.h | 3 ++-
fs/minix/namei.c | 11 +++--------
3 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c
index 6ac693f..dc7f625 100644
--- a/fs/minix/bitmap.c
+++ b/fs/minix/bitmap.c
@@ -221,7 +221,7 @@ void minix_free_inode(struct inode * inode)
clear_inode(inode); /* clear in-memory copy */
}
-struct inode * minix_new_inode(const struct inode * dir, int * error)
+struct inode * minix_new_inode(const struct inode * dir, int mode, int * error)
{
struct super_block *sb = dir->i_sb;
struct minix_sb_info *sbi = minix_sb(sb);
@@ -263,8 +263,7 @@ struct inode * minix_new_inode(const struct inode * dir, int * error)
iput(inode);
return NULL;
}
- inode->i_uid = current_fsuid();
- inode->i_gid = (dir->i_mode & S_ISGID) ? dir->i_gid : current_fsgid();
+ inode_init_owner(inode, dir, mode);
inode->i_ino = j;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
inode->i_blocks = 0;
diff --git a/fs/minix/minix.h b/fs/minix/minix.h
index 9dcf95b..b4355b1 100644
--- a/fs/minix/minix.h
+++ b/fs/minix/minix.h
@@ -46,7 +46,8 @@ struct minix_sb_info {
extern struct inode *minix_iget(struct super_block *, unsigned long);
extern struct minix_inode * minix_V1_raw_inode(struct super_block *, ino_t, struct buffer_head **);
extern struct minix2_inode * minix_V2_raw_inode(struct super_block *, ino_t, struct buffer_head **);
-extern struct inode * minix_new_inode(const struct inode * dir, int * error);
+extern struct inode * minix_new_inode(const struct inode * dir, int mode,
+ int * error);
extern void minix_free_inode(struct inode * inode);
extern unsigned long minix_count_free_inodes(struct minix_sb_info *sbi);
extern int minix_new_block(struct inode * inode);
diff --git a/fs/minix/namei.c b/fs/minix/namei.c
index 32b131c..e20ee85 100644
--- a/fs/minix/namei.c
+++ b/fs/minix/namei.c
@@ -46,10 +46,9 @@ static int minix_mknod(struct inode * dir, struct dentry *dentry, int mode, dev_
if (!old_valid_dev(rdev))
return -EINVAL;
- inode = minix_new_inode(dir, &error);
+ inode = minix_new_inode(dir, mode, &error);
if (inode) {
- inode->i_mode = mode;
minix_set_inode(inode, rdev);
mark_inode_dirty(inode);
error = add_nondir(dentry, inode);
@@ -73,11 +72,10 @@ static int minix_symlink(struct inode * dir, struct dentry *dentry,
if (i > dir->i_sb->s_blocksize)
goto out;
- inode = minix_new_inode(dir, &err);
+ inode = minix_new_inode(dir, S_IFLNK | 0777, &err);
if (!inode)
goto out;
- inode->i_mode = S_IFLNK | 0777;
minix_set_inode(inode, 0);
err = page_symlink(inode, symname, i);
if (err)
@@ -117,13 +115,10 @@ static int minix_mkdir(struct inode * dir, struct dentry *dentry, int mode)
inode_inc_link_count(dir);
- inode = minix_new_inode(dir, &err);
+ inode = minix_new_inode(dir, mode, &err);
if (!inode)
goto out_dir;
- inode->i_mode = S_IFDIR | mode;
- if (dir->i_mode & S_ISGID)
- inode->i_mode |= S_ISGID;
minix_set_inode(inode, 0);
inode_inc_link_count(inode);
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 11/19] nilfs2: replace inode uid,gid,mode initialization with helper function
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (9 preceding siblings ...)
2010-03-04 14:32 ` [PATCH 10/19] minix: replace inode uid,gid,mode init with helper Dmitry Monakhov
@ 2010-03-04 14:32 ` Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 12/19] ocfs2: " Dmitry Monakhov
` (7 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:32 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Acked-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/nilfs2/inode.c | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 7868cc1..5d8e866 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -279,16 +279,7 @@ struct inode *nilfs_new_inode(struct inode *dir, int mode)
/* reference count of i_bh inherits from nilfs_mdt_read_block() */
atomic_inc(&sbi->s_inodes_count);
-
- inode->i_uid = current_fsuid();
- if (dir->i_mode & S_ISGID) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- mode |= S_ISGID;
- } else
- inode->i_gid = current_fsgid();
-
- inode->i_mode = mode;
+ inode_init_owner(inode, dir, mode);
inode->i_ino = ino;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 12/19] ocfs2: replace inode uid,gid,mode initialization with helper function
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (10 preceding siblings ...)
2010-03-04 14:32 ` [PATCH 11/19] nilfs2: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
@ 2010-03-04 14:32 ` Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 13/19] omfs: " Dmitry Monakhov
` (6 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:32 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ocfs2/namei.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 50fb26a..2877404 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -204,14 +204,7 @@ static struct inode *ocfs2_get_init_inode(struct inode *dir, int mode)
inode->i_nlink = 2;
else
inode->i_nlink = 1;
- inode->i_uid = current_fsuid();
- if (dir->i_mode & S_ISGID) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- mode |= S_ISGID;
- } else
- inode->i_gid = current_fsgid();
- inode->i_mode = mode;
+ inode_init_owner(inode, dir, mode);
vfs_dq_init(inode);
return inode;
}
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 13/19] omfs: replace inode uid,gid,mode initialization with helper function
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (11 preceding siblings ...)
2010-03-04 14:32 ` [PATCH 12/19] ocfs2: " Dmitry Monakhov
@ 2010-03-04 14:32 ` Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 14/19] ramfs: " Dmitry Monakhov
` (5 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:32 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/omfs/inode.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index 75d9b5b..4029aa6 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -37,9 +37,7 @@ struct inode *omfs_new_inode(struct inode *dir, int mode)
goto fail;
inode->i_ino = new_block;
- inode->i_mode = mode;
- inode->i_uid = current_fsuid();
- inode->i_gid = current_fsgid();
+ inode_init_owner(inode, NULL, mode);
inode->i_mapping->a_ops = &omfs_aops;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 14/19] ramfs: replace inode uid,gid,mode initialization with helper function
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (12 preceding siblings ...)
2010-03-04 14:32 ` [PATCH 13/19] omfs: " Dmitry Monakhov
@ 2010-03-04 14:32 ` Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 15/19] reiserfs: " Dmitry Monakhov
` (4 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:32 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
- seems what ramfs_get_inode is only locally, make it static.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ramfs/inode.c | 20 ++++++--------------
include/linux/ramfs.h | 1 -
2 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index a6090aa..ac55307 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -51,14 +51,13 @@ static struct backing_dev_info ramfs_backing_dev_info = {
BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP,
};
-struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev)
+static struct inode *ramfs_get_inode(struct super_block *sb,
+ const struct inode *dir, int mode, dev_t dev)
{
struct inode * inode = new_inode(sb);
if (inode) {
- inode->i_mode = mode;
- inode->i_uid = current_fsuid();
- inode->i_gid = current_fsgid();
+ inode_init_owner(inode, dir, mode);
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);
@@ -94,15 +93,10 @@ struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev)
static int
ramfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
{
- struct inode * inode = ramfs_get_inode(dir->i_sb, mode, dev);
+ struct inode * inode = ramfs_get_inode(dir->i_sb, dir, mode, dev);
int error = -ENOSPC;
if (inode) {
- if (dir->i_mode & S_ISGID) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- inode->i_mode |= S_ISGID;
- }
d_instantiate(dentry, inode);
dget(dentry); /* Extra count - pin the dentry in core */
error = 0;
@@ -129,13 +123,11 @@ static int ramfs_symlink(struct inode * dir, struct dentry *dentry, const char *
struct inode *inode;
int error = -ENOSPC;
- inode = ramfs_get_inode(dir->i_sb, S_IFLNK|S_IRWXUGO, 0);
+ inode = ramfs_get_inode(dir->i_sb, dir, S_IFLNK|S_IRWXUGO, 0);
if (inode) {
int l = strlen(symname)+1;
error = page_symlink(inode, symname, l);
if (!error) {
- if (dir->i_mode & S_ISGID)
- inode->i_gid = dir->i_gid;
d_instantiate(dentry, inode);
dget(dentry);
dir->i_mtime = dir->i_ctime = CURRENT_TIME;
@@ -240,7 +232,7 @@ static int ramfs_fill_super(struct super_block * sb, void * data, int silent)
sb->s_op = &ramfs_ops;
sb->s_time_gran = 1;
- inode = ramfs_get_inode(sb, S_IFDIR | fsi->mount_opts.mode, 0);
+ inode = ramfs_get_inode(sb, NULL, S_IFDIR | fsi->mount_opts.mode, 0);
if (!inode) {
err = -ENOMEM;
goto fail;
diff --git a/include/linux/ramfs.h b/include/linux/ramfs.h
index 4e768dd..6ee2bb9 100644
--- a/include/linux/ramfs.h
+++ b/include/linux/ramfs.h
@@ -1,7 +1,6 @@
#ifndef _LINUX_RAMFS_H
#define _LINUX_RAMFS_H
-struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev);
extern int ramfs_get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data, struct vfsmount *mnt);
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 15/19] reiserfs: replace inode uid,gid,mode initialization with helper function
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (13 preceding siblings ...)
2010-03-04 14:32 ` [PATCH 14/19] ramfs: " Dmitry Monakhov
@ 2010-03-04 14:32 ` Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 16/19] sysv: " Dmitry Monakhov
` (3 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:32 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/reiserfs/namei.c | 17 ++++-------------
1 files changed, 4 insertions(+), 13 deletions(-)
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 9d4dcf0..e138e0a 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -561,22 +561,13 @@ static int drop_new_inode(struct inode *inode)
static int new_inode_init(struct inode *inode, struct inode *dir, int mode)
{
- /* the quota init calls have to know who to charge the quota to, so
- ** we have to set uid and gid here
- */
- inode->i_uid = current_fsuid();
- inode->i_mode = mode;
/* Make inode invalid - just in case we are going to drop it before
* the initialization happens */
INODE_PKEY(inode)->k_objectid = 0;
-
- if (dir->i_mode & S_ISGID) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- inode->i_mode |= S_ISGID;
- } else {
- inode->i_gid = current_fsgid();
- }
+ /* the quota init calls have to know who to charge the quota to, so
+ ** we have to set uid and gid here
+ */
+ inode_init_owner(inode, dir, mode);
vfs_dq_init(inode);
return 0;
}
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 16/19] sysv: replace inode uid,gid,mode initialization with helper function
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (14 preceding siblings ...)
2010-03-04 14:32 ` [PATCH 15/19] reiserfs: " Dmitry Monakhov
@ 2010-03-04 14:32 ` Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 17/19] ubifs: " Dmitry Monakhov
` (2 subsequent siblings)
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:32 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/sysv/ialloc.c | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/fs/sysv/ialloc.c b/fs/sysv/ialloc.c
index 241e976..bbd69bd 100644
--- a/fs/sysv/ialloc.c
+++ b/fs/sysv/ialloc.c
@@ -159,15 +159,7 @@ struct inode * sysv_new_inode(const struct inode * dir, mode_t mode)
*sbi->s_sb_fic_count = cpu_to_fs16(sbi, count);
fs16_add(sbi, sbi->s_sb_total_free_inodes, -1);
dirty_sb(sb);
-
- if (dir->i_mode & S_ISGID) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- mode |= S_ISGID;
- } else
- inode->i_gid = current_fsgid();
-
- inode->i_uid = current_fsuid();
+ inode_init_owner(inode, dir, mode);
inode->i_ino = fs16_to_cpu(sbi, ino);
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
inode->i_blocks = 0;
@@ -176,7 +168,6 @@ struct inode * sysv_new_inode(const struct inode * dir, mode_t mode)
insert_inode_hash(inode);
mark_inode_dirty(inode);
- inode->i_mode = mode; /* for sysv_write_inode() */
sysv_write_inode(inode, 0); /* ensure inode not allocated again */
mark_inode_dirty(inode); /* cleared by sysv_write_inode() */
/* That's it. */
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 17/19] ubifs: replace inode uid,gid,mode initialization with helper function
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (15 preceding siblings ...)
2010-03-04 14:32 ` [PATCH 16/19] sysv: " Dmitry Monakhov
@ 2010-03-04 14:32 ` Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 18/19] udf: replace inode uid,gid,mode init with helper v3 Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 19/19] ufs: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:32 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ubifs/dir.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 401e503..87ebcce 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -104,14 +104,7 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir,
*/
inode->i_flags |= (S_NOCMTIME);
- inode->i_uid = current_fsuid();
- if (dir->i_mode & S_ISGID) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- mode |= S_ISGID;
- } else
- inode->i_gid = current_fsgid();
- inode->i_mode = mode;
+ inode_init_owner(inode, dir, mode);
inode->i_mtime = inode->i_atime = inode->i_ctime =
ubifs_current_time(inode);
inode->i_mapping->nrpages = 0;
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 18/19] udf: replace inode uid,gid,mode init with helper v3
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (16 preceding siblings ...)
2010-03-04 14:32 ` [PATCH 17/19] ubifs: " Dmitry Monakhov
@ 2010-03-04 14:32 ` Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 19/19] ufs: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:32 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/udf/ialloc.c | 11 ++---------
fs/udf/namei.c | 10 ++--------
2 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index c10fa39..52d6e4d 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -124,15 +124,8 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
udf_updated_lvid(sb);
}
mutex_unlock(&sbi->s_alloc_mutex);
- inode->i_mode = mode;
- inode->i_uid = current_fsuid();
- if (dir->i_mode & S_ISGID) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- mode |= S_ISGID;
- } else {
- inode->i_gid = current_fsgid();
- }
+
+ inode_init_owner(inode, dir, mode);
iinfo->i_location.logicalBlockNum = block;
iinfo->i_location.partitionReferenceNum =
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 7c56ff0..b7aed00 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -577,7 +577,6 @@ static int udf_create(struct inode *dir, struct dentry *dentry, int mode,
inode->i_data.a_ops = &udf_aops;
inode->i_op = &udf_file_inode_operations;
inode->i_fop = &udf_file_operations;
- inode->i_mode = mode;
mark_inode_dirty(inode);
fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err);
@@ -623,7 +622,6 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, int mode,
goto out;
iinfo = UDF_I(inode);
- inode->i_uid = current_fsuid();
init_special_inode(inode, mode, rdev);
fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err);
if (!fi) {
@@ -668,7 +666,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode)
goto out;
err = -EIO;
- inode = udf_new_inode(dir, S_IFDIR, &err);
+ inode = udf_new_inode(dir, S_IFDIR | mode, &err);
if (!inode)
goto out;
@@ -691,9 +689,6 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode)
FID_FILE_CHAR_DIRECTORY | FID_FILE_CHAR_PARENT;
udf_write_fi(inode, &cfi, fi, &fibh, NULL, NULL);
brelse(fibh.sbh);
- inode->i_mode = S_IFDIR | mode;
- if (dir->i_mode & S_ISGID)
- inode->i_mode |= S_ISGID;
mark_inode_dirty(inode);
fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err);
@@ -900,7 +895,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
struct udf_inode_info *iinfo;
lock_kernel();
- inode = udf_new_inode(dir, S_IFLNK, &err);
+ inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO, &err);
if (!inode)
goto out;
@@ -911,7 +906,6 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
}
iinfo = UDF_I(inode);
- inode->i_mode = S_IFLNK | S_IRWXUGO;
inode->i_data.a_ops = &udf_symlink_aops;
inode->i_op = &page_symlink_inode_operations;
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 19/19] ufs: replace inode uid,gid,mode initialization with helper function
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
` (17 preceding siblings ...)
2010-03-04 14:32 ` [PATCH 18/19] udf: replace inode uid,gid,mode init with helper v3 Dmitry Monakhov
@ 2010-03-04 14:32 ` Dmitry Monakhov
18 siblings, 0 replies; 21+ messages in thread
From: Dmitry Monakhov @ 2010-03-04 14:32 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ufs/ialloc.c | 10 +---------
1 files changed, 1 insertions(+), 9 deletions(-)
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c
index 3527c00..59b8315 100644
--- a/fs/ufs/ialloc.c
+++ b/fs/ufs/ialloc.c
@@ -303,15 +303,7 @@ cg_found:
sb->s_dirt = 1;
inode->i_ino = cg * uspi->s_ipg + bit;
- inode->i_mode = mode;
- inode->i_uid = current_fsuid();
- if (dir->i_mode & S_ISGID) {
- inode->i_gid = dir->i_gid;
- if (S_ISDIR(mode))
- inode->i_mode |= S_ISGID;
- } else
- inode->i_gid = current_fsgid();
-
+ inode_init_owner(inode, dir, mode);
inode->i_blocks = 0;
inode->i_generation = 0;
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
--
1.6.6
^ permalink raw reply related [flat|nested] 21+ messages in thread
end of thread, other threads:[~2010-03-04 14:32 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-04 14:28 [PATCH 00/19] fs cleanup: remove duplicated code on inode init v2 Dmitry Monakhov
2010-03-04 14:29 ` [PATCH 01/19] vfs: Add inode uid,gid,mode init helper v2 Dmitry Monakhov
2010-03-04 14:30 ` [PATCH 02/19] 9p: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
2010-03-04 14:30 ` [PATCH 09/19] jfs: replace inode uid,gid,mode init with helper v2 Dmitry Monakhov
2010-03-04 14:31 ` [PATCH 03/19] bfs: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
2010-03-04 14:31 ` [PATCH 04/19] btrfs: " Dmitry Monakhov
2010-03-04 14:31 ` [PATCH 05/19] exofs: " Dmitry Monakhov
2010-03-04 14:31 ` [PATCH 06/19] ext2: replace inode uid,gid,mode init with helper v2 Dmitry Monakhov
2010-03-04 14:31 ` [PATCH 07/19] ext3: " Dmitry Monakhov
2010-03-04 14:31 ` [PATCH 08/19] ext4: " Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 10/19] minix: replace inode uid,gid,mode init with helper Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 11/19] nilfs2: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 12/19] ocfs2: " Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 13/19] omfs: " Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 14/19] ramfs: " Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 15/19] reiserfs: " Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 16/19] sysv: " Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 17/19] ubifs: " Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 18/19] udf: replace inode uid,gid,mode init with helper v3 Dmitry Monakhov
2010-03-04 14:32 ` [PATCH 19/19] ufs: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
-- strict thread matches above, loose matches on Subject: below --
2010-02-17 18:29 [PATCH 00/19] fs cleanup: remove duplicated code on inode init Dmitry Monakhov
2010-02-17 18:45 ` [PATCH 16/19] sysv: replace inode uid,gid,mode initialization with helper function Dmitry Monakhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).