1 Index: linux-2.6.9-5.0.3.EL/fs/namei.c
2 ===================================================================
3 --- linux-2.6.9-5.0.3.EL.orig/fs/namei.c 2005-02-26 13:29:11.948782168 +0200
4 +++ linux-2.6.9-5.0.3.EL/fs/namei.c 2005-02-26 13:29:13.355568304 +0200
9 - error = do_truncate(dentry, 0);
10 + error = do_truncate(dentry, 0, 1);
12 put_write_access(inode);
16 struct dentry * dentry;
18 + intent_init(&nd.intent, IT_LOOKUP);
22 @@ -1648,6 +1649,15 @@
23 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
27 + if (nd.dentry->d_inode->i_op->mknod_raw) {
28 + struct inode_operations *op = nd.dentry->d_inode->i_op;
29 + error = op->mknod_raw(&nd, mode, dev);
30 + /* the file system wants to use normal vfs path now */
31 + if (error != -EOPNOTSUPP)
35 dentry = lookup_create(&nd, 0);
36 error = PTR_ERR(dentry);
41 up(&nd.dentry->d_inode->i_sem);
46 @@ -1715,10 +1726,18 @@
48 struct dentry *dentry;
50 + intent_init(&nd.intent, IT_LOOKUP);
52 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
55 + if (nd.dentry->d_inode->i_op->mkdir_raw) {
56 + struct inode_operations *op = nd.dentry->d_inode->i_op;
57 + error = op->mkdir_raw(&nd, mode);
58 + /* the file system wants to use normal vfs path now */
59 + if (error != -EOPNOTSUPP)
62 dentry = lookup_create(&nd, 1);
63 error = PTR_ERR(dentry);
64 if (!IS_ERR(dentry)) {
68 up(&nd.dentry->d_inode->i_sem);
75 struct dentry *dentry;
77 + intent_init(&nd.intent, IT_LOOKUP);
79 name = getname(pathname);
81 @@ -1828,6 +1849,16 @@
86 + if (nd.dentry->d_inode->i_op->rmdir_raw) {
87 + struct inode_operations *op = nd.dentry->d_inode->i_op;
89 + error = op->rmdir_raw(&nd);
90 + /* the file system wants to use normal vfs path now */
91 + if (error != -EOPNOTSUPP)
95 down(&nd.dentry->d_inode->i_sem);
96 dentry = lookup_hash(&nd.last, nd.dentry);
97 error = PTR_ERR(dentry);
99 struct dentry *dentry;
101 struct inode *inode = NULL;
102 + intent_init(&nd.intent, IT_LOOKUP);
104 name = getname(pathname);
106 @@ -1897,6 +1929,13 @@
108 if (nd.last_type != LAST_NORM)
110 + if (nd.dentry->d_inode->i_op->unlink_raw) {
111 + struct inode_operations *op = nd.dentry->d_inode->i_op;
112 + error = op->unlink_raw(&nd);
113 + /* the file system wants to use normal vfs path now */
114 + if (error != -EOPNOTSUPP)
117 down(&nd.dentry->d_inode->i_sem);
118 dentry = lookup_hash(&nd.last, nd.dentry);
119 error = PTR_ERR(dentry);
120 @@ -1963,10 +2002,18 @@
122 struct dentry *dentry;
124 + intent_init(&nd.intent, IT_LOOKUP);
126 error = path_lookup(to, LOOKUP_PARENT, &nd);
129 + if (nd.dentry->d_inode->i_op->symlink_raw) {
130 + struct inode_operations *op = nd.dentry->d_inode->i_op;
131 + error = op->symlink_raw(&nd, from);
132 + /* the file system wants to use normal vfs path now */
133 + if (error != -EOPNOTSUPP)
136 dentry = lookup_create(&nd, 0);
137 error = PTR_ERR(dentry);
138 if (!IS_ERR(dentry)) {
139 @@ -1974,6 +2021,7 @@
142 up(&nd.dentry->d_inode->i_sem);
147 @@ -2037,6 +2085,8 @@
148 struct nameidata nd, old_nd;
151 + intent_init(&nd.intent, IT_LOOKUP);
152 + intent_init(&old_nd.intent, IT_LOOKUP);
154 to = getname(newname);
156 @@ -2051,6 +2101,13 @@
158 if (old_nd.mnt != nd.mnt)
160 + if (nd.dentry->d_inode->i_op->link_raw) {
161 + struct inode_operations *op = nd.dentry->d_inode->i_op;
162 + error = op->link_raw(&old_nd, &nd);
163 + /* the file system wants to use normal vfs path now */
164 + if (error != -EOPNOTSUPP)
167 new_dentry = lookup_create(&nd, 0);
168 error = PTR_ERR(new_dentry);
169 if (!IS_ERR(new_dentry)) {
170 @@ -2223,6 +2280,8 @@
171 struct dentry * old_dentry, *new_dentry;
172 struct dentry * trap;
173 struct nameidata oldnd, newnd;
174 + intent_init(&oldnd.intent, IT_LOOKUP);
175 + intent_init(&newnd.intent, IT_LOOKUP);
177 error = path_lookup(oldname, LOOKUP_PARENT, &oldnd);
179 @@ -2245,6 +2304,13 @@
180 if (newnd.last_type != LAST_NORM)
183 + if (old_dir->d_inode->i_op->rename_raw) {
184 + error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
185 + /* the file system wants to use normal vfs path now */
186 + if (error != -EOPNOTSUPP)
190 trap = lock_rename(new_dir, old_dir);
192 old_dentry = lookup_hash(&oldnd.last, old_dir);
193 @@ -2276,8 +2342,7 @@
194 if (new_dentry == trap)
197 - error = vfs_rename(old_dir->d_inode, old_dentry,
198 - new_dir->d_inode, new_dentry);
199 + error = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry);
203 Index: linux-2.6.9-5.0.3.EL/fs/open.c
204 ===================================================================
205 --- linux-2.6.9-5.0.3.EL.orig/fs/open.c 2005-02-26 13:29:11.962780040 +0200
206 +++ linux-2.6.9-5.0.3.EL/fs/open.c 2005-02-26 13:29:13.359567696 +0200
211 -int do_truncate(struct dentry *dentry, loff_t length)
212 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
215 + struct inode_operations *op = dentry->d_inode->i_op;
216 struct iattr newattrs;
218 /* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
220 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
221 down(&dentry->d_inode->i_sem);
222 down_write(&dentry->d_inode->i_alloc_sem);
223 - err = notify_change(dentry, &newattrs);
224 + if (called_from_open)
225 + newattrs.ia_valid |= ATTR_FROM_OPEN;
226 + if (op->setattr_raw) {
227 + newattrs.ia_valid |= ATTR_RAW;
228 + newattrs.ia_ctime = CURRENT_TIME;
229 + err = op->setattr_raw(dentry->d_inode, &newattrs);
231 + err = notify_change(dentry, &newattrs);
232 up_write(&dentry->d_inode->i_alloc_sem);
233 up(&dentry->d_inode->i_sem);
236 error = locks_verify_truncate(inode, NULL, length);
239 - error = do_truncate(nd.dentry, length);
240 + error = do_truncate(nd.dentry, length, 0);
242 put_write_access(inode);
246 error = locks_verify_truncate(inode, file, length);
248 - error = do_truncate(dentry, length);
249 + error = do_truncate(dentry, length, 0);
254 (error = permission(inode,MAY_WRITE,&nd)) != 0)
257 - down(&inode->i_sem);
258 - error = notify_change(nd.dentry, &newattrs);
260 + if (inode->i_op->setattr_raw) {
261 + struct inode_operations *op = nd.dentry->d_inode->i_op;
263 + newattrs.ia_valid |= ATTR_RAW;
264 + error = op->setattr_raw(inode, &newattrs);
265 + /* the file system wants to use normal vfs path now */
266 + if (error != -EOPNOTSUPP)
269 + down(&inode->i_sem);
270 + error = notify_change(nd.dentry, &newattrs);
277 (error = permission(inode,MAY_WRITE,&nd)) != 0)
280 - down(&inode->i_sem);
281 - error = notify_change(nd.dentry, &newattrs);
283 + if (inode->i_op->setattr_raw) {
284 + struct inode_operations *op = nd.dentry->d_inode->i_op;
286 + newattrs.ia_valid |= ATTR_RAW;
287 + error = op->setattr_raw(inode, &newattrs);
288 + /* the file system wants to use normal vfs path now */
289 + if (error != -EOPNOTSUPP)
292 + down(&inode->i_sem);
293 + error = notify_change(nd.dentry, &newattrs);
299 @@ -600,36 +628,52 @@
301 EXPORT_SYMBOL_GPL(sys_chroot);
303 -asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
304 +int chmod_common(struct dentry *dentry, mode_t mode)
306 - struct inode * inode;
307 - struct dentry * dentry;
308 - struct file * file;
310 + struct inode * inode = dentry->d_inode;
311 struct iattr newattrs;
312 + int error = -EROFS;
316 + if (IS_RDONLY(inode))
319 + if (inode->i_op->setattr_raw) {
320 + struct inode_operations *op = dentry->d_inode->i_op;
322 - dentry = file->f_dentry;
323 - inode = dentry->d_inode;
324 + newattrs.ia_mode = mode;
325 + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
326 + newattrs.ia_valid |= ATTR_RAW;
327 + error = op->setattr_raw(inode, &newattrs);
328 + /* the file system wants to use the normal vfs path now */
329 + if (error != -EOPNOTSUPP)
334 - if (IS_RDONLY(inode))
338 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
343 if (mode == (mode_t) -1)
344 mode = inode->i_mode;
345 newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
346 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
347 - err = notify_change(dentry, &newattrs);
348 + error = notify_change(dentry, &newattrs);
355 +asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
357 + struct file * file;
364 + err = chmod_common(file->f_dentry, mode);
368 @@ -638,32 +682,13 @@
369 asmlinkage long sys_chmod(const char __user * filename, mode_t mode)
372 - struct inode * inode;
374 - struct iattr newattrs;
376 error = user_path_walk(filename, &nd);
379 - inode = nd.dentry->d_inode;
382 - if (IS_RDONLY(inode))
386 - if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
389 - down(&inode->i_sem);
390 - if (mode == (mode_t) -1)
391 - mode = inode->i_mode;
392 - newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
393 - newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
394 - error = notify_change(nd.dentry, &newattrs);
398 + error = chmod_common(nd.dentry, mode);
403 if (IS_RDONLY(inode))
406 + if (inode->i_op->setattr_raw) {
407 + struct inode_operations *op = dentry->d_inode->i_op;
409 + newattrs.ia_uid = user;
410 + newattrs.ia_gid = group;
411 + newattrs.ia_valid = ATTR_UID | ATTR_GID | ATTR_CTIME;
412 + newattrs.ia_valid |= ATTR_RAW;
413 + error = op->setattr_raw(inode, &newattrs);
414 + /* the file system wants to use normal vfs path now */
415 + if (error != -EOPNOTSUPP)
418 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
420 newattrs.ia_valid = ATTR_CTIME;
423 if (!S_ISDIR(inode->i_mode))
424 newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;
427 error = notify_change(dentry, &newattrs);
429 Index: linux-2.6.9-5.0.3.EL/fs/exec.c
430 ===================================================================
431 --- linux-2.6.9-5.0.3.EL.orig/fs/exec.c 2005-02-26 13:29:11.936783992 +0200
432 +++ linux-2.6.9-5.0.3.EL/fs/exec.c 2005-02-26 13:29:13.362567240 +0200
433 @@ -1451,7 +1451,7 @@
435 if (!file->f_op->write)
437 - if (do_truncate(file->f_dentry, 0) != 0)
438 + if (do_truncate(file->f_dentry, 0, 0) != 0)
441 retval = binfmt->core_dump(signr, regs, file);
442 Index: linux-2.6.9-5.0.3.EL/include/linux/fs.h
443 ===================================================================
444 --- linux-2.6.9-5.0.3.EL.orig/include/linux/fs.h 2005-02-26 13:29:11.987776240 +0200
445 +++ linux-2.6.9-5.0.3.EL/include/linux/fs.h 2005-02-26 13:29:13.365566784 +0200
446 @@ -926,13 +926,20 @@
447 int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
448 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
449 int (*link) (struct dentry *,struct inode *,struct dentry *);
450 + int (*link_raw) (struct nameidata *,struct nameidata *);
451 int (*unlink) (struct inode *,struct dentry *);
452 + int (*unlink_raw) (struct nameidata *);
453 int (*symlink) (struct inode *,struct dentry *,const char *);
454 + int (*symlink_raw) (struct nameidata *,const char *);
455 int (*mkdir) (struct inode *,struct dentry *,int);
456 + int (*mkdir_raw) (struct nameidata *,int);
457 int (*rmdir) (struct inode *,struct dentry *);
458 + int (*rmdir_raw) (struct nameidata *);
459 int (*mknod) (struct inode *,struct dentry *,int,dev_t);
460 + int (*mknod_raw) (struct nameidata *,int,dev_t);
461 int (*rename) (struct inode *, struct dentry *,
462 struct inode *, struct dentry *);
463 + int (*rename_raw) (struct nameidata *, struct nameidata *);
464 int (*readlink) (struct dentry *, char __user *,int);
465 int (*follow_link) (struct dentry *, struct nameidata *);
466 void (*put_link) (struct dentry *, struct nameidata *);
467 @@ -1234,7 +1241,7 @@
471 -extern int do_truncate(struct dentry *, loff_t start);
472 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
473 extern struct file *filp_open(const char *, int, int);
474 extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
475 extern struct file * dentry_open_it(struct dentry *, struct vfsmount *, int, struct lookup_intent *);
476 Index: linux-2.6.9-5.0.3.EL/net/unix/af_unix.c
477 ===================================================================
478 --- linux-2.6.9-5.0.3.EL.orig/net/unix/af_unix.c 2005-02-25 10:25:31.000000000 +0200
479 +++ linux-2.6.9-5.0.3.EL/net/unix/af_unix.c 2005-02-26 13:29:13.387563440 +0200
483 if (sunname->sun_path[0]) {
484 + intent_init(&nd.intent, IT_LOOKUP);
485 err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd);