rename target/linux/generic-2.6 to generic
[15.05/openwrt.git] / target / linux / generic / patches-2.6.33 / 215-mini_fo_2.6.30.patch
1 --- a/fs/mini_fo/aux.c
2 +++ b/fs/mini_fo/aux.c
3 @@ -86,8 +86,10 @@ int get_neg_sto_dentry(dentry_t *dentry)
4         len = dentry->d_name.len;
5         name = dentry->d_name.name;
6  
7 +       mutex_lock(&dtohd2(dentry->d_parent)->d_inode->i_mutex);
8         dtohd2(dentry) =
9                 lookup_one_len(name, dtohd2(dentry->d_parent), len);
10 +       mutex_unlock(&dtohd2(dentry->d_parent)->d_inode->i_mutex);
11  
12   out:
13         return err;
14 @@ -426,7 +428,9 @@ int build_sto_structure(dentry_t *dir, d
15                 const unsigned char *name;
16                 len = dtohd(dentry)->d_name.len;
17                 name = dtohd(dentry)->d_name.name;
18 +               mutex_lock(&dtohd2(dir)->d_inode->i_mutex);
19                 hidden_sto_dentry = lookup_one_len(name, dtohd2(dir), len);
20 +               mutex_unlock(&dtohd2(dir)->d_inode->i_mutex);
21                 dtohd2(dentry) = hidden_sto_dentry;
22         }
23  
24 --- a/fs/mini_fo/inode.c
25 +++ b/fs/mini_fo/inode.c
26 @@ -113,17 +113,23 @@ mini_fo_lookup(inode_t *dir, dentry_t *d
27                 hidden_dir_dentry = hidden_dentry->d_parent;
28                 kfree(bpath);
29         }
30 -       else if(hidden_dir_dentry && hidden_dir_dentry->d_inode)
31 +       else if(hidden_dir_dentry && hidden_dir_dentry->d_inode) {
32 +               mutex_lock(&hidden_dir_dentry->d_inode->i_mutex);
33                 hidden_dentry =
34                         lookup_one_len(name, hidden_dir_dentry, namelen);
35 -       else
36 +               mutex_unlock(&hidden_dir_dentry->d_inode->i_mutex);
37 +       } else {
38                 hidden_dentry = NULL;
39 +       }
40  
41 -       if(hidden_sto_dir_dentry && hidden_sto_dir_dentry->d_inode)
42 +       if(hidden_sto_dir_dentry && hidden_sto_dir_dentry->d_inode) {
43 +               mutex_lock(&hidden_sto_dir_dentry->d_inode->i_mutex);
44                 hidden_sto_dentry =
45                         lookup_one_len(name, hidden_sto_dir_dentry, namelen);
46 -       else
47 +               mutex_unlock(&hidden_sto_dir_dentry->d_inode->i_mutex);
48 +       } else {
49                 hidden_sto_dentry =  NULL;
50 +       }
51  
52         /* catch error in lookup */
53         if (IS_ERR(hidden_dentry) || IS_ERR(hidden_sto_dentry)) {
54 @@ -553,9 +559,11 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de
55  #endif
56  
57                 /* Delete an old WOL file contained in the storage dir */
58 +               mutex_lock(&hidden_sto_dentry->d_inode->i_mutex);
59                 meta_dentry = lookup_one_len(META_FILENAME,
60                                              hidden_sto_dentry,
61                                              strlen(META_FILENAME));
62 +               mutex_unlock(&hidden_sto_dentry->d_inode->i_mutex);
63                 if(meta_dentry->d_inode) {
64                         err = vfs_unlink(hidden_sto_dentry->d_inode, meta_dentry);
65                         dput(meta_dentry);
66 @@ -643,9 +651,11 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de
67  #endif
68  
69                 /* Delete an old WOL file contained in the storage dir */
70 +               mutex_lock(&hidden_sto_dentry->d_inode->i_mutex);
71                 meta_dentry = lookup_one_len(META_FILENAME,
72                                              hidden_sto_dentry,
73                                              strlen(META_FILENAME));
74 +               mutex_unlock(&hidden_sto_dentry->d_inode->i_mutex);
75                 if(meta_dentry->d_inode) {
76                         /* is this necessary? dget(meta_dentry); */
77                         err = vfs_unlink(hidden_sto_dentry->d_inode,
78 @@ -688,9 +698,11 @@ mini_fo_rmdir(inode_t *dir, dentry_t *de
79  #endif
80  
81                 /* Delete an old WOL file contained in the storage dir */
82 +               mutex_lock(&hidden_sto_dentry->d_inode->i_mutex);
83                 meta_dentry = lookup_one_len(META_FILENAME,
84                                              hidden_sto_dentry,
85                                              strlen(META_FILENAME));
86 +               mutex_unlock(&hidden_sto_dentry->d_inode->i_mutex);
87                 if(meta_dentry->d_inode) {
88                         /* is this necessary? dget(meta_dentry); */
89                         err = vfs_unlink(hidden_sto_dentry->d_inode,
90 --- a/fs/mini_fo/meta.c
91 +++ b/fs/mini_fo/meta.c
92 @@ -43,9 +43,11 @@ int meta_build_lists(dentry_t *dentry)
93  
94         /* might there be a META-file? */
95         if(dtohd2(dentry) && dtohd2(dentry)->d_inode) {
96 +               mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
97                 meta_dentry = lookup_one_len(META_FILENAME,
98                                              dtohd2(dentry),
99                                              strlen(META_FILENAME));
100 +               mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
101                 if(!meta_dentry->d_inode) {
102                         dput(meta_dentry);
103                         goto out_ok;
104 @@ -426,8 +428,11 @@ int meta_write_d_entry(dentry_t *dentry,
105                         goto out;
106                  }
107          }
108 +
109 +       mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
110         meta_dentry = lookup_one_len(META_FILENAME,
111                                      dtohd2(dentry), strlen (META_FILENAME));
112 +       mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
113  
114         /* We need to create a META-file */
115          if(!meta_dentry->d_inode) {
116 @@ -527,9 +532,13 @@ int meta_write_r_entry(dentry_t *dentry,
117                         goto out;
118                  }
119          }
120 +
121 +       mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
122         meta_dentry = lookup_one_len(META_FILENAME,
123                                      dtohd2(dentry),
124                                      strlen (META_FILENAME));
125 +       mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
126 +
127          if(!meta_dentry->d_inode) {
128                  /* We need to create a META-file */
129  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
130 @@ -641,9 +650,13 @@ int meta_sync_d_list(dentry_t *dentry, i
131                         goto out;
132                  }
133          }
134 +
135 +       mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
136         meta_dentry = lookup_one_len(META_FILENAME,
137                                      dtohd2(dentry),
138                                      strlen(META_FILENAME));
139 +       mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
140 +
141          if(!meta_dentry->d_inode) {
142                  /* We need to create a META-file */
143  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
144 @@ -784,9 +797,13 @@ int meta_sync_r_list(dentry_t *dentry, i
145                         goto out;
146                  }
147          }
148 +
149 +       mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
150         meta_dentry = lookup_one_len(META_FILENAME,
151                                      dtohd2(dentry),
152                                      strlen(META_FILENAME));
153 +       mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
154 +
155          if(!meta_dentry->d_inode) {
156                  /* We need to create a META-file */
157  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)