1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
|
diff -urN unionfs-1.1.3.old/copyup.c unionfs-1.1.3.new/copyup.c
--- unionfs-1.1.3.old/copyup.c 2006-02-20 19:47:06.000000000 -0300
+++ unionfs-1.1.3.new/copyup.c 2006-04-03 22:35:26.413786991 -0300
@@ -64,7 +64,11 @@
name_list_orig = name_list;
while (*name_list) {
ssize_t size;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&old_hidden_dentry->d_inode->i_mutex);
+#else
down(&old_hidden_dentry->d_inode->i_sem);
+#endif
err = security_inode_getxattr(old_hidden_dentry, name_list);
if (err)
size = err;
@@ -73,7 +77,11 @@
old_hidden_dentry->d_inode->i_op->
getxattr(old_hidden_dentry, name_list, attr_value,
XATTR_SIZE_MAX);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&old_hidden_dentry->d_inode->i_mutex);
+#else
up(&old_hidden_dentry->d_inode->i_sem);
+#endif
if (size < 0) {
err = size;
goto out;
@@ -84,7 +92,11 @@
goto out;
}
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&new_hidden_dentry->d_inode->i_mutex);
+#else
down(&new_hidden_dentry->d_inode->i_sem);
+#endif
err =
security_inode_setxattr(old_hidden_dentry, name_list,
@@ -101,7 +113,11 @@
attr_value, size,
0);
}
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&new_hidden_dentry->d_inode->i_mutex);
+#else
up(&new_hidden_dentry->d_inode->i_sem);
+#endif
if (err < 0)
goto out;
diff -urN unionfs-1.1.3.old/dentry.c unionfs-1.1.3.new/dentry.c
--- unionfs-1.1.3.old/dentry.c 2006-02-20 19:47:06.000000000 -0300
+++ unionfs-1.1.3.new/dentry.c 2006-04-03 22:35:36.633885836 -0300
@@ -108,7 +108,12 @@
interpose_flag = INTERPOSE_REVAL_NEG;
if (positive) {
interpose_flag = INTERPOSE_REVAL;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&dentry->d_inode->i_mutex);
+#else
down(&dentry->d_inode->i_sem);
+#endif
+
bstart = ibstart(dentry->d_inode);
bend = ibend(dentry->d_inode);
if (bstart >= 0) {
@@ -126,7 +131,11 @@
itohi_ptr(dentry->d_inode) = NULL;
ibstart(dentry->d_inode) = -1;
ibend(dentry->d_inode) = -1;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&dentry->d_inode->i_mutex);
+#else
up(&dentry->d_inode->i_sem);
+#endif
}
result = unionfs_lookup_backend(dentry, interpose_flag);
diff -urN unionfs-1.1.3.old/dirhelper.c unionfs-1.1.3.new/dirhelper.c
--- unionfs-1.1.3.old/dirhelper.c 2006-02-20 19:47:06.000000000 -0300
+++ unionfs-1.1.3.new/dirhelper.c 2006-04-03 22:35:45.579217856 -0300
@@ -78,11 +78,19 @@
continue;
}
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&hidden_dir_dentry->d_inode->i_mutex);
+#else
down(&hidden_dir_dentry->d_inode->i_sem);
+#endif
err =
vfs_unlink(hidden_dir_dentry->d_inode,
hidden_dentry);
- up(&hidden_dir_dentry->d_inode->i_sem);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&hidden_dir_dentry->d_inode->i_mutex);
+#else
+ down(&hidden_dir_dentry->d_inode->i_sem);
+#endif
DPUT(hidden_dentry);
if (err && !IS_COPYUP_ERR(err))
diff -urN unionfs-1.1.3.old/file.c unionfs-1.1.3.new/file.c
--- unionfs-1.1.3.old/file.c 2006-02-20 19:47:06.000000000 -0300
+++ unionfs-1.1.3.new/file.c 2006-04-03 22:42:17.319560146 -0300
@@ -264,10 +264,18 @@
if (!hidden_file->f_op || !hidden_file->f_op->fsync)
goto out;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&hidden_file->f_dentry->d_inode->i_mutex);
+#else
down(&hidden_file->f_dentry->d_inode->i_sem);
+#endif
err = hidden_file->f_op->fsync(hidden_file, hidden_file->f_dentry,
datasync);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&hidden_file->f_dentry->d_inode->i_mutex);
+#else
up(&hidden_file->f_dentry->d_inode->i_sem);
+#endif
out:
print_exit_status(err);
diff -urN unionfs-1.1.3.old/inode.c unionfs-1.1.3.new/inode.c
--- unionfs-1.1.3.old/inode.c 2006-02-20 19:47:06.000000000 -0300
+++ unionfs-1.1.3.new/inode.c 2006-04-03 22:42:17.346555567 -0300
@@ -81,7 +81,11 @@
struct dentry *hidden_dir_dentry;
struct iattr newattrs;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&whiteout_dentry->d_inode->i_mutex);
+#else
down(&whiteout_dentry->d_inode->i_sem);
+#endif
newattrs.ia_valid = ATTR_CTIME | ATTR_MODE | ATTR_ATIME
| ATTR_MTIME | ATTR_UID | ATTR_GID | ATTR_FORCE
| ATTR_KILL_SUID | ATTR_KILL_SGID;
@@ -97,7 +101,11 @@
err = notify_change(whiteout_dentry, &newattrs);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&whiteout_dentry->d_inode->i_mutex);
+#else
up(&whiteout_dentry->d_inode->i_sem);
+#endif
if (err)
printk(KERN_WARNING
@@ -594,10 +602,20 @@
err = PTR_ERR(whiteout_dentry);
goto out;
}
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&hidden_dentry->d_inode->i_mutex);
+#else
down(&hidden_dentry->d_inode->i_sem);
+#endif
+
err = vfs_create(hidden_dentry->d_inode,
whiteout_dentry, 0600, NULL);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&hidden_dentry->d_inode->i_mutex);
+#else
up(&hidden_dentry->d_inode->i_sem);
+#endif
+
DPUT(whiteout_dentry);
if (err) {
diff -urN unionfs-1.1.3.old/main.c unionfs-1.1.3.new/main.c
--- unionfs-1.1.3.old/main.c 2006-02-20 19:47:06.000000000 -0300
+++ unionfs-1.1.3.new/main.c 2006-04-03 22:42:17.365552345 -0300
@@ -103,7 +103,12 @@
}
}
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&inode->i_mutex);
+#else
down(&inode->i_sem);
+#endif
+
if (atomic_read(&inode->i_count) > 1)
goto skip;
@@ -172,7 +177,11 @@
fist_print_dentry("Leaving unionfs_interpose", dentry);
fist_print_inode("Leaving unionfs_interpose", inode);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&inode->i_mutex);
+#else
up(&inode->i_sem);
+#endif
out:
print_exit_status(err);
diff -urN unionfs-1.1.3.old/unionfs.h unionfs-1.1.3.new/unionfs.h
--- unionfs-1.1.3.old/unionfs.h 2006-02-20 19:47:06.000000000 -0300
+++ unionfs-1.1.3.new/unionfs.h 2006-04-03 22:42:17.385548953 -0300
@@ -776,13 +776,22 @@
{
struct dentry *dir = DGET(dentry->d_parent);
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&dir->d_inode->i_mutex);
+#else
down(&dir->d_inode->i_sem);
+#endif
+
return dir;
}
static inline void unlock_dir(struct dentry *dir)
{
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&dir->d_inode->i_mutex);
+#else
up(&dir->d_inode->i_sem);
+#endif
DPUT(dir);
}
diff -urN unionfs-1.1.3.old/xattr.c unionfs-1.1.3.new/xattr.c
--- unionfs-1.1.3.old/xattr.c 2006-02-20 19:47:06.000000000 -0300
+++ unionfs-1.1.3.new/xattr.c 2006-04-03 22:42:17.394547426 -0300
@@ -77,14 +77,22 @@
encoded_value = (char *)value;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&hidden_dentry->d_inode->i_mutex);
+#else
down(&hidden_dentry->d_inode->i_sem);
+#endif
/* lock_kernel() already done by caller. */
err =
hidden_dentry->d_inode->i_op->getxattr(hidden_dentry,
encoded_name,
encoded_value, size);
/* unlock_kernel() will be done by caller. */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&hidden_dentry->d_inode->i_mutex);
+#else
up(&hidden_dentry->d_inode->i_sem);
+#endif
}
@@ -112,12 +120,20 @@
name, (unsigned long)size, flags);
if (hidden_dentry->d_inode->i_op->setxattr) {
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&hidden_dentry->d_inode->i_mutex);
+#else
down(&hidden_dentry->d_inode->i_sem);
+#endif
/* lock_kernel() already done by caller. */
err = hidden_dentry->d_inode->i_op->
setxattr(hidden_dentry, name, value, size, flags);
/* unlock_kernel() will be done by caller. */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&hidden_dentry->d_inode->i_mutex);
+#else
up(&hidden_dentry->d_inode->i_sem);
+#endif
}
unlock_dentry(dentry);
@@ -143,13 +159,21 @@
if (hidden_dentry->d_inode->i_op->removexattr) {
encoded_name = (char *)name;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&hidden_dentry->d_inode->i_mutex);
+#else
down(&hidden_dentry->d_inode->i_sem);
+#endif
/* lock_kernel() already done by caller. */
err =
hidden_dentry->d_inode->i_op->removexattr(hidden_dentry,
encoded_name);
/* unlock_kernel() will be done by caller. */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&hidden_dentry->d_inode->i_mutex);
+#else
up(&hidden_dentry->d_inode->i_sem);
+#endif
}
unlock_dentry(dentry);
@@ -173,13 +197,21 @@
if (hidden_dentry->d_inode->i_op->listxattr) {
encoded_list = list;
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_lock(&hidden_dentry->d_inode->i_mutex);
+#else
down(&hidden_dentry->d_inode->i_sem);
+#endif
/* lock_kernel() already done by caller. */
err =
hidden_dentry->d_inode->i_op->listxattr(hidden_dentry,
encoded_list, size);
/* unlock_kernel() will be done by caller. */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
+ mutex_unlock(&hidden_dentry->d_inode->i_mutex);
+#else
up(&hidden_dentry->d_inode->i_sem);
+#endif
}
unlock_dentry(dentry);
|