Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 167580
b: refs/heads/master
c: 83db93f
h: refs/heads/master
v: v3
  • Loading branch information
Neil Brown authored and Greg Kroah-Hartman committed Oct 14, 2009
1 parent 7bc37cd commit e4a78a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a6a8357788d6a37f8ad0f7eb46b0a386b613abb9
refs/heads/master: 83db93f4de2d9ae441a491d1dc61c2204f0195de
14 changes: 8 additions & 6 deletions trunk/fs/sysfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd,
struct sysfs_open_dirent *od, *new_od = NULL;

retry:
spin_lock(&sysfs_open_dirent_lock);
spin_lock_irq(&sysfs_open_dirent_lock);

if (!sd->s_attr.open && new_od) {
sd->s_attr.open = new_od;
Expand All @@ -281,7 +281,7 @@ static int sysfs_get_open_dirent(struct sysfs_dirent *sd,
list_add_tail(&buffer->list, &od->buffers);
}

spin_unlock(&sysfs_open_dirent_lock);
spin_unlock_irq(&sysfs_open_dirent_lock);

if (od) {
kfree(new_od);
Expand Down Expand Up @@ -315,16 +315,17 @@ static void sysfs_put_open_dirent(struct sysfs_dirent *sd,
struct sysfs_buffer *buffer)
{
struct sysfs_open_dirent *od = sd->s_attr.open;
unsigned long flags;

spin_lock(&sysfs_open_dirent_lock);
spin_lock_irqsave(&sysfs_open_dirent_lock, flags);

list_del(&buffer->list);
if (atomic_dec_and_test(&od->refcnt))
sd->s_attr.open = NULL;
else
od = NULL;

spin_unlock(&sysfs_open_dirent_lock);
spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);

kfree(od);
}
Expand Down Expand Up @@ -456,16 +457,17 @@ static unsigned int sysfs_poll(struct file *filp, poll_table *wait)
void sysfs_notify_dirent(struct sysfs_dirent *sd)
{
struct sysfs_open_dirent *od;
unsigned long flags;

spin_lock(&sysfs_open_dirent_lock);
spin_lock_irqsave(&sysfs_open_dirent_lock, flags);

od = sd->s_attr.open;
if (od) {
atomic_inc(&od->event);
wake_up_interruptible(&od->poll);
}

spin_unlock(&sysfs_open_dirent_lock);
spin_unlock_irqrestore(&sysfs_open_dirent_lock, flags);
}
EXPORT_SYMBOL_GPL(sysfs_notify_dirent);

Expand Down

0 comments on commit e4a78a7

Please sign in to comment.