1 # This is a BitKeeper generated patch for the following project:
2 # Project Name: Linux kernel tree
3 # This patch format is intended for GNU patch command version 2.5 or higher.
4 # This patch includes the following deltas:
5 # ChangeSet 1.810 -> 1.811
6 # kernel/ksyms.c 1.149 -> 1.150
7 # fs/driverfs/inode.c 1.52 -> 1.53
8 # include/linux/fs.h 1.175 -> 1.176
9 # include/linux/namei.h 1.3 -> 1.4
10 # fs/namei.c 1.56 -> 1.57
11 # fs/nfsd/vfs.c 1.44 -> 1.45
12 # arch/um/kernel/mem.c 1.5 -> 1.6
13 # net/unix/af_unix.c 1.29 -> 1.30
14 # mm/slab.c 1.33 -> 1.34
15 # fs/sysfs/inode.c 1.55 -> 1.56
16 # include/linux/slab.h 1.13 -> 1.14
17 # include/linux/dcache.h 1.19 -> 1.20
19 # The following is the BitKeeper ChangeSet Log
20 # --------------------------------------------
21 # 02/10/20 braam@clusterfs.com 1.811
23 # --------------------------------------------
25 diff -Nru a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
26 --- a/arch/um/kernel/mem.c Sun Dec 8 02:49:38 2002
27 +++ b/arch/um/kernel/mem.c Sun Dec 8 02:49:38 2002
29 return(phys_mem_map(pte_val(pte)));
32 +struct page *check_get_page(unsigned long kaddr)
35 + struct mem_region *mr;
36 + unsigned long phys = __pa(kaddr);
37 + unsigned int n = phys_region_index(phys);
39 + if(regions[n] == NULL)
43 + page = (struct page *) mr->mem_map;
44 + return page + ((phys_addr(phys)) >> PAGE_SHIFT);
48 struct mem_region *page_region(struct page *page, int *index_out)
52 (addr <= region->start + region->len))
53 return(mk_phys(addr - region->start, i));
55 - panic("region_pa : no region for virtual address");
56 + //panic("region_pa : no region for virtual address");
60 diff -Nru a/fs/driverfs/inode.c b/fs/driverfs/inode.c
61 --- a/fs/driverfs/inode.c Sun Dec 8 02:49:38 2002
62 +++ b/fs/driverfs/inode.c Sun Dec 8 02:49:38 2002
65 qstr.len = strlen(name);
66 qstr.hash = full_name_hash(name,qstr.len);
67 - return lookup_hash(&qstr,parent);
68 + return lookup_hash(&qstr,parent, NULL);
72 diff -Nru a/fs/namei.c b/fs/namei.c
73 --- a/fs/namei.c Sun Dec 8 02:49:38 2002
74 +++ b/fs/namei.c Sun Dec 8 02:49:38 2002
77 void path_release(struct nameidata *nd)
79 + if (nd->dentry && nd->dentry->d_op &&
80 + nd->dentry->d_op->d_intent_release)
81 + nd->dentry->d_op->d_intent_release(nd->dentry, &nd->it);
86 * Internal lookup() using the new generic dcache.
89 -static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, int flags)
90 +static struct dentry * cached_lookup(struct dentry * parent, struct qstr * name, int flags, struct lookup_intent *it)
92 struct dentry * dentry = d_lookup(parent, name);
94 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate2) {
95 + if (!dentry->d_op->d_revalidate2(dentry, flags, it) &&
96 + !d_invalidate(dentry)) {
102 if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
103 if (!dentry->d_op->d_revalidate(dentry, flags) && !d_invalidate(dentry)) {
106 * make sure that nobody added the entry to the dcache in the meantime..
109 -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags)
110 +static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags, struct lookup_intent *it)
112 struct dentry * result;
113 struct inode *dir = parent->d_inode;
115 struct dentry * dentry = d_alloc(parent, name);
116 result = ERR_PTR(-ENOMEM);
118 - result = dir->i_op->lookup(dir, dentry);
119 + if (dir->i_op->lookup2)
120 + result = dir->i_op->lookup2(dir, dentry, it);
122 + result = dir->i_op->lookup(dir, dentry);
128 result = ERR_PTR(-ENOENT);
130 + } else if (result->d_op && result->d_op->d_revalidate2) {
131 + if (!result->d_op->d_revalidate2(result, flags, it) &&
132 + !d_invalidate(result)) {
134 + result = ERR_PTR(-ENOENT);
143 - dentry = real_lookup(nd->dentry, name, LOOKUP_CONTINUE);
144 + dentry = real_lookup(nd->dentry, name, LOOKUP_CONTINUE, &nd->it);
149 nd->dentry = next.dentry;
152 - if (!inode->i_op->lookup)
153 + if (!inode->i_op->lookup && !inode->i_op->lookup2)
156 /* here ends the main loop */
159 if (lookup_flags & LOOKUP_DIRECTORY) {
161 - if (!inode->i_op || !inode->i_op->lookup)
162 + if (!inode->i_op ||
163 + (!inode->i_op->lookup && !inode->i_op->lookup2))
168 * needs parent already locked. Doesn't follow mounts.
171 -struct dentry * lookup_hash(struct qstr *name, struct dentry * base)
172 +struct dentry * lookup_hash(struct qstr *name, struct dentry * base,
173 + struct lookup_intent *it)
175 struct dentry * dentry;
177 @@ -909,13 +931,16 @@
181 - dentry = cached_lookup(base, name, 0);
182 + dentry = cached_lookup(base, name, 0, it);
184 struct dentry *new = d_alloc(base, name);
185 dentry = ERR_PTR(-ENOMEM);
188 - dentry = inode->i_op->lookup(inode, new);
189 + if (inode->i_op->lookup2)
190 + dentry = inode->i_op->lookup2(inode, new, it);
192 + dentry = inode->i_op->lookup(inode, new);
195 security_ops->inode_post_lookup(inode, dentry);
200 -struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
201 +struct dentry * lookup_one_len_it(const char * name, struct dentry * base, int len, struct lookup_intent *it)
205 @@ -947,11 +972,16 @@
207 this.hash = end_name_hash(hash);
209 - return lookup_hash(&this, base);
210 + return lookup_hash(&this, base, it);
212 return ERR_PTR(-EACCES);
215 +struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
217 + return lookup_one_len_it(name, base, len, NULL);
223 @@ -1268,7 +1298,7 @@
226 down(&dir->d_inode->i_sem);
227 - dentry = lookup_hash(&nd->last, nd->dentry);
228 + dentry = lookup_hash(&nd->last, nd->dentry, &nd->it);
231 error = PTR_ERR(dentry);
232 @@ -1370,7 +1400,7 @@
235 down(&dir->d_inode->i_sem);
236 - dentry = lookup_hash(&nd->last, nd->dentry);
237 + dentry = lookup_hash(&nd->last, nd->dentry, &nd->it);
238 putname(nd->last.name);
241 @@ -1384,7 +1414,7 @@
242 dentry = ERR_PTR(-EEXIST);
243 if (nd->last_type != LAST_NORM)
245 - dentry = lookup_hash(&nd->last, nd->dentry);
246 + dentry = lookup_hash(&nd->last, nd->dentry, &nd->it);
249 if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode)
250 @@ -1614,7 +1644,7 @@
253 down(&nd.dentry->d_inode->i_sem);
254 - dentry = lookup_hash(&nd.last, nd.dentry);
255 + dentry = lookup_hash(&nd.last, nd.dentry, &nd.it);
256 error = PTR_ERR(dentry);
257 if (!IS_ERR(dentry)) {
258 error = vfs_rmdir(nd.dentry->d_inode, dentry);
259 @@ -1675,7 +1705,7 @@
260 if (nd.last_type != LAST_NORM)
262 down(&nd.dentry->d_inode->i_sem);
263 - dentry = lookup_hash(&nd.last, nd.dentry);
264 + dentry = lookup_hash(&nd.last, nd.dentry, &nd.it);
265 error = PTR_ERR(dentry);
266 if (!IS_ERR(dentry)) {
267 /* Why not before? Because we want correct error value */
268 @@ -1949,7 +1979,8 @@
271 int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
272 - struct inode *new_dir, struct dentry *new_dentry)
273 + struct inode *new_dir, struct dentry *new_dentry,
274 + struct lookup_intent *it)
277 int is_dir = S_ISDIR(old_dentry->d_inode->i_mode);
278 @@ -2020,7 +2051,7 @@
280 trap = lock_rename(new_dir, old_dir);
282 - old_dentry = lookup_hash(&oldnd.last, old_dir);
283 + old_dentry = lookup_hash(&oldnd.last, old_dir, &oldnd.it);
284 error = PTR_ERR(old_dentry);
285 if (IS_ERR(old_dentry))
287 @@ -2040,7 +2071,7 @@
289 if (old_dentry == trap)
291 - new_dentry = lookup_hash(&newnd.last, new_dir);
292 + new_dentry = lookup_hash(&newnd.last, new_dir, &newnd.it);
293 error = PTR_ERR(new_dentry);
294 if (IS_ERR(new_dentry))
296 @@ -2050,7 +2081,7 @@
299 error = vfs_rename(old_dir->d_inode, old_dentry,
300 - new_dir->d_inode, new_dentry);
301 + new_dir->d_inode, new_dentry, NULL);
305 diff -Nru a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
306 --- a/fs/nfsd/vfs.c Sun Dec 8 02:49:38 2002
307 +++ b/fs/nfsd/vfs.c Sun Dec 8 02:49:38 2002
308 @@ -1292,7 +1292,7 @@
312 - err = vfs_rename(fdir, odentry, tdir, ndentry);
313 + err = vfs_rename(fdir, odentry, tdir, ndentry, NULL);
314 if (!err && EX_ISSYNC(tfhp->fh_export)) {
315 nfsd_sync_dir(tdentry);
316 nfsd_sync_dir(fdentry);
317 diff -Nru a/fs/sysfs/inode.c b/fs/sysfs/inode.c
318 --- a/fs/sysfs/inode.c Sun Dec 8 02:49:39 2002
319 +++ b/fs/sysfs/inode.c Sun Dec 8 02:49:39 2002
322 qstr.len = strlen(name);
323 qstr.hash = full_name_hash(name,qstr.len);
324 - return lookup_hash(&qstr,parent);
325 + return lookup_hash(&qstr,parent,NULL);
329 diff -Nru a/include/linux/dcache.h b/include/linux/dcache.h
330 --- a/include/linux/dcache.h Sun Dec 8 02:49:39 2002
331 +++ b/include/linux/dcache.h Sun Dec 8 02:49:39 2002
333 #include <linux/spinlock.h>
334 #include <asm/page.h> /* for BUG() */
337 +#define IT_CREAT (1<<1)
338 +#define IT_MKDIR (1<<2)
339 +#define IT_LINK (1<<3)
340 +#define IT_LINK2 (1<<4)
341 +#define IT_SYMLINK (1<<5)
342 +#define IT_UNLINK (1<<6)
343 +#define IT_RMDIR (1<<7)
344 +#define IT_RENAME (1<<8)
345 +#define IT_RENAME2 (1<<9)
346 +#define IT_READDIR (1<<10)
347 +#define IT_GETATTR (1<<11)
348 +#define IT_SETATTR (1<<12)
349 +#define IT_READLINK (1<<13)
350 +#define IT_MKNOD (1<<14)
351 +#define IT_LOOKUP (1<<15)
355 * linux/include/linux/dcache.h
361 +#include <linux/namei.h>
363 struct dentry_stat_t {
367 struct list_head d_subdirs; /* our children */
368 struct list_head d_alias; /* inode alias list */
370 + struct lookup_intent *d_it;
372 unsigned long d_time; /* used by d_revalidate */
373 struct dentry_operations *d_op;
375 int (*d_delete)(struct dentry *);
376 void (*d_release)(struct dentry *);
377 void (*d_iput)(struct dentry *, struct inode *);
378 + int (*d_revalidate2)(struct dentry *, int, struct lookup_intent *);
379 + void (*d_intent_release)(struct dentry *, struct lookup_intent *);
382 /* the dentry parameter passed to d_hash and d_compare is the parent
383 diff -Nru a/include/linux/fs.h b/include/linux/fs.h
384 --- a/include/linux/fs.h Sun Dec 8 02:49:38 2002
385 +++ b/include/linux/fs.h Sun Dec 8 02:49:38 2002
387 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
388 extern int vfs_rmdir(struct inode *, struct dentry *);
389 extern int vfs_unlink(struct inode *, struct dentry *);
390 -extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
391 +extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct lookup_intent *it);
396 struct inode_operations {
397 int (*create) (struct inode *,struct dentry *,int);
398 struct dentry * (*lookup) (struct inode *,struct dentry *);
399 + struct dentry * (*lookup2) (struct inode *,struct dentry *,
400 + struct lookup_intent *);
401 int (*link) (struct dentry *,struct inode *,struct dentry *);
402 int (*unlink) (struct inode *,struct dentry *);
403 int (*symlink) (struct inode *,struct dentry *,const char *);
405 extern int unregister_filesystem(struct file_system_type *);
406 extern struct vfsmount *kern_mount(struct file_system_type *);
407 extern int may_umount(struct vfsmount *);
408 +struct vfsmount *do_kern_mount(const char *type, int flags, char *name, void *data);
409 extern long do_mount(char *, char *, char *, unsigned long, void *);
411 #define kern_umount mntput
412 diff -Nru a/include/linux/namei.h b/include/linux/namei.h
413 --- a/include/linux/namei.h Sun Dec 8 02:49:38 2002
414 +++ b/include/linux/namei.h Sun Dec 8 02:49:38 2002
419 +struct lookup_intent {
422 + int it_disposition;
424 + struct iattr *it_iattr;
425 + __u64 it_lock_handle[2];
431 struct dentry *dentry;
432 struct vfsmount *mnt;
435 struct dentry *old_dentry;
436 struct vfsmount *old_mnt;
437 + struct lookup_intent it;
442 extern void path_release(struct nameidata *);
444 extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
445 -extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
446 +extern struct dentry * lookup_hash(struct qstr *, struct dentry *, struct lookup_intent *);
448 extern int follow_down(struct vfsmount **, struct dentry **);
449 extern int follow_up(struct vfsmount **, struct dentry **);
450 diff -Nru a/include/linux/slab.h b/include/linux/slab.h
451 --- a/include/linux/slab.h Sun Dec 8 02:49:39 2002
452 +++ b/include/linux/slab.h Sun Dec 8 02:49:39 2002
454 extern int kmem_cache_shrink(kmem_cache_t *);
455 extern void *kmem_cache_alloc(kmem_cache_t *, int);
456 extern void kmem_cache_free(kmem_cache_t *, void *);
457 +extern int kmem_cache_validate(kmem_cache_t *cachep, void *objp);
458 extern unsigned int kmem_cache_size(kmem_cache_t *);
460 extern void *kmalloc(size_t, int);
461 diff -Nru a/kernel/ksyms.c b/kernel/ksyms.c
462 --- a/kernel/ksyms.c Sun Dec 8 02:49:38 2002
463 +++ b/kernel/ksyms.c Sun Dec 8 02:49:38 2002
465 EXPORT_SYMBOL(tty_get_baud_rate);
466 EXPORT_SYMBOL(do_SAK);
469 +EXPORT_SYMBOL(panic_notifier_list);
470 +//EXPORT_SYMBOL(pagecache_lock_cacheline);
471 +EXPORT_SYMBOL(do_kern_mount);
472 +EXPORT_SYMBOL(exit_files);
473 +EXPORT_SYMBOL(kmem_cache_validate);
475 /* filesystem registration */
476 EXPORT_SYMBOL(register_filesystem);
477 EXPORT_SYMBOL(unregister_filesystem);
478 diff -Nru a/mm/slab.c b/mm/slab.c
479 --- a/mm/slab.c Sun Dec 8 02:49:39 2002
480 +++ b/mm/slab.c Sun Dec 8 02:49:39 2002
481 @@ -1236,6 +1236,59 @@
482 * Called with the cache-lock held.
485 +extern struct page *check_get_page(unsigned long kaddr);
486 +struct page *page_mem_map(struct page *page);
487 +static int kmem_check_cache_obj (kmem_cache_t * cachep,
488 + slab_t *slabp, void * objp)
491 + unsigned int objnr;
494 + if (cachep->flags & SLAB_RED_ZONE) {
495 + objp -= BYTES_PER_WORD;
496 + if ( *(unsigned long *)objp != RED_MAGIC2)
497 + /* Either write before start, or a double free. */
499 + if (*(unsigned long *)(objp+cachep->objsize -
500 + BYTES_PER_WORD) != RED_MAGIC2)
501 + /* Either write past end, or a double free. */
506 + objnr = (objp-slabp->s_mem)/cachep->objsize;
507 + if (objnr >= cachep->num)
509 + if (objp != slabp->s_mem + objnr*cachep->objsize)
512 + /* Check slab's freelist to see if this obj is there. */
513 + for (i = slabp->free; i != BUFCTL_END; i = slab_bufctl(slabp)[i]) {
521 +int kmem_cache_validate(kmem_cache_t *cachep, void *objp)
523 + struct page *page = check_get_page((unsigned long)objp);
525 + if (!page_mem_map(page))
528 + if (!PageSlab(page))
531 + /* XXX check for freed slab objects ? */
532 + if (!kmem_check_cache_obj(cachep, GET_PAGE_SLAB(page), objp))
535 + return (cachep == GET_PAGE_CACHE(page));
539 static int kmem_extra_free_checks (kmem_cache_t * cachep,
540 slab_t *slabp, void * objp)
541 diff -Nru a/net/unix/af_unix.c b/net/unix/af_unix.c
542 --- a/net/unix/af_unix.c Sun Dec 8 02:49:38 2002
543 +++ b/net/unix/af_unix.c Sun Dec 8 02:49:38 2002
546 * Do the final lookup.
548 - dentry = lookup_hash(&nd.last, nd.dentry);
549 + dentry = lookup_hash(&nd.last, nd.dentry, NULL);
550 err = PTR_ERR(dentry);
552 goto out_mknod_unlock;