Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 119627
b: refs/heads/master
c: 5f23b73
h: refs/heads/master
i:
  119625: 1eb13f9
  119623: f7b325f
v: v3
  • Loading branch information
dann frazier authored and David S. Miller committed Nov 26, 2008
1 parent 0da40ab commit 021dc9b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 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: efbbced361f3ff4ff9e85310ccff894185c4d904
refs/heads/master: 5f23b734963ec7eaa3ebcd9050da0c9b7d143dd3
1 change: 1 addition & 0 deletions trunk/include/net/af_unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
extern void unix_inflight(struct file *fp);
extern void unix_notinflight(struct file *fp);
extern void unix_gc(void);
extern void wait_for_unix_gc(void);

#define UNIX_HASH_SIZE 256

Expand Down
2 changes: 2 additions & 0 deletions trunk/net/unix/af_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,

if (NULL == siocb->scm)
siocb->scm = &tmp_scm;
wait_for_unix_gc();
err = scm_send(sock, msg, siocb->scm);
if (err < 0)
return err;
Expand Down Expand Up @@ -1493,6 +1494,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,

if (NULL == siocb->scm)
siocb->scm = &tmp_scm;
wait_for_unix_gc();
err = scm_send(sock, msg, siocb->scm);
if (err < 0)
return err;
Expand Down
13 changes: 10 additions & 3 deletions trunk/net/unix/garbage.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
#include <linux/file.h>
#include <linux/proc_fs.h>
#include <linux/mutex.h>
#include <linux/wait.h>

#include <net/sock.h>
#include <net/af_unix.h>
Expand All @@ -91,6 +92,7 @@
static LIST_HEAD(gc_inflight_list);
static LIST_HEAD(gc_candidates);
static DEFINE_SPINLOCK(unix_gc_lock);
static DECLARE_WAIT_QUEUE_HEAD(unix_gc_wait);

unsigned int unix_tot_inflight;

Expand Down Expand Up @@ -266,12 +268,16 @@ static void inc_inflight_move_tail(struct unix_sock *u)
list_move_tail(&u->link, &gc_candidates);
}

/* The external entry point: unix_gc() */
static bool gc_in_progress = false;

void unix_gc(void)
void wait_for_unix_gc(void)
{
static bool gc_in_progress = false;
wait_event(unix_gc_wait, gc_in_progress == false);
}

/* The external entry point: unix_gc() */
void unix_gc(void)
{
struct unix_sock *u;
struct unix_sock *next;
struct sk_buff_head hitlist;
Expand Down Expand Up @@ -376,6 +382,7 @@ void unix_gc(void)
/* All candidates should have been detached by now. */
BUG_ON(!list_empty(&gc_candidates));
gc_in_progress = false;
wake_up(&unix_gc_wait);

out:
spin_unlock(&unix_gc_lock);
Expand Down

0 comments on commit 021dc9b

Please sign in to comment.