1 diff -urp RH_2_6_9_42_0_3.orig/fs/ext3/ialloc.c RH_2_6_9_42_0_3/fs/ext3/ialloc.c
2 --- RH_2_6_9_42_0_3.orig/fs/ext3/ialloc.c 2006-10-23 13:32:46.000000000 +0300
3 +++ RH_2_6_9_42_0_3/fs/ext3/ialloc.c 2007-02-16 07:22:28.000000000 +0200
4 @@ -419,7 +419,8 @@ static int find_group_other(struct super
5 * For other inodes, search forward from the parent directory's block
6 * group to find a free inode.
8 -struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
9 +struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode,
12 struct super_block *sb;
13 struct buffer_head *bitmap_bh = NULL;
14 @@ -447,6 +448,41 @@ struct inode *ext3_new_inode(handle_t *h
19 + group = (goal - 1) / EXT3_INODES_PER_GROUP(sb);
20 + ino = (goal - 1) % EXT3_INODES_PER_GROUP(sb);
23 + gdp = ext3_get_group_desc(sb, group, &bh2);
27 + bitmap_bh = read_inode_bitmap (sb, group);
31 + BUFFER_TRACE(bh, "get_write_access");
32 + err = ext3_journal_get_write_access(handle, bitmap_bh);
35 + if (ext3_set_bit_atomic(sb_bgl_lock(sbi, group),
36 + ino, bitmap_bh->b_data)) {
37 + printk(KERN_ERR "goal inode %lu unavailable\n", goal);
38 + /* Oh well, we tried. */
39 + goto continue_allocation;
42 + BUFFER_TRACE(bh, "call ext3_journal_dirty_metadata");
43 + err = ext3_journal_dirty_metadata(handle, bitmap_bh);
46 + /* We've shortcircuited the allocation system successfully,
47 + * now finish filling in the inode.
54 if (test_opt (sb, OLDALLOC))
55 group = find_group_dir(sb, dir);
56 diff -urp RH_2_6_9_42_0_3.orig/fs/ext3/ioctl.c RH_2_6_9_42_0_3/fs/ext3/ioctl.c
57 --- RH_2_6_9_42_0_3.orig/fs/ext3/ioctl.c 2006-10-23 13:32:46.000000000 +0300
58 +++ RH_2_6_9_42_0_3/fs/ext3/ioctl.c 2007-02-16 07:22:28.000000000 +0200
59 @@ -25,6 +25,31 @@ int ext3_ioctl (struct inode * inode, st
60 ext3_debug ("cmd = %u, arg = %lu\n", cmd, arg);
63 + case EXT3_IOC_CREATE_INUM: {
65 + struct dentry *dchild, *dparent;
68 + dparent = list_entry(inode->i_dentry.next, struct dentry,
70 + snprintf(name, sizeof name, "%lu", arg);
71 + dchild = lookup_one_len(name, dparent, strlen(name));
72 + if (dchild->d_inode) {
73 + printk(KERN_ERR "%*s/%lu already exists (ino %lu)\n",
74 + dparent->d_name.len, dparent->d_name.name, arg,
75 + dchild->d_inode->i_ino);
78 + dchild->d_fsdata = (void *)arg;
79 + rc = vfs_create(inode, dchild, 0644, NULL);
81 + printk(KERN_ERR "vfs_create: %d\n", rc);
82 + else if (dchild->d_inode->i_ino != arg)
88 case EXT3_IOC_GETFLAGS:
89 flags = ei->i_flags & EXT3_FL_USER_VISIBLE;
90 return put_user(flags, (int __user *) arg);
91 diff -urp RH_2_6_9_42_0_3.orig/fs/ext3/namei.c RH_2_6_9_42_0_3/fs/ext3/namei.c
92 --- RH_2_6_9_42_0_3.orig/fs/ext3/namei.c 2006-10-23 13:32:59.000000000 +0300
93 +++ RH_2_6_9_42_0_3/fs/ext3/namei.c 2007-02-22 18:58:13.000000000 +0200
94 @@ -97,6 +97,7 @@ struct dx_entry
100 * dx_root_info is laid out so that if it should somehow get overlaid by a
101 * dirent the two low bits of the hash version will be zero. Therefore, the
102 @@ -141,6 +142,14 @@ struct dx_map_entry
106 +#define LVFS_DENTRY_PARAM_MAGIC 20070216UL
107 +struct lvfs_dentry_params
109 + unsigned long p_inum;
114 #ifdef CONFIG_EXT3_INDEX
115 static inline unsigned dx_get_block (struct dx_entry *entry);
116 static void dx_set_block (struct dx_entry *entry, unsigned value);
117 @@ -1624,6 +1633,20 @@ static int ext3_add_nondir(handle_t *han
121 +static struct inode * ext3_new_inode_wantedi(handle_t *handle, struct inode *dir,
122 + int mode, struct dentry *dentry)
124 + unsigned long inum = 0;
126 + if (dentry->d_fsdata != NULL) {
127 + struct lvfs_dentry_params *param = dentry->d_fsdata;
129 + if (param->magic == LVFS_DENTRY_PARAM_MAGIC)
130 + inum = param->p_inum;
132 + return ext3_new_inode(handle, dir, mode, inum);
136 * By the time this is called, we already have created
137 * the directory cache entry for the new file, but it
138 @@ -1649,7 +1672,7 @@ retry:
142 - inode = ext3_new_inode (handle, dir, mode);
143 + inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
144 err = PTR_ERR(inode);
145 if (!IS_ERR(inode)) {
146 inode->i_op = &ext3_file_inode_operations;
147 @@ -1683,7 +1706,7 @@ retry:
151 - inode = ext3_new_inode (handle, dir, mode);
152 + inode = ext3_new_inode_wantedi (handle, dir, mode, dentry);
153 err = PTR_ERR(inode);
154 if (!IS_ERR(inode)) {
155 init_special_inode(inode, inode->i_mode, rdev);
156 @@ -1719,7 +1742,7 @@ retry:
160 - inode = ext3_new_inode (handle, dir, S_IFDIR | mode);
161 + inode = ext3_new_inode_wantedi (handle, dir, S_IFDIR | mode, dentry);
162 err = PTR_ERR(inode);
165 @@ -2124,7 +2147,7 @@ retry:
169 - inode = ext3_new_inode (handle, dir, S_IFLNK|S_IRWXUGO);
170 + inode = ext3_new_inode_wantedi (handle, dir, S_IFLNK|S_IRWXUGO, dentry);
171 err = PTR_ERR(inode);
174 diff -urp RH_2_6_9_42_0_3.orig/include/linux/ext3_fs.h RH_2_6_9_42_0_3/include/linux/ext3_fs.h
175 --- RH_2_6_9_42_0_3.orig/include/linux/ext3_fs.h 2006-10-23 13:32:46.000000000 +0300
176 +++ RH_2_6_9_42_0_3/include/linux/ext3_fs.h 2007-02-16 07:22:28.000000000 +0200
177 @@ -741,7 +741,8 @@ extern int ext3fs_dirhash(const char *na
178 dx_hash_info *hinfo);
181 -extern struct inode * ext3_new_inode (handle_t *, struct inode *, int);
182 +extern struct inode * ext3_new_inode (handle_t *, struct inode *, int,
184 extern void ext3_free_inode (handle_t *, struct inode *);
185 extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
186 extern unsigned long ext3_count_free_inodes (struct super_block *);
187 @@ -833,4 +834,6 @@ extern struct inode_operations ext3_fast
189 #endif /* __KERNEL__ */
191 +/* EXT3_IOC_CREATE_INUM at bottom of file (visible to kernel and user). */
192 +#define EXT3_IOC_CREATE_INUM _IOW('f', 5, long)
193 #endif /* _LINUX_EXT3_FS_H */