-
Notifications
You must be signed in to change notification settings - Fork 4
/
fastvps-hosting-backup-v1_2_6_33_5.patch
708 lines (695 loc) · 19.6 KB
/
fastvps-hosting-backup-v1_2_6_33_5.patch
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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
diff -NurpP -X ignorediff linux-2.6.33.5.orig/fs/compat.c linux-2.6.33.5/fs/compat.c
--- linux-2.6.33.5.orig/fs/compat.c 2010-05-26 23:49:41.000000000 +0200
+++ linux-2.6.33.5/fs/compat.c 2010-06-25 15:52:16.000000000 +0200
@@ -50,6 +50,8 @@
#include <linux/eventpoll.h>
#include <linux/fs_struct.h>
+#include <linux/fs_notify_fvlog.h>
+
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
#include <asm/ioctls.h>
@@ -1171,8 +1173,10 @@ out:
struct dentry *dentry = file->f_path.dentry;
if (type == READ)
fsnotify_access(dentry);
- else
+ else {
fsnotify_modify(dentry);
+ fastvps_log_modified(file); /* FastVPS backup path */
+ }
}
return ret;
}
diff -NurpP -X ignorediff linux-2.6.33.5.orig/fs/dcache.c linux-2.6.33.5/fs/dcache.c
--- linux-2.6.33.5.orig/fs/dcache.c 2010-05-26 23:49:41.000000000 +0200
+++ linux-2.6.33.5/fs/dcache.c 2010-06-25 15:54:29.000000000 +0200
@@ -1597,11 +1597,21 @@ static void switch_names(struct dentry *
target->d_name.name = dentry->d_name.name;
dentry->d_name.name = dentry->d_iname;
} else {
+ /* FastVPS backup patch, for correct names in renameat */
+ char tmp[DNAME_INLINE_LEN];
+ memcpy(tmp, dentry->d_name.name, dentry->d_name.len + 1);
+ /* end */
+
/*
* Both are internal. Just copy target to dentry
*/
memcpy(dentry->d_iname, target->d_name.name,
target->d_name.len + 1);
+
+ /* FastVPS backup patch */
+ memcpy(target->d_iname, tmp, dentry->d_name.len + 1);
+ /* end */
+
dentry->d_name.len = target->d_name.len;
return;
}
diff -NurpP -X ignorediff linux-2.6.33.5.orig/fs/namei.c linux-2.6.33.5/fs/namei.c
--- linux-2.6.33.5.orig/fs/namei.c 2010-05-26 23:49:41.000000000 +0200
+++ linux-2.6.33.5/fs/namei.c 2010-06-25 15:52:16.000000000 +0200
@@ -37,6 +37,9 @@
#include "internal.h"
+/* FastVPS backup patch */
+#include <linux/fs_notify_fvlog.h>
+
/* [Feb-1997 T. Schoebel-Theuer]
* Fundamental changes in the pathname lookup mechanisms (namei)
* were necessary because of omirr. The reason is that omirr needs
@@ -2127,6 +2130,11 @@ SYSCALL_DEFINE3(mkdirat, int, dfd, const
if (error)
goto out_drop_write;
error = vfs_mkdir(nd.path.dentry->d_inode, dentry, mode);
+ /* FastVPS backup patch */
+ if (!error) {
+ fastvps_log_new(&nd.path, dentry->d_name.name);
+ }
+ /* ends */
out_drop_write:
mnt_drop_write(nd.path.mnt);
out_dput:
@@ -2241,6 +2249,11 @@ static long do_rmdir(int dfd, const char
if (error)
goto exit4;
error = vfs_rmdir(nd.path.dentry->d_inode, dentry);
+ /* FastVPS backup patch */
+ if (!error) {
+ fastvps_log_removed(&nd.path, dentry->d_name.name);
+ }
+ /* end */
exit4:
mnt_drop_write(nd.path.mnt);
exit3:
@@ -2330,6 +2343,11 @@ static long do_unlinkat(int dfd, const c
if (error)
goto exit3;
error = vfs_unlink(nd.path.dentry->d_inode, dentry);
+ /* FastVPS backup patch */
+ if (!error) {
+ fastvps_log_removed(&nd.path, dentry->d_name.name);
+ }
+ /* end */
exit3:
mnt_drop_write(nd.path.mnt);
exit2:
@@ -2757,6 +2775,14 @@ SYSCALL_DEFINE4(renameat, int, olddfd, c
goto exit6;
error = vfs_rename(old_dir->d_inode, old_dentry,
new_dir->d_inode, new_dentry);
+ /* FastVPS backup patch */
+ if (!error) {
+ /* That is correct, they are switches in switch_names */
+ fastvps_log_removed(&oldnd.path, new_dentry->d_name.name);
+ fastvps_log_new(&newnd.path, old_dentry->d_name.name);
+ }
+ /* end */
+
exit6:
mnt_drop_write(oldnd.path.mnt);
exit5:
Binary files linux-2.6.33.5.orig/fs/.namei.c.swo and linux-2.6.33.5/fs/.namei.c.swo differ
diff -NurpP -X ignorediff linux-2.6.33.5.orig/fs/notify/fvlog.c linux-2.6.33.5/fs/notify/fvlog.c
--- linux-2.6.33.5.orig/fs/notify/fvlog.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.33.5/fs/notify/fvlog.c 2010-06-25 20:41:53.000000000 +0200
@@ -0,0 +1,368 @@
+/*
+ * Pavel Boldin, 2010 (c) for FastVPS.
+ *
+ * Main stuff for fastvps.ru incremental backup logging
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/path.h>
+#include <linux/magic.h>
+#include <linux/gfp.h>
+#include <linux/sched.h>
+#include <linux/mount.h>
+#include <linux/fs.h>
+#include <linux/proc_fs.h>
+#include <linux/module.h>
+#include <linux/relay.h>
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+#include <linux/rwlock.h>
+#include <linux/percpu.h>
+
+#include <linux/fs_notify_fvlog.h>
+
+/* This app's relayfs channel will be /debug/backup/filelist */
+#define APP_DIR "backup"
+
+/* app data */
+static struct rchan * chan;
+static struct dentry * dir;
+static size_t subbuf_size = 1024;
+static size_t n_subbufs = 1024*16;
+/* static DEFINE_SPINLOCK(chan_lock); */
+
+DEFINE_PER_CPU(int, prev_subbufs_consumed);
+
+/* #define PATTERNS */
+
+#ifdef PATTERNS
+static struct proc_dir_entry * fvlog_dir;
+static LIST_HEAD(patterns);
+static DEFINE_RWLOCK(patterns_lock);
+#endif /* defined PATTERNS */
+
+
+int fastvps_logging_user = 0;
+int fastvps_logging_root = 0;
+
+static inline void fastvps_log_print_channel(char const* msg)
+{
+ __relay_write(chan, msg, strlen(msg));
+}
+
+void fastvps_log_doit(struct path *f_path, char const *name, char *what)
+{
+ if (((fastvps_logging_user && current->cred->uid) || (fastvps_logging_root && !current->cred->uid))
+ && (f_path->mnt->mnt_sb->s_magic == EXT3_SUPER_MAGIC
+ || f_path->mnt->mnt_sb->s_magic == 0 /*REISERFS_SUPER_MAGIC*/)) {
+ /*
+ * For pathname PATH_MAX bytes
+ * for prefix 32 bytes (uid and action)
+ * for total log buffer PATH_MAX + 32
+ */
+ /* PATH_MAX + PATH_MAX + 32 */
+ char *pathname, *log_buf;
+
+ log_buf = (char *) kmalloc(2*PATH_MAX + 32, GFP_KERNEL);
+ if (unlikely( log_buf == (char *)NULL ))
+ return;
+
+ pathname = d_path(f_path, log_buf + PATH_MAX + 32, PATH_MAX);
+ if (IS_ERR(pathname))
+ goto out_free;
+
+ snprintf( log_buf, PATH_MAX + 32, "%d %s %s%s%s\n",
+ current->cred->uid, what, pathname,
+ name[0] ? "/" : "", name );
+
+ fastvps_log_print_channel(log_buf);
+out_free:
+ kfree((void *)log_buf);
+ }
+}
+
+/*
+ * file_create() callback. Creates relay file in debugfs.
+ */
+static struct dentry *create_buf_file_handler(const char *filename,
+ struct dentry *parent,
+ int mode,
+ struct rchan_buf *buf,
+ int *is_global)
+{
+ struct dentry *buf_file;
+
+ buf_file = debugfs_create_file(filename, mode, parent, buf,
+ &relay_file_operations);
+
+ return buf_file;
+}
+
+/*
+ * file_remove() default callback. Removes relay file in debugfs.
+ */
+static int remove_buf_file_handler(struct dentry *dentry)
+{
+ //printk("remove_buf_file_handler: dentry %p\n", dentry);
+
+ debugfs_remove(dentry);
+
+ return 0;
+}
+
+/*
+ * subbuf_start() callback. Does nothing.
+ */
+static int subbuf_start_callback (struct rchan_buf *buf,
+ void *subbuf,
+ void *prev_subbuf,
+ size_t prev_padding)
+{
+ if (relay_buf_full(buf)) {
+ if ( buf->subbufs_consumed - 1 !=
+ __get_cpu_var(prev_subbufs_consumed) ) {
+ __get_cpu_var(prev_subbufs_consumed) = buf->subbufs_consumed - 1;
+ printk("FVLOG: Buffer overflow for cpu %d!\n", buf->cpu);
+ }
+ return 0;
+ }
+
+ if ( buf->subbufs_consumed != __get_cpu_var(prev_subbufs_consumed)
+ && (buf->subbufs_produced - buf->subbufs_consumed) >
+ 8*buf->chan->n_subbufs / 10)
+ {
+ printk("FVLOG: Buffer for cpu %d is about 80%% full\n",
+ buf->cpu);
+ __get_cpu_var(prev_subbufs_consumed) = buf->subbufs_consumed;
+ }
+
+ return 1;
+}
+
+#ifdef PATTERNS
+static void *fvlog_proc_pattern_start(struct seq_file *m, loff_t *_pos)
+{
+ read_lock(&patterns_lock);
+ return seq_list_start_head(&patterns, *_pos);
+}
+
+static void *fvlog_proc_pattern_next(struct seq_file *m, void *v, loff_t *_pos)
+{
+ //read_lock(&patterns_lock);
+ //return seq_list_start_head(&patterns, *_pos);
+ return seq_list_next(v, &patterns, _pos);
+}
+
+static void fvlog_proc_pattern_stop(struct seq_file *m, void *v)
+{
+ read_unlock(&patterns_lock);
+}
+
+static int fvlog_proc_pattern_show(struct seq_file *m, void *v)
+{
+ char test[PATH_MAX+100];
+ return 0;
+}
+
+
+static const struct seq_operations fvlog_proc_pattern_ops =
+{
+ .start = fvlog_proc_pattern_start,
+ .next = fvlog_proc_pattern_next,
+ .stop = fvlog_proc_pattern_stop,
+ .show = fvlog_proc_pattern_show,
+};
+
+static int fvlog_proc_pattern_open(struct inode *inode, struct file *file)
+{
+ //struct seq_file *m;
+ int ret;
+
+ ret = seq_open(file, &fvlog_proc_pattern_ops);
+ if (ret < 0)
+ return ret;
+
+ //m = file->private_data;
+ return 0;
+}
+
+static int fvlog_add_pattern(const char *type, const char *pattern)
+{
+ if (strcmp(type, "accept") == 0) {
+ printk("FVLOG: Log\n");
+ }
+ else if (strcmp(type, "reject") == 0) {
+ printk("FVLOG: Ignore\n");
+ }
+ return 0;
+}
+
+static int fvlog_clear_patterns(void)
+{
+#if 0
+ struct fvlog_pattern *pattern;
+ write_lock(&patterns_lock);
+ list_for_each_entry(pattern, patterns, link)
+ kfree(pattern);
+ INIT_LIST_HEAD(&patterns);
+ write_unlock(&patterns_lock);
+ return 0;
+#endif
+ return 0;
+}
+
+#define IGNORE_SPACES_AND_CHECK(var) ({ \
+ do { *(var)++ = ' '; } while (*(var) == ' '); \
+ if (!*(var)) goto inval; \
+})
+
+static ssize_t fvlog_proc_pattern_write(struct file *file, const char __user *buf,
+ size_t size, loff_t *_pos)
+{
+ char *kbuf, *type, *pattern;
+ int error;
+
+ if (size <= 1 || size >= PAGE_SIZE)
+ return -EINVAL;
+
+ kbuf = kmalloc(size + 1, GFP_KERNEL);
+ if (!kbuf)
+ return -ENOMEM;
+
+ error = -EFAULT;
+ if (copy_from_user(kbuf, buf, size) != 0)
+ goto done;
+ kbuf[size] = 0;
+
+ type = memchr(kbuf, '\n', size);
+ if (type)
+ *type = 0;
+ if (type != kbuf + size - 1)
+ printk("FVLOG: Command after new line discarded\n");
+
+ type = strchr(kbuf, ' ');
+ if (!type)
+ goto inval;
+ IGNORE_SPACES_AND_CHECK(type);
+
+ pattern = strchr(type, ' ');
+ if (!pattern)
+ goto inval;
+ IGNORE_SPACES_AND_CHECK(pattern);
+
+ if (strcmp(kbuf, "add") == 0) {
+ error = fvlog_add_pattern(type, pattern);
+ }
+ else if (strcmp(kbuf, "clear") == 0) {
+ error = fvlog_clear_patterns();
+ }
+
+ error = size;
+
+done:
+ kfree(kbuf);
+ return error;
+
+inval:
+ error = -EINVAL;
+ printk("FVLOG: Invalid command on /proc/fs/fvlog/pattern\n");
+ goto done;
+}
+
+static const struct file_operations fvlog_proc_pattern_fops =
+{
+ .open = fvlog_proc_pattern_open,
+ .read = seq_read,
+ .write = fvlog_proc_pattern_write,
+ .llseek = seq_lseek,
+ .release = seq_release,
+ .owner = THIS_MODULE,
+};
+#endif /* defined PATTERNS */
+
+/*
+ * relayfs callbacks
+ */
+static struct rchan_callbacks relayfs_callbacks =
+{
+ .create_buf_file = create_buf_file_handler,
+ .remove_buf_file = remove_buf_file_handler,
+ .subbuf_start = subbuf_start_callback,
+};
+
+
+static int init(void)
+{
+ int i;
+
+ for_each_possible_cpu(i) {
+ per_cpu(prev_subbufs_consumed, i) = UINT_MAX;
+ }
+
+#ifdef PATTERNS
+ struct proc_dir_entry * p;
+
+ fvlog_dir = proc_mkdir("fs/fvlog", NULL);
+ if (!fvlog_dir) {
+ printk("FVLOG: Couldn't create bluehost patch proc directory.\n");
+ goto error;
+ }
+
+ p = proc_create("pattern", 0600, fvlog_dir, &fvlog_proc_pattern_fops);
+ if (!p) {
+ printk("FVLOG: Couldn't create bluehost patch proc file.\n");
+ goto error_proc;
+ }
+#endif /* defined PATTERNS */
+
+ dir = debugfs_create_dir(APP_DIR, NULL);
+ if (!dir) {
+ printk("FVLOG: Couldn't create bluehost patch debugfs directory.\n");
+ goto error_proc_file;
+ }
+
+ chan = relay_open("log", dir, subbuf_size,
+ n_subbufs, &relayfs_callbacks, NULL);
+
+ if (!chan) {
+ printk("FVLOG: relay app channel creation failed\n");
+ goto error_debugfs;
+ }
+
+ return 0;
+
+error_debugfs:
+ debugfs_remove(dir);
+
+error_proc_file:
+
+#ifdef PATTERNS
+ remove_proc_entry("pattern", fvlog_dir);
+
+error_proc:
+ remove_proc_entry("fs/fvlog", NULL);
+error:
+#endif /* defined PATTERNS */
+
+ return -ENOMEM;
+}
+
+static void cleanup(void)
+{
+ if (chan)
+ relay_close(chan);
+ if (dir)
+ debugfs_remove(dir);
+#ifdef PATTERNS
+ if (fvlog_dir) {
+ remove_proc_entry("pattern", fvlog_dir);
+ remove_proc_entry("fs/fvlog", NULL);
+ }
+#endif /* defined PATTERNS */
+}
+
+module_init(init);
+module_exit(cleanup);
+
+MODULE_LICENSE("GPL");
diff -NurpP -X ignorediff linux-2.6.33.5.orig/fs/notify/Makefile linux-2.6.33.5/fs/notify/Makefile
--- linux-2.6.33.5.orig/fs/notify/Makefile 2010-05-26 23:49:41.000000000 +0200
+++ linux-2.6.33.5/fs/notify/Makefile 2010-06-25 15:52:16.000000000 +0200
@@ -2,3 +2,4 @@ obj-$(CONFIG_FSNOTIFY) += fsnotify.o no
obj-y += dnotify/
obj-y += inotify/
+obj-y += fvlog.o
diff -NurpP -X ignorediff linux-2.6.33.5.orig/fs/open.c linux-2.6.33.5/fs/open.c
--- linux-2.6.33.5.orig/fs/open.c 2010-05-26 23:49:41.000000000 +0200
+++ linux-2.6.33.5/fs/open.c 2010-06-25 15:52:16.000000000 +0200
@@ -34,6 +34,10 @@
#include "internal.h"
+/* FastVPS backup patch */
+#include <linux/fs_notify_fvlog.h>
+/* end */
+
int vfs_statfs(struct dentry *dentry, struct kstatfs *buf)
{
int retval = -ENODEV;
@@ -631,6 +635,11 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd
newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
err = notify_change(dentry, &newattrs);
+ /* FastVPS backup patch */
+ if (!err) {
+ fastvps_log_modified(file);
+ }
+ /* end */
out_unlock:
mutex_unlock(&inode->i_mutex);
mnt_drop_write(file->f_path.mnt);
@@ -664,6 +673,10 @@ SYSCALL_DEFINE3(fchmodat, int, dfd, cons
newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO);
newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
error = notify_change(path.dentry, &newattrs);
+ /* FastVPS backup patch */
+ if (!error) {
+ fastvps_log_changed(&path, "");
+ }
out_unlock:
mutex_unlock(&inode->i_mutex);
mnt_drop_write(path.mnt);
@@ -700,6 +713,11 @@ static int chown_common(struct path *pat
error = security_path_chown(path, user, group);
if (!error)
error = notify_change(path->dentry, &newattrs);
+ /* FastVPS backup patch */
+ if (!error) {
+ fastvps_log_changed(path, "");
+ }
+ /* end */
mutex_unlock(&inode->i_mutex);
return error;
@@ -1057,6 +1075,11 @@ long do_sys_open(int dfd, const char __u
put_unused_fd(fd);
fd = PTR_ERR(f);
} else {
+ /* FastVPS backup patch */
+ if (flags & O_WRONLY && flags & O_CREAT) {
+ fastvps_log_new(&f->f_path,"");
+ }
+
fsnotify_open(f->f_path.dentry);
fd_install(fd, f);
}
diff -NurpP -X ignorediff linux-2.6.33.5.orig/fs/read_write.c linux-2.6.33.5/fs/read_write.c
--- linux-2.6.33.5.orig/fs/read_write.c 2010-05-26 23:49:41.000000000 +0200
+++ linux-2.6.33.5/fs/read_write.c 2010-06-25 15:52:16.000000000 +0200
@@ -21,6 +21,9 @@
#include <asm/uaccess.h>
#include <asm/unistd.h>
+/* FastVPS backup patch */
+#include <linux/fs_notify_fvlog.h>
+
const struct file_operations generic_ro_fops = {
.llseek = generic_file_llseek,
.read = do_sync_read,
@@ -349,6 +352,10 @@ ssize_t vfs_write(struct file *file, con
ret = do_sync_write(file, buf, count, pos);
if (ret > 0) {
fsnotify_modify(file->f_path.dentry);
+
+ /* FastVPS backup patch */
+ fastvps_log_modified(file);
+
add_wchar(current, ret);
}
inc_syscw(current);
@@ -657,8 +664,12 @@ out:
if ((ret + (type == READ)) > 0) {
if (type == READ)
fsnotify_access(file->f_path.dentry);
- else
+ else {
fsnotify_modify(file->f_path.dentry);
+
+ /* FastVPS backup patch */
+ fastvps_log_modified(file);
+ }
}
return ret;
}
diff -NurpP -X ignorediff linux-2.6.33.5.orig/include/linux/fs.h linux-2.6.33.5/include/linux/fs.h
--- linux-2.6.33.5.orig/include/linux/fs.h 2010-05-26 23:49:41.000000000 +0200
+++ linux-2.6.33.5/include/linux/fs.h 2010-06-25 15:52:16.000000000 +0200
@@ -944,6 +944,7 @@ struct file {
struct list_head f_ep_links;
#endif /* #ifdef CONFIG_EPOLL */
struct address_space *f_mapping;
+ unsigned long f_last_log; /* FastVPS patch */
#ifdef CONFIG_DEBUG_WRITECOUNT
unsigned long f_mnt_write_state;
#endif
diff -NurpP -X ignorediff linux-2.6.33.5.orig/include/linux/fs_notify_fvlog.h linux-2.6.33.5/include/linux/fs_notify_fvlog.h
--- linux-2.6.33.5.orig/include/linux/fs_notify_fvlog.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.33.5/include/linux/fs_notify_fvlog.h 2010-06-25 20:26:46.000000000 +0200
@@ -0,0 +1,31 @@
+#ifndef _FVLOG_INCLUDED
+#define _FVLOG_INCLUDED
+
+#include <linux/path.h>
+
+void fastvps_log_doit(struct path *f_path, char const *name, char *what);
+
+static __always_inline void fastvps_log_removed(struct path *f_path, char const *name)
+{
+ fastvps_log_doit(f_path, name, "REM");
+}
+
+static __always_inline void fastvps_log_new(struct path *f_path, char const *name)
+{
+ fastvps_log_doit(f_path, name, "NEW");
+}
+
+static __always_inline void fastvps_log_changed(struct path *f_path, char const *name)
+{
+ fastvps_log_doit(f_path, name, "MOD");
+}
+
+static __always_inline void fastvps_log_modified(struct file *file)
+{
+ if (!file->f_last_log || (jiffies - file->f_last_log) > (86400 * HZ)) {
+ fastvps_log_doit(&file->f_path, "", "MOD");
+ file->f_last_log = jiffies;
+ }
+}
+
+#endif
diff -NurpP -X ignorediff linux-2.6.33.5.orig/kernel/sysctl.c linux-2.6.33.5/kernel/sysctl.c
--- linux-2.6.33.5.orig/kernel/sysctl.c 2010-05-26 23:49:41.000000000 +0200
+++ linux-2.6.33.5/kernel/sysctl.c 2010-06-25 15:52:16.000000000 +0200
@@ -204,6 +204,10 @@ int sysctl_legacy_va_layout;
extern int prove_locking;
extern int lock_stat;
+/* FastVPS backup patch */
+extern int fastvps_logging_user;
+extern int fastvps_logging_root;
+
/* The default sysctl tables: */
static struct ctl_table root_table[] = {
@@ -1433,6 +1437,27 @@ static struct ctl_table fs_table[] = {
.child = binfmt_misc_table,
},
#endif
+
+/* FastVPS patch starts*/
+ {
+ //.ctl_name = CTL_ANY,
+ .procname = "fastvps_logging_user",
+ .data = &fastvps_logging_user,
+ .maxlen = sizeof fastvps_logging_user,
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
+ {
+ //.ctl_name = CTL_ANY,
+ .procname = "fastvps_logging_root",
+ .data = &fastvps_logging_root,
+ .maxlen = sizeof fastvps_logging_root,
+ .mode = 0644,
+ .proc_handler = &proc_dointvec,
+ },
+
+/* end */
+
/*
* NOTE: do not add new entries to this table unless you have read
* Documentation/sysctl/ctl_unnumbered.txt
diff -NurpP -X ignorediff linux-2.6.33.5.orig/mm/mmap.c linux-2.6.33.5/mm/mmap.c
--- linux-2.6.33.5.orig/mm/mmap.c 2010-05-26 23:49:41.000000000 +0200
+++ linux-2.6.33.5/mm/mmap.c 2010-06-25 20:23:33.000000000 +0200
@@ -36,6 +36,10 @@
#include "internal.h"
+/* FastVPS backup patch */
+#include <linux/fs_notify_fvlog.h>
+/* end */
+
#ifndef arch_mmap_check
#define arch_mmap_check(addr, len, flags) (0)
#endif
@@ -1224,6 +1228,12 @@ munmap_back:
if (vm_flags & VM_EXECUTABLE)
added_exe_file_vma(mm);
+ /* FastVPS backup patch */
+ if (vm_flags & VM_SHARED && vm_flags & VM_WRITE) {
+ fastvps_log_modified(file);
+ }
+
+
/* Can addr have changed??
*
* Answer: Yes, several device drivers can do it in their