1 Index: linux-2.6.16.21-0.8/net/unix/af_unix.c
2 ===================================================================
3 --- linux-2.6.16.21-0.8.orig/net/unix/af_unix.c 2006-08-03 01:34:33.000000000 -0600
4 +++ linux-2.6.16.21-0.8/net/unix/af_unix.c 2006-08-03 01:35:38.000000000 -0600
8 if (sunname->sun_path[0]) {
9 + intent_init(&nd.intent, IT_LOOKUP);
10 err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd);
13 Index: linux-2.6.16.21-0.8/fs/open.c
14 ===================================================================
15 --- linux-2.6.16.21-0.8.orig/fs/open.c 2006-08-03 01:34:33.000000000 -0600
16 +++ linux-2.6.16.21-0.8/fs/open.c 2006-08-03 02:54:31.000000000 -0600
20 int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
22 + struct file *filp, int called_from_open)
25 + struct inode_operations *op = dentry->d_inode->i_op;
26 struct iattr newattrs;
28 /* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
32 mutex_lock(&dentry->d_inode->i_mutex);
33 - err = notify_change(dentry, &newattrs);
34 + if (called_from_open)
35 + newattrs.ia_valid |= ATTR_FROM_OPEN;
36 + if (op->setattr_raw) {
37 + newattrs.ia_valid |= ATTR_RAW;
38 + newattrs.ia_ctime = CURRENT_TIME;
39 + down_write(&dentry->d_inode->i_alloc_sem);
40 + err = op->setattr_raw(dentry->d_inode, &newattrs);
41 + up_write(&dentry->d_inode->i_alloc_sem);
43 + err = notify_change(dentry, &newattrs);
45 mutex_unlock(&dentry->d_inode->i_mutex);
49 error = locks_verify_truncate(inode, NULL, length);
52 - error = do_truncate(nd.dentry, length, 0, NULL);
53 + error = do_truncate(nd.dentry, length, 0, NULL, 0);
55 put_write_access(inode);
59 error = locks_verify_truncate(inode, file, length);
61 - error = do_truncate(dentry, length, 0, file);
62 + error = do_truncate(dentry, length, 0, file, 0);
67 (error = vfs_permission(&nd, MAY_WRITE)) != 0)
70 - mutex_lock(&inode->i_mutex);
71 - error = notify_change(nd.dentry, &newattrs);
72 - mutex_unlock(&inode->i_mutex);
73 + if (inode->i_op->setattr_raw) {
74 + struct inode_operations *op = nd.dentry->d_inode->i_op;
76 + newattrs.ia_valid |= ATTR_RAW;
77 + error = op->setattr_raw(inode, &newattrs);
78 + /* the file system wants to use normal vfs path now */
79 + if (error != -EOPNOTSUPP)
82 + mutex_lock(&inode->i_mutex);
83 + error = notify_change(nd.dentry, &newattrs);
84 + mutex_unlock(&inode->i_mutex);
94 +int chmod_common(struct dentry *dentry, mode_t mode)
96 + struct inode * inode = dentry->d_inode;
97 + struct iattr newattrs;
100 + if (IS_RDONLY(inode))
103 + if (inode->i_op->setattr_raw) {
104 + struct inode_operations *op = dentry->d_inode->i_op;
106 + newattrs.ia_mode = mode;
107 + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
108 + newattrs.ia_valid |= ATTR_RAW;
109 + error = op->setattr_raw(inode, &newattrs);
110 + /* the file system wants to use normal vfs path now */
111 + if (error != -EOPNOTSUPP)
116 + if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
119 + mutex_lock(&inode->i_mutex);
120 + if (mode == (mode_t) -1)
121 + mode = inode->i_mode;
122 + newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
123 + newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
124 + error = notify_change(dentry, &newattrs);
125 + mutex_unlock(&inode->i_mutex);
130 asmlinkage long sys_fchmod(unsigned int fd, mode_t mode)
132 - struct inode * inode;
133 - struct dentry * dentry;
136 - struct iattr newattrs;
142 - dentry = file->f_dentry;
143 - inode = dentry->d_inode;
146 - if (IS_RDONLY(inode))
149 - if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
151 - mutex_lock(&inode->i_mutex);
152 - if (mode == (mode_t) -1)
153 - mode = inode->i_mode;
154 - newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
155 - newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
156 - err = notify_change(dentry, &newattrs);
157 - mutex_unlock(&inode->i_mutex);
160 + err = chmod_common(file->f_dentry, mode);
164 @@ -659,32 +697,12 @@
168 - struct inode * inode;
170 - struct iattr newattrs;
172 error = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW, &nd);
175 - inode = nd.dentry->d_inode;
178 - if (IS_RDONLY(inode))
182 - if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
185 - mutex_lock(&inode->i_mutex);
186 - if (mode == (mode_t) -1)
187 - mode = inode->i_mode;
188 - newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
189 - newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
190 - error = notify_change(nd.dentry, &newattrs);
191 - mutex_unlock(&inode->i_mutex);
194 + error = chmod_common(nd.dentry, mode);
199 if (IS_RDONLY(inode))
202 + if (inode->i_op->setattr_raw) {
203 + struct inode_operations *op = dentry->d_inode->i_op;
205 + newattrs.ia_uid = user;
206 + newattrs.ia_gid = group;
207 + newattrs.ia_valid = ATTR_UID | ATTR_GID | ATTR_CTIME;
208 + newattrs.ia_valid |= ATTR_RAW;
209 + error = op->setattr_raw(inode, &newattrs);
210 + /* the file system wants to use normal vfs path now */
211 + if (error != -EOPNOTSUPP)
214 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
216 newattrs.ia_valid = ATTR_CTIME;
217 Index: linux-2.6.16.21-0.8/fs/namei.c
218 ===================================================================
219 --- linux-2.6.16.21-0.8.orig/fs/namei.c 2006-08-03 01:34:33.000000000 -0600
220 +++ linux-2.6.16.21-0.8/fs/namei.c 2006-08-03 02:54:31.000000000 -0600
221 @@ -1637,7 +1637,7 @@
225 - error = do_truncate(dentry, 0, ATTR_MTIME|ATTR_CTIME, NULL);
226 + error = do_truncate(dentry, 0, ATTR_MTIME|ATTR_CTIME, NULL, 1);
228 put_write_access(inode);
230 @@ -1911,6 +1911,7 @@
232 struct dentry * dentry;
234 + intent_init(&nd.intent, IT_LOOKUP);
238 @@ -1921,6 +1922,15 @@
239 error = do_path_lookup(dfd, tmp, LOOKUP_PARENT, &nd);
243 + if (nd.dentry->d_inode->i_op->mknod_raw) {
244 + struct inode_operations *op = nd.dentry->d_inode->i_op;
245 + error = op->mknod_raw(&nd, mode, dev);
246 + /* the file system wants to use normal vfs path now */
247 + if (error != -EOPNOTSUPP)
251 dentry = lookup_create(&nd, 0);
252 error = PTR_ERR(dentry);
254 @@ -1947,6 +1957,7 @@
257 mutex_unlock(&nd.dentry->d_inode->i_mutex);
262 @@ -1992,9 +2003,18 @@
263 struct dentry *dentry;
266 + intent_init(&nd.intent, IT_LOOKUP);
267 error = do_path_lookup(dfd, tmp, LOOKUP_PARENT, &nd);
270 + if (nd.dentry->d_inode->i_op->mkdir_raw) {
271 + struct inode_operations *op = nd.dentry->d_inode->i_op;
272 + error = op->mkdir_raw(&nd, mode);
273 + /* the file system wants to use normal vfs path now */
274 + if (error != -EOPNOTSUPP)
278 dentry = lookup_create(&nd, 1);
279 error = PTR_ERR(dentry);
280 if (!IS_ERR(dentry)) {
281 @@ -2004,6 +2024,7 @@
284 mutex_unlock(&nd.dentry->d_inode->i_mutex);
289 @@ -2084,6 +2105,7 @@
291 struct dentry *dentry;
293 + intent_init(&nd.intent, IT_LOOKUP);
295 name = getname(pathname);
297 @@ -2104,6 +2126,14 @@
301 + if (nd.dentry->d_inode->i_op->rmdir_raw) {
302 + struct inode_operations *op = nd.dentry->d_inode->i_op;
304 + error = op->rmdir_raw(&nd);
305 + /* the file system wants to use normal vfs path now */
306 + if (error != -EOPNOTSUPP)
309 mutex_lock(&nd.dentry->d_inode->i_mutex);
310 dentry = lookup_hash(&nd);
311 error = PTR_ERR(dentry);
312 @@ -2167,6 +2197,7 @@
313 struct dentry *dentry;
315 struct inode *inode = NULL;
316 + intent_init(&nd.intent, IT_LOOKUP);
318 name = getname(pathname);
320 @@ -2178,6 +2209,13 @@
322 if (nd.last_type != LAST_NORM)
324 + if (nd.dentry->d_inode->i_op->unlink_raw) {
325 + struct inode_operations *op = nd.dentry->d_inode->i_op;
326 + error = op->unlink_raw(&nd);
327 + /* the file system wants to use normal vfs path now */
328 + if (error != -EOPNOTSUPP)
331 mutex_lock(&nd.dentry->d_inode->i_mutex);
332 dentry = lookup_hash(&nd);
333 error = PTR_ERR(dentry);
334 @@ -2260,9 +2298,17 @@
335 struct dentry *dentry;
338 + intent_init(&nd.intent, IT_LOOKUP);
339 error = do_path_lookup(newdfd, to, LOOKUP_PARENT, &nd);
342 + if (nd.dentry->d_inode->i_op->symlink_raw) {
343 + struct inode_operations *op = nd.dentry->d_inode->i_op;
344 + error = op->symlink_raw(&nd, from);
345 + /* the file system wants to use normal vfs path now */
346 + if (error != -EOPNOTSUPP)
349 dentry = lookup_create(&nd, 0);
350 error = PTR_ERR(dentry);
351 if (!IS_ERR(dentry)) {
352 @@ -2270,6 +2316,7 @@
355 mutex_unlock(&nd.dentry->d_inode->i_mutex);
360 @@ -2357,6 +2404,13 @@
362 if (old_nd.mnt != nd.mnt)
364 + if (nd.dentry->d_inode->i_op->link_raw) {
365 + struct inode_operations *op = nd.dentry->d_inode->i_op;
366 + error = op->link_raw(&old_nd, &nd);
367 + /* the file system wants to use normal vfs path now */
368 + if (error != -EOPNOTSUPP)
371 new_dentry = lookup_create(&nd, 0);
372 error = PTR_ERR(new_dentry);
373 if (!IS_ERR(new_dentry)) {
374 @@ -2533,6 +2587,8 @@
375 struct dentry * old_dentry, *new_dentry;
376 struct dentry * trap;
377 struct nameidata oldnd, newnd;
378 + intent_init(&oldnd.intent, IT_LOOKUP);
379 + intent_init(&newnd.intent, IT_LOOKUP);
381 error = do_path_lookup(olddfd, oldname, LOOKUP_PARENT, &oldnd);
383 @@ -2555,6 +2611,13 @@
384 if (newnd.last_type != LAST_NORM)
387 + if (old_dir->d_inode->i_op->rename_raw) {
388 + error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
389 + /* the file system wants to use normal vfs path now */
390 + if (error != -EOPNOTSUPP)
394 trap = lock_rename(new_dir, old_dir);
396 old_dentry = lookup_hash(&oldnd);
397 @@ -2586,8 +2649,7 @@
398 if (new_dentry == trap)
401 - error = vfs_rename(old_dir->d_inode, old_dentry,
402 - new_dir->d_inode, new_dentry);
403 + error = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry);
407 Index: linux-2.6.16.21-0.8/fs/exec.c
408 ===================================================================
409 --- linux-2.6.16.21-0.8.orig/fs/exec.c 2006-08-03 01:34:33.000000000 -0600
410 +++ linux-2.6.16.21-0.8/fs/exec.c 2006-08-03 01:35:38.000000000 -0600
411 @@ -1524,7 +1524,7 @@
413 if (!file->f_op->write)
415 - if (do_truncate(file->f_dentry, 0, 0, file) != 0)
416 + if (do_truncate(file->f_dentry, 0, 0, file, 0) != 0)
419 retval = binfmt->core_dump(signr, regs, file);
420 Index: linux-2.6.16.21-0.8/include/linux/fs.h
421 ===================================================================
422 --- linux-2.6.16.21-0.8.orig/include/linux/fs.h 2006-08-03 01:34:33.000000000 -0600
423 +++ linux-2.6.16.21-0.8/include/linux/fs.h 2006-08-03 01:35:38.000000000 -0600
424 @@ -1041,13 +1041,20 @@
425 int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
426 struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
427 int (*link) (struct dentry *,struct inode *,struct dentry *);
428 + int (*link_raw) (struct nameidata *,struct nameidata *);
429 int (*unlink) (struct inode *,struct dentry *);
430 + int (*unlink_raw) (struct nameidata *);
431 int (*symlink) (struct inode *,struct dentry *,const char *);
432 + int (*symlink_raw) (struct nameidata *,const char *);
433 int (*mkdir) (struct inode *,struct dentry *,int);
434 + int (*mkdir_raw) (struct nameidata *,int);
435 int (*rmdir) (struct inode *,struct dentry *);
436 + int (*rmdir_raw) (struct nameidata *);
437 int (*mknod) (struct inode *,struct dentry *,int,dev_t);
438 + int (*mknod_raw) (struct nameidata *,int,dev_t);
439 int (*rename) (struct inode *, struct dentry *,
440 struct inode *, struct dentry *);
441 + int (*rename_raw) (struct nameidata *, struct nameidata *);
442 int (*readlink) (struct dentry *, char __user *,int);
443 void * (*follow_link) (struct dentry *, struct nameidata *);
444 void (*put_link) (struct dentry *, struct nameidata *, void *);
445 @@ -1357,7 +1364,7 @@
448 extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
449 - struct file *filp);
450 + struct file *filp, int called_from_open);
451 extern long do_sys_open(int fdf, const char __user *filename, int flags,
453 extern struct file *filp_open(const char *, int, int);