https://github.com/torvalds/linux
Revision 435e46f5d35dbe5ea745822db29f16e003fa07d7 authored by Linus Torvalds on 17 November 2014, 00:18:26 UTC, committed by Linus Torvalds on 17 November 2014, 00:18:26 UTC
Pull sparc fixes from David Miller: 1) Fix NULL oops in Schizo PCI controller error handler. 2) Fix race between xchg and other operations on 32-bit sparc, from Andreas Larsson. 3) swab*() helpers need a dummy memory input operand to show data flow on 64-bit sparc. 4) Fix RCU warnings due to missing irq_{enter,exit}() around generic_smp_call_function*() calls. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc: sparc64: Fix constraints on swab helpers. sparc32: Implement xchg and atomic_xchg using ATOMIC_HASH locks sparc64: Do irq_{enter,exit}() around generic_smp_call_function*(). sparc64: Fix crashes in schizo_pcierr_intr_other().
Tip revision: 435e46f5d35dbe5ea745822db29f16e003fa07d7 authored by Linus Torvalds on 17 November 2014, 00:18:26 UTC
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc
Tip revision: 435e46f
fs_pin.c
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/fs_pin.h>
#include "internal.h"
#include "mount.h"
static void pin_free_rcu(struct rcu_head *head)
{
kfree(container_of(head, struct fs_pin, rcu));
}
static DEFINE_SPINLOCK(pin_lock);
void pin_put(struct fs_pin *p)
{
if (atomic_long_dec_and_test(&p->count))
call_rcu(&p->rcu, pin_free_rcu);
}
void pin_remove(struct fs_pin *pin)
{
spin_lock(&pin_lock);
hlist_del(&pin->m_list);
hlist_del(&pin->s_list);
spin_unlock(&pin_lock);
}
void pin_insert(struct fs_pin *pin, struct vfsmount *m)
{
spin_lock(&pin_lock);
hlist_add_head(&pin->s_list, &m->mnt_sb->s_pins);
hlist_add_head(&pin->m_list, &real_mount(m)->mnt_pins);
spin_unlock(&pin_lock);
}
void mnt_pin_kill(struct mount *m)
{
while (1) {
struct hlist_node *p;
struct fs_pin *pin;
rcu_read_lock();
p = ACCESS_ONCE(m->mnt_pins.first);
if (!p) {
rcu_read_unlock();
break;
}
pin = hlist_entry(p, struct fs_pin, m_list);
if (!atomic_long_inc_not_zero(&pin->count)) {
rcu_read_unlock();
cpu_relax();
continue;
}
rcu_read_unlock();
pin->kill(pin);
}
}
void sb_pin_kill(struct super_block *sb)
{
while (1) {
struct hlist_node *p;
struct fs_pin *pin;
rcu_read_lock();
p = ACCESS_ONCE(sb->s_pins.first);
if (!p) {
rcu_read_unlock();
break;
}
pin = hlist_entry(p, struct fs_pin, s_list);
if (!atomic_long_inc_not_zero(&pin->count)) {
rcu_read_unlock();
cpu_relax();
continue;
}
rcu_read_unlock();
pin->kill(pin);
}
}
Computing file changes ...