Whamcloud - gitweb
smash the HEAD with the contents of b_cmd. HEAD_PRE_CMD_SMASH and
[fs/lustre-release.git] / lustre / kernel_patches / patches / vfs_nointent-2.6.3-mm4.patch
1  0 files changed
2
3 Index: linux-2.6.3-mm4/fs/namei.c
4 ===================================================================
5 --- linux-2.6.3-mm4.orig/fs/namei.c     2004-03-08 14:46:20.906229088 +0800
6 +++ linux-2.6.3-mm4/fs/namei.c  2004-03-08 14:51:27.317647472 +0800
7 @@ -1277,7 +1277,7 @@
8                 if (!error) {
9                         DQUOT_INIT(inode);
10                         
11 -                       error = do_truncate(dentry, 0);
12 +                       error = do_truncate(dentry, 0, 1);
13                 }
14                 put_write_access(inode);
15                 if (error)
16 @@ -1527,6 +1527,7 @@
17         char * tmp;
18         struct dentry * dentry;
19         struct nameidata nd;
20 +       intent_init(&nd.intent, IT_LOOKUP);
21  
22         if (S_ISDIR(mode))
23                 return -EPERM;
24 @@ -1537,6 +1538,15 @@
25         error = path_lookup(tmp, LOOKUP_PARENT, &nd);
26         if (error)
27                 goto out;
28 +
29 +       if (nd.dentry->d_inode->i_op->mknod_raw) {
30 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
31 +               error = op->mknod_raw(&nd, mode, dev);
32 +               /* the file system wants to use normal vfs path now */
33 +               if (error != -EOPNOTSUPP)
34 +                       goto out2;
35 +       }
36 +
37         dentry = lookup_create(&nd, 0);
38         error = PTR_ERR(dentry);
39  
40 @@ -1563,6 +1573,7 @@
41                 dput(dentry);
42         }
43         up(&nd.dentry->d_inode->i_sem);
44 +out2:
45         path_release(&nd);
46  out:
47         putname(tmp);
48 @@ -1604,10 +1615,18 @@
49         if (!IS_ERR(tmp)) {
50                 struct dentry *dentry;
51                 struct nameidata nd;
52 +                intent_init(&nd.intent, IT_LOOKUP);
53  
54                 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
55                 if (error)
56                         goto out;
57 +               if (nd.dentry->d_inode->i_op->mkdir_raw) {
58 +                       struct inode_operations *op = nd.dentry->d_inode->i_op;
59 +                       error = op->mkdir_raw(&nd, mode);
60 +                       /* the file system wants to use normal vfs path now */
61 +                       if (error != -EOPNOTSUPP)
62 +                               goto out2;
63 +               }
64                 dentry = lookup_create(&nd, 1);
65                 error = PTR_ERR(dentry);
66                 if (!IS_ERR(dentry)) {
67 @@ -1617,6 +1636,7 @@
68                         dput(dentry);
69                 }
70                 up(&nd.dentry->d_inode->i_sem);
71 +out2:
72                 path_release(&nd);
73  out:
74                 putname(tmp);
75 @@ -1697,6 +1717,7 @@
76         char * name;
77         struct dentry *dentry;
78         struct nameidata nd;
79 +        intent_init(&nd.intent, IT_LOOKUP);
80  
81         name = getname(pathname);
82         if(IS_ERR(name))
83 @@ -1717,6 +1738,16 @@
84                         error = -EBUSY;
85                         goto exit1;
86         }
87
88 +       if (nd.dentry->d_inode->i_op->rmdir_raw) {
89 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
90
91 +               error = op->rmdir_raw(&nd);
92 +               /* the file system wants to use normal vfs path now */
93 +               if (error != -EOPNOTSUPP)
94 +                       goto exit1;
95 +       }
96
97         down(&nd.dentry->d_inode->i_sem);
98         dentry = lookup_hash(&nd.last, nd.dentry);
99         error = PTR_ERR(dentry);
100 @@ -1775,6 +1806,7 @@
101         struct dentry *dentry;
102         struct nameidata nd;
103         struct inode *inode = NULL;
104 +        intent_init(&nd.intent, IT_LOOKUP);
105  
106         name = getname(pathname);
107         if(IS_ERR(name))
108 @@ -1786,6 +1818,13 @@
109         error = -EISDIR;
110         if (nd.last_type != LAST_NORM)
111                 goto exit1;
112 +       if (nd.dentry->d_inode->i_op->unlink_raw) {
113 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
114 +               error = op->unlink_raw(&nd);
115 +               /* the file system wants to use normal vfs path now */
116 +               if (error != -EOPNOTSUPP)
117 +                       goto exit1;
118 +       }
119         down(&nd.dentry->d_inode->i_sem);
120         dentry = lookup_hash(&nd.last, nd.dentry);
121         error = PTR_ERR(dentry);
122 @@ -1853,10 +1892,18 @@
123         if (!IS_ERR(to)) {
124                 struct dentry *dentry;
125                 struct nameidata nd;
126 +                intent_init(&nd.intent, IT_LOOKUP);
127  
128                 error = path_lookup(to, LOOKUP_PARENT, &nd);
129                 if (error)
130                         goto out;
131 +               if (nd.dentry->d_inode->i_op->symlink_raw) {
132 +                       struct inode_operations *op = nd.dentry->d_inode->i_op;
133 +                       error = op->symlink_raw(&nd, from);
134 +                       /* the file system wants to use normal vfs path now */
135 +                       if (error != -EOPNOTSUPP)
136 +                               goto out2;
137 +               }
138                 dentry = lookup_create(&nd, 0);
139                 error = PTR_ERR(dentry);
140                 if (!IS_ERR(dentry)) {
141 @@ -1864,6 +1911,7 @@
142                         dput(dentry);
143                 }
144                 up(&nd.dentry->d_inode->i_sem);
145 +out2:
146                 path_release(&nd);
147  out:
148                 putname(to);
149 @@ -1927,6 +1975,8 @@
150         struct nameidata nd, old_nd;
151         int error;
152         char * to;
153 +        intent_init(&nd.intent, IT_LOOKUP);
154 +        intent_init(&old_nd.intent, IT_LOOKUP);
155  
156         to = getname(newname);
157         if (IS_ERR(to))
158 @@ -1941,6 +1991,13 @@
159         error = -EXDEV;
160         if (old_nd.mnt != nd.mnt)
161                 goto out_release;
162 +        if (nd.dentry->d_inode->i_op->link_raw) {
163 +                struct inode_operations *op = nd.dentry->d_inode->i_op;
164 +                error = op->link_raw(&old_nd, &nd);
165 +                /* the file system wants to use normal vfs path now */
166 +                if (error != -EOPNOTSUPP)
167 +                        goto out_release;
168 +        }
169         new_dentry = lookup_create(&nd, 0);
170         error = PTR_ERR(new_dentry);
171         if (!IS_ERR(new_dentry)) {
172 @@ -1991,7 +2048,7 @@
173   *        locking].
174   */
175  int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
176 -              struct inode *new_dir, struct dentry *new_dentry)
177 +                   struct inode *new_dir, struct dentry *new_dentry)
178  {
179         int error = 0;
180         struct inode *target;
181 @@ -2036,7 +2093,7 @@
182  }
183  
184  int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
185 -              struct inode *new_dir, struct dentry *new_dentry)
186 +                     struct inode *new_dir, struct dentry *new_dentry)
187  {
188         struct inode *target;
189         int error;
190 @@ -2113,6 +2170,8 @@
191         struct dentry * old_dentry, *new_dentry;
192         struct dentry * trap;
193         struct nameidata oldnd, newnd;
194 +        intent_init(&oldnd.intent, IT_LOOKUP);
195 +        intent_init(&newnd.intent, IT_LOOKUP);
196  
197         error = path_lookup(oldname, LOOKUP_PARENT, &oldnd);
198         if (error)
199 @@ -2135,6 +2194,13 @@
200         if (newnd.last_type != LAST_NORM)
201                 goto exit2;
202  
203 +       if (old_dir->d_inode->i_op->rename_raw) {
204 +               error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
205 +               /* the file system wants to use normal vfs path now */
206 +               if (error != -EOPNOTSUPP)
207 +                       goto exit2;
208 +       }
209 +
210         trap = lock_rename(new_dir, old_dir);
211  
212         old_dentry = lookup_hash(&oldnd.last, old_dir);
213 @@ -2166,8 +2232,7 @@
214         if (new_dentry == trap)
215                 goto exit5;
216  
217 -       error = vfs_rename(old_dir->d_inode, old_dentry,
218 -                                  new_dir->d_inode, new_dentry);
219 +       error = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry);
220  exit5:
221         dput(new_dentry);
222  exit4:
223 Index: linux-2.6.3-mm4/fs/open.c
224 ===================================================================
225 --- linux-2.6.3-mm4.orig/fs/open.c      2004-03-08 14:46:21.050207200 +0800
226 +++ linux-2.6.3-mm4/fs/open.c   2004-03-08 14:55:01.025158992 +0800
227 @@ -180,9 +180,10 @@
228         return error;
229  }
230  
231 -int do_truncate(struct dentry *dentry, loff_t length)
232 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
233  {
234         int err;
235 +       struct inode_operations *op = dentry->d_inode->i_op;
236         struct iattr newattrs;
237  
238         /* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
239 @@ -193,7 +194,14 @@
240         newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
241         down(&dentry->d_inode->i_sem);
242         down_write(&dentry->d_inode->i_alloc_sem);
243 -       err = notify_change(dentry, &newattrs);
244 +       if (called_from_open)
245 +               newattrs.ia_valid |= ATTR_FROM_OPEN;
246 +       if (op->setattr_raw) {
247 +               newattrs.ia_valid |= ATTR_RAW;
248 +               newattrs.ia_ctime = CURRENT_TIME;
249 +               err = op->setattr_raw(dentry->d_inode, &newattrs);
250 +       } else 
251 +               err = notify_change(dentry, &newattrs);
252         up_write(&dentry->d_inode->i_alloc_sem);
253         up(&dentry->d_inode->i_sem);
254         return err;
255 @@ -249,7 +257,7 @@
256         error = locks_verify_truncate(inode, NULL, length);
257         if (!error) {
258                 DQUOT_INIT(inode);
259 -               error = do_truncate(nd.dentry, length);
260 +               error = do_truncate(nd.dentry, length, 0);
261         }
262         put_write_access(inode);
263  
264 @@ -301,7 +309,7 @@
265  
266         error = locks_verify_truncate(inode, file, length);
267         if (!error)
268 -               error = do_truncate(dentry, length);
269 +               error = do_truncate(dentry, length, 0);
270  out_putf:
271         fput(file);
272  out:
273 @@ -380,9 +388,19 @@
274                     (error = permission(inode,MAY_WRITE,&nd)) != 0)
275                         goto dput_and_out;
276         }
277 -       down(&inode->i_sem);
278 -       error = notify_change(nd.dentry, &newattrs);
279 -       up(&inode->i_sem);
280 +       if (inode->i_op->setattr_raw) {
281 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
282 +
283 +               newattrs.ia_valid |= ATTR_RAW;
284 +               error = op->setattr_raw(inode, &newattrs);
285 +               /* the file system wants to use normal vfs path now */
286 +               if (error != -EOPNOTSUPP)
287 +                       goto dput_and_out;
288 +       } else {
289 +                down(&inode->i_sem);
290 +                error = notify_change(nd.dentry, &newattrs);
291 +                up(&inode->i_sem);
292 +        }
293  dput_and_out:
294         path_release(&nd);
295  out:
296 @@ -433,9 +451,19 @@
297                     (error = permission(inode,MAY_WRITE,&nd)) != 0)
298                         goto dput_and_out;
299         }
300 -       down(&inode->i_sem);
301 -       error = notify_change(nd.dentry, &newattrs);
302 -       up(&inode->i_sem);
303 +       if (inode->i_op->setattr_raw) {
304 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
305 +
306 +               newattrs.ia_valid |= ATTR_RAW;
307 +               error = op->setattr_raw(inode, &newattrs);
308 +               /* the file system wants to use normal vfs path now */
309 +               if (error != -EOPNOTSUPP)
310 +                       goto dput_and_out;
311 +       } else {
312 +                down(&inode->i_sem);
313 +                error = notify_change(nd.dentry, &newattrs);
314 +                up(&inode->i_sem);
315 +        }
316  dput_and_out:
317         path_release(&nd);
318  out:
319 @@ -636,6 +664,18 @@
320         if (IS_RDONLY(inode))
321                 goto dput_and_out;
322         
323 +       if (inode->i_op->setattr_raw) {
324 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
325 +
326 +               newattrs.ia_mode = mode;
327 +               newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
328 +               newattrs.ia_valid |= ATTR_RAW;
329 +               error = op->setattr_raw(inode, &newattrs);
330 +               /* the file system wants to use normal vfs path now */
331 +               if (error != -EOPNOTSUPP)
332 +                       goto dput_and_out;
333 +       }
334 +
335         error = -EPERM;
336         if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
337                 goto dput_and_out;
338 @@ -669,6 +709,18 @@
339         if (IS_RDONLY(inode))
340                 goto out;
341         error = -EPERM;
342 +       if (inode->i_op->setattr_raw) {
343 +               struct inode_operations *op = dentry->d_inode->i_op;
344 +
345 +               newattrs.ia_uid = user;
346 +               newattrs.ia_gid = group;
347 +               newattrs.ia_valid = ATTR_UID | ATTR_GID;
348 +               newattrs.ia_valid |= ATTR_RAW;
349 +               error = op->setattr_raw(inode, &newattrs);
350 +               /* the file system wants to use normal vfs path now */
351 +               if (error != -EOPNOTSUPP)
352 +                       return error;
353 +       }
354         if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
355                 goto out;
356         newattrs.ia_valid =  ATTR_CTIME;
357 @@ -682,6 +734,7 @@
358         }
359         if (!S_ISDIR(inode->i_mode))
360                 newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;
361 +
362         down(&inode->i_sem);
363         error = notify_change(dentry, &newattrs);
364         up(&inode->i_sem);
365 Index: linux-2.6.3-mm4/fs/exec.c
366 ===================================================================
367 --- linux-2.6.3-mm4.orig/fs/exec.c      2004-03-08 14:46:20.758251584 +0800
368 +++ linux-2.6.3-mm4/fs/exec.c   2004-03-08 14:51:27.454626648 +0800
369 @@ -1408,7 +1408,7 @@
370                 goto close_fail;
371         if (!file->f_op->write)
372                 goto close_fail;
373 -       if (do_truncate(file->f_dentry, 0) != 0)
374 +       if (do_truncate(file->f_dentry, 0, 0) != 0)
375                 goto close_fail;
376  
377         retval = binfmt->core_dump(signr, regs, file);
378 Index: linux-2.6.3-mm4/include/linux/fs.h
379 ===================================================================
380 --- linux-2.6.3-mm4.orig/include/linux/fs.h     2004-03-08 14:46:21.391155368 +0800
381 +++ linux-2.6.3-mm4/include/linux/fs.h  2004-03-08 14:56:25.775275016 +0800
382 @@ -843,13 +843,20 @@
383         int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
384         struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
385         int (*link) (struct dentry *,struct inode *,struct dentry *);
386 +       int (*link_raw) (struct nameidata *,struct nameidata *);
387         int (*unlink) (struct inode *,struct dentry *);
388 +       int (*unlink_raw) (struct nameidata *);
389         int (*symlink) (struct inode *,struct dentry *,const char *);
390 +       int (*symlink_raw) (struct nameidata *,const char *);
391         int (*mkdir) (struct inode *,struct dentry *,int);
392 +       int (*mkdir_raw) (struct nameidata *,int);
393         int (*rmdir) (struct inode *,struct dentry *);
394 +       int (*rmdir_raw) (struct nameidata *);
395         int (*mknod) (struct inode *,struct dentry *,int,dev_t);
396 +       int (*mknod_raw) (struct nameidata *,int,dev_t);
397         int (*rename) (struct inode *, struct dentry *,
398                         struct inode *, struct dentry *);
399 +       int (*rename_raw) (struct nameidata *, struct nameidata *);
400         int (*readlink) (struct dentry *, char __user *,int);
401         int (*follow_link) (struct dentry *, struct nameidata *);
402         void (*truncate) (struct inode *);
403 @@ -1133,7 +1140,7 @@
404  
405  /* fs/open.c */
406  
407 -extern int do_truncate(struct dentry *, loff_t start);
408 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
409  extern struct file *filp_open(const char *, int, int);
410  extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
411  extern struct file * dentry_open_it(struct dentry *, struct vfsmount *, int, struct lookup_intent *);
412 Index: linux-2.6.3-mm4/net/unix/af_unix.c
413 ===================================================================
414 --- linux-2.6.3-mm4.orig/net/unix/af_unix.c     2004-02-26 14:22:03.000000000 +0800
415 +++ linux-2.6.3-mm4/net/unix/af_unix.c  2004-03-08 14:51:27.591605824 +0800
416 @@ -592,6 +592,7 @@
417         int err = 0;
418         
419         if (sunname->sun_path[0]) {
420 +               intent_init(&nd.intent, IT_LOOKUP);
421                 err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd);
422                 if (err)
423                         goto fail;