Whamcloud - gitweb
merge b_devel into HEAD, which will become 0.7.3
[fs/lustre-release.git] / lustre / kernel_patches / patches / vfs_nointent_2.5.69_rev1.patch
1  fs/exec.c          |    2 -
2  fs/namei.c         |   75 +++++++++++++++++++++++++++++++++++++++++++++++++----
3  fs/open.c          |   73 ++++++++++++++++++++++++++++++++++++++++++++-------
4  include/linux/fs.h |    9 +++++-
5  4 files changed, 142 insertions(+), 17 deletions(-)
6
7 --- uml-2.5/fs/namei.c~vfs_nointent_2.5.69_rev1 2003-06-20 00:04:07.000000000 -0600
8 +++ uml-2.5-braam/fs/namei.c    2003-06-20 06:22:37.000000000 -0600
9 @@ -1279,7 +1279,7 @@ int may_open(struct nameidata *nd, int a
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 @@ -1517,6 +1517,7 @@ asmlinkage long sys_mknod(const char __u
19         char * tmp;
20         struct dentry * dentry;
21         struct nameidata nd;
22 +       intent_init(&nd.it, IT_LOOKUP, 0);
23  
24         if (S_ISDIR(mode))
25                 return -EPERM;
26 @@ -1527,6 +1528,15 @@ asmlinkage long sys_mknod(const char __u
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 @@ -1549,6 +1559,7 @@ asmlinkage long sys_mknod(const char __u
43                 dput(dentry);
44         }
45         up(&nd.dentry->d_inode->i_sem);
46 +out2:
47         path_release(&nd);
48  out:
49         putname(tmp);
50 @@ -1590,10 +1601,18 @@ asmlinkage long sys_mkdir(const char __u
51         if (!IS_ERR(tmp)) {
52                 struct dentry *dentry;
53                 struct nameidata nd;
54 +                intent_init(&nd.it, IT_LOOKUP, 0);
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 @@ -1603,6 +1622,7 @@ asmlinkage long sys_mkdir(const char __u
70                         dput(dentry);
71                 }
72                 up(&nd.dentry->d_inode->i_sem);
73 +out2:
74                 path_release(&nd);
75  out:
76                 putname(tmp);
77 @@ -1683,6 +1703,7 @@ asmlinkage long sys_rmdir(const char __u
78         char * name;
79         struct dentry *dentry;
80         struct nameidata nd;
81 +        intent_init(&nd.it, IT_LOOKUP, 0);
82  
83         name = getname(pathname);
84         if(IS_ERR(name))
85 @@ -1703,6 +1724,16 @@ asmlinkage long sys_rmdir(const char __u
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, &nd);
101         error = PTR_ERR(dentry);
102 @@ -1759,6 +1790,7 @@ asmlinkage long sys_unlink(const char __
103         struct dentry *dentry;
104         struct nameidata nd;
105         struct inode *inode = NULL;
106 +        intent_init(&nd.it, IT_LOOKUP, 0);
107  
108         name = getname(pathname);
109         if(IS_ERR(name))
110 @@ -1770,6 +1802,13 @@ asmlinkage long sys_unlink(const char __
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, &nd);
123         error = PTR_ERR(dentry);
124 @@ -1837,10 +1876,18 @@ asmlinkage long sys_symlink(const char _
125         if (!IS_ERR(to)) {
126                 struct dentry *dentry;
127                 struct nameidata nd;
128 +                intent_init(&nd.it, IT_LOOKUP, 0);
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 @@ -1848,6 +1895,7 @@ asmlinkage long sys_symlink(const char _
144                         dput(dentry);
145                 }
146                 up(&nd.dentry->d_inode->i_sem);
147 +out2:
148                 path_release(&nd);
149  out:
150                 putname(to);
151 @@ -1911,6 +1959,8 @@ asmlinkage long sys_link(const char __us
152         struct nameidata nd, old_nd;
153         int error;
154         char * to;
155 +        intent_init(&nd.it, IT_LOOKUP, 0);
156 +        intent_init(&old_nd.it, IT_LOOKUP, 0);
157  
158         to = getname(newname);
159         if (IS_ERR(to))
160 @@ -1925,6 +1975,13 @@ asmlinkage long sys_link(const char __us
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 @@ -1975,7 +2032,7 @@ exit:
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 @@ -2020,7 +2077,7 @@ int vfs_rename_dir(struct inode *old_dir
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 @@ -2097,6 +2154,8 @@ static inline int do_rename(const char *
193         struct dentry * old_dentry, *new_dentry;
194         struct dentry * trap;
195         struct nameidata oldnd, newnd;
196 +        intent_init(&oldnd.it, IT_LOOKUP, 0);
197 +        intent_init(&newnd.it, IT_LOOKUP, 0);
198  
199         error = path_lookup(oldname, LOOKUP_PARENT, &oldnd);
200         if (error)
201 @@ -2119,6 +2178,13 @@ static inline int do_rename(const char *
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, &oldnd);
215 @@ -2150,8 +2216,7 @@ static inline int do_rename(const char *
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 --- uml-2.5/fs/open.c~vfs_nointent_2.5.69_rev1  2003-06-18 21:42:57.000000000 -0600
226 +++ uml-2.5-braam/fs/open.c     2003-06-20 06:22:37.000000000 -0600
227 @@ -75,9 +75,10 @@ out:
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 @@ -87,7 +88,14 @@ int do_truncate(struct dentry *dentry, l
240         newattrs.ia_size = length;
241         newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
242         down(&dentry->d_inode->i_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(&dentry->d_inode->i_sem);
253         return err;
254  }
255 @@ -142,7 +150,7 @@ static inline long do_sys_truncate(const
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 @@ -194,7 +202,7 @@ static inline long do_sys_ftruncate(unsi
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 @@ -265,9 +273,19 @@ asmlinkage long sys_utime(char __user * 
274                     (error = permission(inode,MAY_WRITE)) != 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 @@ -310,9 +328,19 @@ long do_utimes(char __user * filename, s
297                     (error = permission(inode,MAY_WRITE)) != 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 @@ -513,6 +541,18 @@ asmlinkage long sys_chmod(const char __u
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 @@ -546,6 +586,18 @@ static int chown_common(struct dentry * 
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 @@ -559,6 +611,7 @@ static int chown_common(struct dentry * 
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 --- uml-2.5/include/linux/fs.h~vfs_nointent_2.5.69_rev1 2003-06-18 21:40:58.000000000 -0600
366 +++ uml-2.5-braam/include/linux/fs.h    2003-06-20 06:22:37.000000000 -0600
367 @@ -738,13 +738,20 @@ struct inode_operations {
368         struct dentry * (*lookup_it) (struct inode *,struct dentry *,
369                                         struct nameidata *);
370         int (*link) (struct dentry *,struct inode *,struct dentry *);
371 +       int (*link_raw) (struct nameidata *,struct nameidata *);
372         int (*unlink) (struct inode *,struct dentry *);
373 +       int (*unlink_raw) (struct nameidata *);
374         int (*symlink) (struct inode *,struct dentry *,const char *);
375 +       int (*symlink_raw) (struct nameidata *,const char *);
376         int (*mkdir) (struct inode *,struct dentry *,int);
377 +       int (*mkdir_raw) (struct nameidata *,int);
378         int (*rmdir) (struct inode *,struct dentry *);
379 +       int (*rmdir_raw) (struct nameidata *);
380         int (*mknod) (struct inode *,struct dentry *,int,dev_t);
381 +       int (*mknod_raw) (struct nameidata *,int,dev_t);
382         int (*rename) (struct inode *, struct dentry *,
383                         struct inode *, struct dentry *);
384 +       int (*rename_raw) (struct nameidata *, struct nameidata *);
385         int (*readlink) (struct dentry *, char __user *,int);
386         int (*follow_link) (struct dentry *, struct nameidata *);
387         void (*truncate) (struct inode *);
388 @@ -1029,7 +1036,7 @@ static inline int break_lease(struct ino
389  
390  asmlinkage long sys_open(const char *, int, int);
391  asmlinkage long sys_close(unsigned int);       /* yes, it's really unsigned */
392 -extern int do_truncate(struct dentry *, loff_t start);
393 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
394  
395  extern struct file *filp_open(const char *, int, int);
396  extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
397 --- uml-2.5/fs/exec.c~vfs_nointent_2.5.69_rev1  2003-06-04 21:29:14.000000000 -0600
398 +++ uml-2.5-braam/fs/exec.c     2003-06-20 06:22:37.000000000 -0600
399 @@ -1358,7 +1358,7 @@ int do_coredump(long signr, int exit_cod
400                 goto close_fail;
401         if (!file->f_op->write)
402                 goto close_fail;
403 -       if (do_truncate(file->f_dentry, 0) != 0)
404 +       if (do_truncate(file->f_dentry, 0, 0) != 0)
405                 goto close_fail;
406  
407         retval = binfmt->core_dump(signr, regs, file);
408
409 _