Whamcloud - gitweb
land v0.9.1 on HEAD, in preparation for a 1.0.x branch
[fs/lustre-release.git] / lustre / kernel_patches / patches / vfs_nointent_2.6.0-test1.patch
1  0 files changed
2
3 --- linux-2.6.0-test1/fs/namei.c~vfs_nointent_2.6.0-test1       2003-07-22 20:18:30.000000000 +0800
4 +++ linux-2.6.0-test1-root/fs/namei.c   2003-07-22 20:27:38.000000000 +0800
5 @@ -1249,7 +1249,7 @@ int may_open(struct nameidata *nd, int a
6                 if (!error) {
7                         DQUOT_INIT(inode);
8                         
9 -                       error = do_truncate(dentry, 0);
10 +                       error = do_truncate(dentry, 0, 1);
11                 }
12                 put_write_access(inode);
13                 if (error)
14 @@ -1494,6 +1494,7 @@ do_mknod(const char __user *filename, in
15         char *tmp;
16         struct dentry *dentry;
17         struct nameidata nd;
18 +       intent_init(&nd.intent, IT_LOOKUP);
19  
20         if (S_ISDIR(mode))
21                 return -EPERM;
22 @@ -1504,6 +1505,15 @@ do_mknod(const char __user *filename, in
23         error = path_lookup(tmp, LOOKUP_PARENT, &nd);
24         if (error)
25                 goto out;
26 +
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)
32 +                       goto out2;
33 +       }
34 +
35         dentry = lookup_create(&nd, 0);
36         error = PTR_ERR(dentry);
37  
38 @@ -1526,6 +1536,7 @@ do_mknod(const char __user *filename, in
39                 dput(dentry);
40         }
41         up(&nd.dentry->d_inode->i_sem);
42 +out2:
43         path_release(&nd);
44  out:
45         putname(tmp);
46 @@ -1588,10 +1599,18 @@ asmlinkage long sys_mkdir(const char __u
47         if (!IS_ERR(tmp)) {
48                 struct dentry *dentry;
49                 struct nameidata nd;
50 +                intent_init(&nd.intent, IT_LOOKUP);
51  
52                 error = path_lookup(tmp, LOOKUP_PARENT, &nd);
53                 if (error)
54                         goto out;
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)
60 +                               goto out2;
61 +               }
62                 dentry = lookup_create(&nd, 1);
63                 error = PTR_ERR(dentry);
64                 if (!IS_ERR(dentry)) {
65 @@ -1601,6 +1620,7 @@ asmlinkage long sys_mkdir(const char __u
66                         dput(dentry);
67                 }
68                 up(&nd.dentry->d_inode->i_sem);
69 +out2:
70                 path_release(&nd);
71  out:
72                 putname(tmp);
73 @@ -1681,6 +1701,7 @@ asmlinkage long sys_rmdir(const char __u
74         char * name;
75         struct dentry *dentry;
76         struct nameidata nd;
77 +        intent_init(&nd.intent, IT_LOOKUP);
78  
79         name = getname(pathname);
80         if(IS_ERR(name))
81 @@ -1701,6 +1722,16 @@ asmlinkage long sys_rmdir(const char __u
82                         error = -EBUSY;
83                         goto exit1;
84         }
85
86 +       if (nd.dentry->d_inode->i_op->rmdir_raw) {
87 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
88
89 +               error = op->rmdir_raw(&nd);
90 +               /* the file system wants to use normal vfs path now */
91 +               if (error != -EOPNOTSUPP)
92 +                       goto exit1;
93 +       }
94
95         down(&nd.dentry->d_inode->i_sem);
96         dentry = lookup_hash(&nd.last, nd.dentry);
97         error = PTR_ERR(dentry);
98 @@ -1759,6 +1790,7 @@ asmlinkage long sys_unlink(const char __
99         struct dentry *dentry;
100         struct nameidata nd;
101         struct inode *inode = NULL;
102 +        intent_init(&nd.intent, IT_LOOKUP);
103  
104         name = getname(pathname);
105         if(IS_ERR(name))
106 @@ -1770,6 +1802,13 @@ asmlinkage long sys_unlink(const char __
107         error = -EISDIR;
108         if (nd.last_type != LAST_NORM)
109                 goto exit1;
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)
115 +                       goto exit1;
116 +       }
117         down(&nd.dentry->d_inode->i_sem);
118         dentry = lookup_hash(&nd.last, nd.dentry);
119         error = PTR_ERR(dentry);
120 @@ -1837,10 +1876,18 @@ asmlinkage long sys_symlink(const char _
121         if (!IS_ERR(to)) {
122                 struct dentry *dentry;
123                 struct nameidata nd;
124 +                intent_init(&nd.intent, IT_LOOKUP);
125  
126                 error = path_lookup(to, LOOKUP_PARENT, &nd);
127                 if (error)
128                         goto out;
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)
134 +                               goto out2;
135 +               }
136                 dentry = lookup_create(&nd, 0);
137                 error = PTR_ERR(dentry);
138                 if (!IS_ERR(dentry)) {
139 @@ -1848,6 +1895,7 @@ asmlinkage long sys_symlink(const char _
140                         dput(dentry);
141                 }
142                 up(&nd.dentry->d_inode->i_sem);
143 +out2:
144                 path_release(&nd);
145  out:
146                 putname(to);
147 @@ -1911,6 +1959,8 @@ asmlinkage long sys_link(const char __us
148         struct nameidata nd, old_nd;
149         int error;
150         char * to;
151 +        intent_init(&nd.intent, IT_LOOKUP);
152 +        intent_init(&old_nd.intent, IT_LOOKUP);
153  
154         to = getname(newname);
155         if (IS_ERR(to))
156 @@ -1925,6 +1975,13 @@ asmlinkage long sys_link(const char __us
157         error = -EXDEV;
158         if (old_nd.mnt != nd.mnt)
159                 goto out_release;
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)
165 +                        goto out_release;
166 +        }
167         new_dentry = lookup_create(&nd, 0);
168         error = PTR_ERR(new_dentry);
169         if (!IS_ERR(new_dentry)) {
170 @@ -1975,7 +2032,7 @@ exit:
171   *        locking].
172   */
173  int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
174 -              struct inode *new_dir, struct dentry *new_dentry)
175 +                   struct inode *new_dir, struct dentry *new_dentry)
176  {
177         int error = 0;
178         struct inode *target;
179 @@ -2020,7 +2077,7 @@ int vfs_rename_dir(struct inode *old_dir
180  }
181  
182  int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
183 -              struct inode *new_dir, struct dentry *new_dentry)
184 +                     struct inode *new_dir, struct dentry *new_dentry)
185  {
186         struct inode *target;
187         int error;
188 @@ -2097,6 +2154,8 @@ static inline int do_rename(const char *
189         struct dentry * old_dentry, *new_dentry;
190         struct dentry * trap;
191         struct nameidata oldnd, newnd;
192 +        intent_init(&oldnd.intent, IT_LOOKUP);
193 +        intent_init(&newnd.intent, IT_LOOKUP);
194  
195         error = path_lookup(oldname, LOOKUP_PARENT, &oldnd);
196         if (error)
197 @@ -2119,6 +2178,13 @@ static inline int do_rename(const char *
198         if (newnd.last_type != LAST_NORM)
199                 goto exit2;
200  
201 +       if (old_dir->d_inode->i_op->rename_raw) {
202 +               error = old_dir->d_inode->i_op->rename_raw(&oldnd, &newnd);
203 +               /* the file system wants to use normal vfs path now */
204 +               if (error != -EOPNOTSUPP)
205 +                       goto exit2;
206 +       }
207 +
208         trap = lock_rename(new_dir, old_dir);
209  
210         old_dentry = lookup_hash(&oldnd.last, old_dir);
211 @@ -2150,8 +2216,7 @@ static inline int do_rename(const char *
212         if (new_dentry == trap)
213                 goto exit5;
214  
215 -       error = vfs_rename(old_dir->d_inode, old_dentry,
216 -                                  new_dir->d_inode, new_dentry);
217 +       error = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry);
218  exit5:
219         dput(new_dentry);
220  exit4:
221 --- linux-2.6.0-test1/fs/open.c~vfs_nointent_2.6.0-test1        2003-07-22 20:18:30.000000000 +0800
222 +++ linux-2.6.0-test1-root/fs/open.c    2003-07-22 20:26:41.000000000 +0800
223 @@ -178,9 +178,10 @@ out:
224         return error;
225  }
226  
227 -int do_truncate(struct dentry *dentry, loff_t length)
228 +int do_truncate(struct dentry *dentry, loff_t length, int called_from_open)
229  {
230         int err;
231 +       struct inode_operations *op = dentry->d_inode->i_op;
232         struct iattr newattrs;
233  
234         /* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */
235 @@ -190,7 +191,14 @@ int do_truncate(struct dentry *dentry, l
236         newattrs.ia_size = length;
237         newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
238         down(&dentry->d_inode->i_sem);
239 -       err = notify_change(dentry, &newattrs);
240 +       if (called_from_open)
241 +               newattrs.ia_valid |= ATTR_FROM_OPEN;
242 +       if (op->setattr_raw) {
243 +               newattrs.ia_valid |= ATTR_RAW;
244 +               newattrs.ia_ctime = CURRENT_TIME;
245 +               err = op->setattr_raw(dentry->d_inode, &newattrs);
246 +       } else 
247 +                err = notify_change(dentry, &newattrs);
248         up(&dentry->d_inode->i_sem);
249         return err;
250  }
251 @@ -245,7 +253,7 @@ static inline long do_sys_truncate(const
252         error = locks_verify_truncate(inode, NULL, length);
253         if (!error) {
254                 DQUOT_INIT(inode);
255 -               error = do_truncate(nd.dentry, length);
256 +               error = do_truncate(nd.dentry, length, 0);
257         }
258         put_write_access(inode);
259  
260 @@ -297,7 +305,7 @@ static inline long do_sys_ftruncate(unsi
261  
262         error = locks_verify_truncate(inode, file, length);
263         if (!error)
264 -               error = do_truncate(dentry, length);
265 +               error = do_truncate(dentry, length, 0);
266  out_putf:
267         fput(file);
268  out:
269 @@ -368,9 +376,19 @@ asmlinkage long sys_utime(char __user * 
270                     (error = permission(inode,MAY_WRITE,&nd)) != 0)
271                         goto dput_and_out;
272         }
273 -       down(&inode->i_sem);
274 -       error = notify_change(nd.dentry, &newattrs);
275 -       up(&inode->i_sem);
276 +       if (inode->i_op->setattr_raw) {
277 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
278 +
279 +               newattrs.ia_valid |= ATTR_RAW;
280 +               error = op->setattr_raw(inode, &newattrs);
281 +               /* the file system wants to use normal vfs path now */
282 +               if (error != -EOPNOTSUPP)
283 +                       goto dput_and_out;
284 +       } else {
285 +                down(&inode->i_sem);
286 +                error = notify_change(nd.dentry, &newattrs);
287 +                up(&inode->i_sem);
288 +        }
289  dput_and_out:
290         path_release(&nd);
291  out:
292 @@ -413,9 +431,19 @@ long do_utimes(char __user * filename, s
293                     (error = permission(inode,MAY_WRITE,&nd)) != 0)
294                         goto dput_and_out;
295         }
296 -       down(&inode->i_sem);
297 -       error = notify_change(nd.dentry, &newattrs);
298 -       up(&inode->i_sem);
299 +       if (inode->i_op->setattr_raw) {
300 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
301 +
302 +               newattrs.ia_valid |= ATTR_RAW;
303 +               error = op->setattr_raw(inode, &newattrs);
304 +               /* the file system wants to use normal vfs path now */
305 +               if (error != -EOPNOTSUPP)
306 +                       goto dput_and_out;
307 +       } else {
308 +                down(&inode->i_sem);
309 +                error = notify_change(nd.dentry, &newattrs);
310 +                up(&inode->i_sem);
311 +        }
312  dput_and_out:
313         path_release(&nd);
314  out:
315 @@ -616,6 +644,18 @@ asmlinkage long sys_chmod(const char __u
316         if (IS_RDONLY(inode))
317                 goto dput_and_out;
318         
319 +       if (inode->i_op->setattr_raw) {
320 +               struct inode_operations *op = nd.dentry->d_inode->i_op;
321 +
322 +               newattrs.ia_mode = mode;
323 +               newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
324 +               newattrs.ia_valid |= ATTR_RAW;
325 +               error = op->setattr_raw(inode, &newattrs);
326 +               /* the file system wants to use normal vfs path now */
327 +               if (error != -EOPNOTSUPP)
328 +                       goto dput_and_out;
329 +       }
330 +
331         error = -EPERM;
332         if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
333                 goto dput_and_out;
334 @@ -649,6 +689,18 @@ static int chown_common(struct dentry * 
335         if (IS_RDONLY(inode))
336                 goto out;
337         error = -EPERM;
338 +       if (inode->i_op->setattr_raw) {
339 +               struct inode_operations *op = dentry->d_inode->i_op;
340 +
341 +               newattrs.ia_uid = user;
342 +               newattrs.ia_gid = group;
343 +               newattrs.ia_valid = ATTR_UID | ATTR_GID;
344 +               newattrs.ia_valid |= ATTR_RAW;
345 +               error = op->setattr_raw(inode, &newattrs);
346 +               /* the file system wants to use normal vfs path now */
347 +               if (error != -EOPNOTSUPP)
348 +                       return error;
349 +       }
350         if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
351                 goto out;
352         newattrs.ia_valid =  ATTR_CTIME;
353 @@ -662,6 +714,7 @@ static int chown_common(struct dentry * 
354         }
355         if (!S_ISDIR(inode->i_mode))
356                 newattrs.ia_valid |= ATTR_KILL_SUID|ATTR_KILL_SGID;
357 +
358         down(&inode->i_sem);
359         error = notify_change(dentry, &newattrs);
360         up(&inode->i_sem);
361 --- linux-2.6.0-test1/include/linux/fs.h~vfs_nointent_2.6.0-test1       2003-07-22 20:18:30.000000000 +0800
362 +++ linux-2.6.0-test1-root/include/linux/fs.h   2003-07-22 20:26:41.000000000 +0800
363 @@ -807,13 +807,20 @@ struct inode_operations {
364         int (*create) (struct inode *,struct dentry *,int, struct nameidata *);
365         struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);
366         int (*link) (struct dentry *,struct inode *,struct dentry *);
367 +       int (*link_raw) (struct nameidata *,struct nameidata *);
368         int (*unlink) (struct inode *,struct dentry *);
369 +       int (*unlink_raw) (struct nameidata *);
370         int (*symlink) (struct inode *,struct dentry *,const char *);
371 +       int (*symlink_raw) (struct nameidata *,const char *);
372         int (*mkdir) (struct inode *,struct dentry *,int);
373 +       int (*mkdir_raw) (struct nameidata *,int);
374         int (*rmdir) (struct inode *,struct dentry *);
375 +       int (*rmdir_raw) (struct nameidata *);
376         int (*mknod) (struct inode *,struct dentry *,int,dev_t);
377 +       int (*mknod_raw) (struct nameidata *,int,dev_t);
378         int (*rename) (struct inode *, struct dentry *,
379                         struct inode *, struct dentry *);
380 +       int (*rename_raw) (struct nameidata *, struct nameidata *);
381         int (*readlink) (struct dentry *, char __user *,int);
382         int (*follow_link) (struct dentry *, struct nameidata *);
383         void (*truncate) (struct inode *);
384 @@ -1098,7 +1105,7 @@ static inline int break_lease(struct ino
385  
386  asmlinkage long sys_open(const char __user *, int, int);
387  asmlinkage long sys_close(unsigned int);       /* yes, it's really unsigned */
388 -extern int do_truncate(struct dentry *, loff_t start);
389 +extern int do_truncate(struct dentry *, loff_t start, int called_from_open);
390  
391  extern struct file *filp_open(const char *, int, int);
392  extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
393 --- linux-2.6.0-test1/fs/exec.c~vfs_nointent_2.6.0-test1        2003-07-22 20:18:30.000000000 +0800
394 +++ linux-2.6.0-test1-root/fs/exec.c    2003-07-22 20:26:41.000000000 +0800
395 @@ -1352,7 +1352,7 @@ int do_coredump(long signr, int exit_cod
396                 goto close_fail;
397         if (!file->f_op->write)
398                 goto close_fail;
399 -       if (do_truncate(file->f_dentry, 0) != 0)
400 +       if (do_truncate(file->f_dentry, 0, 0) != 0)
401                 goto close_fail;
402  
403         retval = binfmt->core_dump(signr, regs, file);
404
405 _