[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <412e6f7f1002282305i1d201d76h4085220f71fc76d0@mail.gmail.com>
Date: Mon, 1 Mar 2010 15:05:50 +0800
From: Changli Gao <xiaosuo@...il.com>
To: Kenan Kalajdzic <kenan@...x.ba>
Cc: netdev@...r.kernel.org
Subject: Re: [RFC][PATCH] af_unix: Add peer inode to /proc/net/unix
On Mon, Mar 1, 2010 at 12:52 PM, Kenan Kalajdzic <kenan@...x.ba> wrote:
> net/unix/af_unix.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index f255119..e778428 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -2157,7 +2157,7 @@ static int unix_seq_show(struct seq_file *seq, void *v)
> seq_puts(seq, "Num RefCount Protocol Flags Type St "
> "Inode Path\n");
> else {
> - struct sock *s = v;
> + struct sock *s = v, *peer;
> struct unix_sock *u = unix_sk(s);
> unix_state_lock(s);
>
> @@ -2186,6 +2186,13 @@ static int unix_seq_show(struct seq_file *seq, void *v)
> }
> for ( ; i < len; i++)
> seq_putc(seq, u->addr->name->sun_path[i]);
> + } else {
> + peer = unix_peer(s);
> + if (peer) {
> + unix_state_lock(peer);
> + seq_printf(seq, " peer=%lu", sock_i_ino(peer));
> + unix_state_unlock(peer);
> + }
> }
> unix_state_unlock(s);
> seq_putc(seq, '\n');
If there are two read requests, the system maybe locked up. please use
unix_state_double_lock()/unix_state_double_unlock(), instead. And the
file isn't consistent with the old one. You'd better use a column
title "Peer" instead of "peer=".
--
Regards,
Changli Gao(xiaosuo@...il.com)
Powered by blists - more mailing lists