Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / ext-2.4-patch-3.patch
1 # This is a BitKeeper generated patch for the following project:
2 # Project Name: Linux kernel tree
3 #
4 # fs/ext3/dir.c           |    7 +++++--
5 # fs/ext3/namei.c         |   11 +++++++----
6 # include/linux/ext3_fs.h |    2 +-
7 # 3 files changed, 13 insertions(+), 7 deletions(-)
8 #
9 # The following is the BitKeeper ChangeSet Log
10 # --------------------------------------------
11 # 02/11/07      tytso@snap.thunk.org    1.778
12 # Check for failed kmalloc() in ext3_htree_store_dirent()
13
14 # This patch checks for a failed kmalloc() in ext3_htree_store_dirent(),
15 # and passes the error up to its caller, ext3_htree_fill_tree().
16 # --------------------------------------------
17 #
18 diff -Nru a/fs/ext3/dir.c b/fs/ext3/dir.c
19 --- a/fs/ext3/dir.c     Thu Nov  7 10:57:34 2002
20 +++ b/fs/ext3/dir.c     Thu Nov  7 10:57:34 2002
21 @@ -308,7 +308,7 @@
22  /*
23   * Given a directory entry, enter it into the fname rb tree.
24   */
25 -void ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
26 +int ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
27                              __u32 minor_hash,
28                              struct ext3_dir_entry_2 *dirent)
29  {
30 @@ -323,6 +323,8 @@
31         /* Create and allocate the fname structure */
32         len = sizeof(struct fname) + dirent->name_len + 1;
33         new_fn = kmalloc(len, GFP_KERNEL);
34 +       if (!new_fn)
35 +               return -ENOMEM;
36         memset(new_fn, 0, len);
37         new_fn->hash = hash;
38         new_fn->minor_hash = minor_hash;
39 @@ -344,7 +346,7 @@
40                     (new_fn->minor_hash == fname->minor_hash)) {
41                         new_fn->next = fname->next;
42                         fname->next = new_fn;
43 -                       return;
44 +                       return 0;
45                 }
46                         
47                 if (new_fn->hash < fname->hash)
48 @@ -359,6 +361,7 @@
49  
50         rb_link_node(&new_fn->rb_hash, parent, p);
51         rb_insert_color(&new_fn->rb_hash, &info->root);
52 +       return 0;
53  }
54  
55  
56 diff -Nru a/fs/ext3/namei.c b/fs/ext3/namei.c
57 --- a/fs/ext3/namei.c   Thu Nov  7 10:57:34 2002
58 +++ b/fs/ext3/namei.c   Thu Nov  7 10:57:34 2002
59 @@ -549,9 +549,11 @@
60         /* Add '.' and '..' from the htree header */
61         if (!start_hash && !start_minor_hash) {
62                 de = (struct ext3_dir_entry_2 *) frames[0].bh->b_data;
63 -               ext3_htree_store_dirent(dir_file, 0, 0, de);
64 +               if ((err = ext3_htree_store_dirent(dir_file, 0, 0, de)) != 0)
65 +                       goto errout;
66                 de = ext3_next_entry(de);
67 -               ext3_htree_store_dirent(dir_file, 0, 0, de);
68 +               if ((err = ext3_htree_store_dirent(dir_file, 0, 0, de)) != 0)
69 +                       goto errout;
70                 count += 2;
71         }
72  
73 @@ -570,8 +572,9 @@
74                             ((hinfo.hash == start_hash) &&
75                              (hinfo.minor_hash < start_minor_hash)))
76                                 continue;
77 -                       ext3_htree_store_dirent(dir_file, hinfo.hash,
78 -                                               hinfo.minor_hash, de);
79 +                       if ((err = ext3_htree_store_dirent(dir_file,
80 +                                  hinfo.hash, hinfo.minor_hash, de)) != 0)
81 +                               goto errout;
82                         count++;
83                 }
84                 brelse (bh);
85 diff -Nru a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
86 --- a/include/linux/ext3_fs.h   Thu Nov  7 10:57:34 2002
87 +++ b/include/linux/ext3_fs.h   Thu Nov  7 10:57:34 2002
88 @@ -682,7 +682,7 @@
89  extern int ext3_check_dir_entry(const char *, struct inode *,
90                                 struct ext3_dir_entry_2 *,
91                                 struct buffer_head *, unsigned long);
92 -extern void ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
93 +extern int ext3_htree_store_dirent(struct file *dir_file, __u32 hash,
94                                     __u32 minor_hash,
95                                     struct ext3_dir_entry_2 *dirent);
96  extern void ext3_htree_free_dir_info(struct dir_private_info *p);