[kernel] generic-2.6/2.6.30: mini_fo fixes
[openwrt/svn-archive/archive.git] / target / linux / generic-2.6 / patches-2.6.30 / 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 --- a/fs/mini_fo/meta.c
55 +++ b/fs/mini_fo/meta.c
56 @@ -43,9 +43,11 @@ int meta_build_lists(dentry_t *dentry)
57
58 /* might there be a META-file? */
59 if(dtohd2(dentry) && dtohd2(dentry)->d_inode) {
60 + mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
61 meta_dentry = lookup_one_len(META_FILENAME,
62 dtohd2(dentry),
63 strlen(META_FILENAME));
64 + mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
65 if(!meta_dentry->d_inode) {
66 dput(meta_dentry);
67 goto out_ok;
68 @@ -426,8 +428,11 @@ int meta_write_d_entry(dentry_t *dentry,
69 goto out;
70 }
71 }
72 +
73 + mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
74 meta_dentry = lookup_one_len(META_FILENAME,
75 dtohd2(dentry), strlen (META_FILENAME));
76 + mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
77
78 /* We need to create a META-file */
79 if(!meta_dentry->d_inode) {
80 @@ -527,9 +532,13 @@ int meta_write_r_entry(dentry_t *dentry,
81 goto out;
82 }
83 }
84 +
85 + mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
86 meta_dentry = lookup_one_len(META_FILENAME,
87 dtohd2(dentry),
88 strlen (META_FILENAME));
89 + mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
90 +
91 if(!meta_dentry->d_inode) {
92 /* We need to create a META-file */
93 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
94 @@ -641,9 +650,14 @@ int meta_sync_d_list(dentry_t *dentry, i
95 goto out;
96 }
97 }
98 +
99 + mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
100 meta_dentry = lookup_one_len(META_FILENAME,
101 dtohd2(dentry),
102 strlen(META_FILENAME));
103 + mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
104 +
105 +
106 if(!meta_dentry->d_inode) {
107 /* We need to create a META-file */
108 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
109 @@ -784,9 +798,13 @@ int meta_sync_r_list(dentry_t *dentry, i
110 goto out;
111 }
112 }
113 +
114 + mutex_lock(&dtohd2(dentry)->d_inode->i_mutex);
115 meta_dentry = lookup_one_len(META_FILENAME,
116 dtohd2(dentry),
117 strlen(META_FILENAME));
118 + mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
119 +
120 if(!meta_dentry->d_inode) {
121 /* We need to create a META-file */
122 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)