writeback: limit write_cache_pages integrity scanning to current EOF
[safe/jmp/linux-2.6] / net / netfilter / nf_log.c
index 4e62030..7df37fd 100644 (file)
@@ -52,7 +52,8 @@ int nf_log_register(u_int8_t pf, struct nf_logger *logger)
        } else {
                /* register at end of list to honor first register win */
                list_add_tail(&logger->list[pf], &nf_loggers_l[pf]);
-               llog = rcu_dereference(nf_loggers[pf]);
+               llog = rcu_dereference_protected(nf_loggers[pf],
+                                                lockdep_is_held(&nf_log_mutex));
                if (llog == NULL)
                        rcu_assign_pointer(nf_loggers[pf], logger);
        }
@@ -70,7 +71,8 @@ void nf_log_unregister(struct nf_logger *logger)
 
        mutex_lock(&nf_log_mutex);
        for (i = 0; i < ARRAY_SIZE(nf_loggers); i++) {
-               c_logger = rcu_dereference(nf_loggers[i]);
+               c_logger = rcu_dereference_protected(nf_loggers[i],
+                                                    lockdep_is_held(&nf_log_mutex));
                if (c_logger == logger)
                        rcu_assign_pointer(nf_loggers[i], NULL);
                list_del(&logger->list[i]);
@@ -128,9 +130,8 @@ EXPORT_SYMBOL(nf_log_packet);
 
 #ifdef CONFIG_PROC_FS
 static void *seq_start(struct seq_file *seq, loff_t *pos)
-       __acquires(RCU)
 {
-       rcu_read_lock();
+       mutex_lock(&nf_log_mutex);
 
        if (*pos >= ARRAY_SIZE(nf_loggers))
                return NULL;
@@ -149,9 +150,8 @@ static void *seq_next(struct seq_file *s, void *v, loff_t *pos)
 }
 
 static void seq_stop(struct seq_file *s, void *v)
-       __releases(RCU)
 {
-       rcu_read_unlock();
+       mutex_unlock(&nf_log_mutex);
 }
 
 static int seq_show(struct seq_file *s, void *v)
@@ -161,7 +161,7 @@ static int seq_show(struct seq_file *s, void *v)
        struct nf_logger *t;
        int ret;
 
-       logger = rcu_dereference(nf_loggers[*pos]);
+       logger = nf_loggers[*pos];
 
        if (!logger)
                ret = seq_printf(s, "%2lld NONE (", *pos);
@@ -171,22 +171,16 @@ static int seq_show(struct seq_file *s, void *v)
        if (ret < 0)
                return ret;
 
-       mutex_lock(&nf_log_mutex);
        list_for_each_entry(t, &nf_loggers_l[*pos], list[*pos]) {
                ret = seq_printf(s, "%s", t->name);
-               if (ret < 0) {
-                       mutex_unlock(&nf_log_mutex);
+               if (ret < 0)
                        return ret;
-               }
                if (&t->list[*pos] != nf_loggers_l[*pos].prev) {
                        ret = seq_printf(s, ",");
-                       if (ret < 0) {
-                               mutex_unlock(&nf_log_mutex);
+                       if (ret < 0)
                                return ret;
-                       }
                }
        }
-       mutex_unlock(&nf_log_mutex);
 
        return seq_printf(s, ")\n");
 }
@@ -216,9 +210,9 @@ static const struct file_operations nflog_file_ops = {
 
 #ifdef CONFIG_SYSCTL
 static struct ctl_path nf_log_sysctl_path[] = {
-       { .procname = "net", .ctl_name = CTL_NET, },
-       { .procname = "netfilter", .ctl_name = NET_NETFILTER, },
-       { .procname = "nf_log", .ctl_name = CTL_UNNUMBERED, },
+       { .procname = "net", },
+       { .procname = "netfilter", },
+       { .procname = "nf_log", },
        { }
 };
 
@@ -226,7 +220,7 @@ static char nf_log_sysctl_fnames[NFPROTO_NUMPROTO-NFPROTO_UNSPEC][3];
 static struct ctl_table nf_log_sysctl_table[NFPROTO_NUMPROTO+1];
 static struct ctl_table_header *nf_log_dir_header;
 
-static int nf_log_proc_dostring(ctl_table *table, int write, struct file *filp,
+static int nf_log_proc_dostring(ctl_table *table, int write,
                         void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        const struct nf_logger *logger;
@@ -260,7 +254,7 @@ static int nf_log_proc_dostring(ctl_table *table, int write, struct file *filp,
                        table->data = "NONE";
                else
                        table->data = logger->name;
-               r = proc_dostring(table, write, filp, buffer, lenp, ppos);
+               r = proc_dostring(table, write, buffer, lenp, ppos);
                mutex_unlock(&nf_log_mutex);
        }
 
@@ -273,7 +267,6 @@ static __init int netfilter_log_sysctl_init(void)
 
        for (i = NFPROTO_UNSPEC; i < NFPROTO_NUMPROTO; i++) {
                snprintf(nf_log_sysctl_fnames[i-NFPROTO_UNSPEC], 3, "%d", i);
-               nf_log_sysctl_table[i].ctl_name = CTL_UNNUMBERED;
                nf_log_sysctl_table[i].procname =
                        nf_log_sysctl_fnames[i-NFPROTO_UNSPEC];
                nf_log_sysctl_table[i].data = NULL;