/* * Procfs support for lockd * * Copyright (c) 2014 Jeff Layton */ #include #include #include #include #include #include "netns.h" #include "procfs.h" /* * We only allow strings that start with 'Y', 'y', or '1'. */ static ssize_t nlm_end_grace_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) { char *data; struct lockd_net *ln = net_generic(current->nsproxy->net_ns, lockd_net_id); if (size < 1) return -EINVAL; data = simple_transaction_get(file, buf, size); if (IS_ERR(data)) return PTR_ERR(data); switch(data[0]) { case 'Y': case 'y': case '1': locks_end_grace(&ln->lockd_manager); break; default: return -EINVAL; } return size; } static ssize_t nlm_end_grace_read(struct file *file, char __user *buf, size_t size, loff_t *pos) { struct lockd_net *ln = net_generic(current->nsproxy->net_ns, lockd_net_id); char resp[3]; resp[0] = list_empty(&ln->lockd_manager.list) ? 'Y' : 'N'; resp[1] = '\n'; resp[2] = '\0'; return simple_read_from_buffer(buf, size, pos, resp, sizeof(resp)); } static const struct file_operations lockd_end_grace_operations = { .write = nlm_end_grace_write, .read = nlm_end_grace_read, .llseek = default_llseek, .release = simple_transaction_release, }; int __init lockd_create_procfs(void) { struct proc_dir_entry *entry; entry = proc_mkdir("fs/lockd", NULL); if (!entry) return -ENOMEM; entry = proc_create("nlm_end_grace", S_IRUGO|S_IWUSR, entry, &lockd_end_grace_operations); if (!entry) { remove_proc_entry("fs/lockd", NULL); return -ENOMEM; } return 0; } void __exit lockd_remove_procfs(void) { remove_proc_entry("fs/lockd/nlm_end_grace", NULL); remove_proc_entry("fs/lockd", NULL); } 3b9b25'>treecommitdiff
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-01-31 09:37:34 +0100
committerThomas Gleixner <tglx@linutronix.de>2017-01-31 21:47:58 +0100
commit0becc0ae5b42828785b589f686725ff5bc3b9b25 (patch)
treebe6d0e1f37c38ed0a7dd5da2d4b1e93f0fb43101 /net/ipv4/ip_output.c
parent24c2503255d35c269b67162c397a1a1c1e02f6ce (diff)
x86/mce: Make timer handling more robust
Erik reported that on a preproduction hardware a CMCI storm triggers the BUG_ON in add_timer_on(). The reason is that the per CPU MCE timer is started by the CMCI logic before the MCE CPU hotplug callback starts the timer with add_timer_on(). So the timer is already queued which triggers the BUG. Using add_timer_on() is pretty pointless in this code because the timer is strictlty per CPU, initialized as pinned and all operations which arm the timer happen on the CPU to which the timer belongs. Simplify the whole machinery by using mod_timer() instead of add_timer_on() which avoids the problem because mod_timer() can handle already queued timers. Use __start_timer() everywhere so the earliest armed expiry time is preserved. Reported-by: Erik Veijola <erik.veijola@intel.com> Tested-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Borislav Petkov <bp@alien8.de> Cc: Tony Luck <tony.luck@intel.com> Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1701310936080.3457@nanos Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'net/ipv4/ip_output.c')