Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 200614
b: refs/heads/master
c: 57439f8
h: refs/heads/master
v: v3
  • Loading branch information
npiggin@suse.de authored and Linus Torvalds committed Jun 29, 2010
1 parent 0612415 commit 0c4763b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5904b3b81d25166e5e39b9727645bb47937618e3
refs/heads/master: 57439f878afafefad8836ebf5c49da2a0a746105
2 changes: 2 additions & 0 deletions trunk/fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ static void prune_dcache(int count)
up_read(&sb->s_umount);
}
spin_lock(&sb_lock);
/* lock was dropped, must reset next */
list_safe_reset_next(sb, n, s_list);
count -= pruned;
__put_super(sb);
/* more work left to do? */
Expand Down
6 changes: 6 additions & 0 deletions trunk/fs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ void sync_supers(void)
up_read(&sb->s_umount);

spin_lock(&sb_lock);
/* lock was dropped, must reset next */
list_safe_reset_next(sb, n, s_list);
__put_super(sb);
}
}
Expand Down Expand Up @@ -405,6 +407,8 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg)
up_read(&sb->s_umount);

spin_lock(&sb_lock);
/* lock was dropped, must reset next */
list_safe_reset_next(sb, n, s_list);
__put_super(sb);
}
spin_unlock(&sb_lock);
Expand Down Expand Up @@ -585,6 +589,8 @@ static void do_emergency_remount(struct work_struct *work)
}
up_write(&sb->s_umount);
spin_lock(&sb_lock);
/* lock was dropped, must reset next */
list_safe_reset_next(sb, n, s_list);
__put_super(sb);
}
spin_unlock(&sb_lock);
Expand Down
15 changes: 15 additions & 0 deletions trunk/include/linux/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,21 @@ static inline void list_splice_tail_init(struct list_head *list,
&pos->member != (head); \
pos = n, n = list_entry(n->member.prev, typeof(*n), member))

/**
* list_safe_reset_next - reset a stale list_for_each_entry_safe loop
* @pos: the loop cursor used in the list_for_each_entry_safe loop
* @n: temporary storage used in list_for_each_entry_safe
* @member: the name of the list_struct within the struct.
*
* list_safe_reset_next is not safe to use in general if the list may be
* modified concurrently (eg. the lock is dropped in the loop body). An
* exception to this is if the cursor element (pos) is pinned in the list,
* and list_safe_reset_next is called after re-taking the lock and before
* completing the current iteration of the loop body.
*/
#define list_safe_reset_next(pos, n, member) \
n = list_entry(pos->member.next, typeof(*pos), member)

/*
* Double linked lists with a single pointer list head.
* Mostly useful for hash tables where the two pointer list head is
Expand Down

0 comments on commit 0c4763b

Please sign in to comment.