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