[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1NGSIQ-0004nz-Lo@pomaz-ex.szeredi.hu>
Date: Fri, 04 Dec 2009 08:09:42 +0100
From: Miklos Szeredi <miklos@...redi.hu>
To: Eric Paris <eparis@...hat.com>
CC: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, viro@...iv.linux.org.uk, jmorris@...ei.org,
npiggin@...e.de, eparis@...hat.com, zohar@...ibm.com, jack@...e.cz,
jmalicki@...acarta.com, dsmith@...hat.com, serue@...ibm.com,
hch@....de, john@...nmccutchan.com, rlove@...ve.org,
ebiederm@...ssion.com, heiko.carstens@...ibm.com,
penguin-kernel@...ove.SAKURA.ne.jp, mszeredi@...e.cz,
jens.axboe@...cle.com, akpm@...ux-foundation.org, matthew@....cx,
hugh.dickins@...cali.co.uk, kamezawa.hiroyu@...fujitsu.com,
nishimura@....nes.nec.co.jp, davem@...emloft.net, arnd@...db.de,
eric.dumazet@...il.com
Subject: Re: [RFC PATCH 4/6] networking: rework socket to fd mapping using
alloc-file
On Thu, 03 Dec 2009, Eric Paris wrote:
> @@ -391,32 +383,37 @@ static int sock_attach_fd(struct socket *sock, struct file *file, int flags)
> dentry->d_flags &= ~DCACHE_UNHASHED;
> d_instantiate(dentry, SOCK_INODE(sock));
>
> + file = alloc_file(sock_mnt, dentry, FMODE_READ | FMODE_WRITE,
> + &socket_file_ops);
> + if (unlikely(!file)) {
> + rc = -ENFILE;
> + goto out_err;
> + }
> +
> sock->file = file;
> - init_file(file, sock_mnt, dentry, FMODE_READ | FMODE_WRITE,
> - &socket_file_ops);
> SOCK_INODE(sock)->i_fop = &socket_file_ops;
> file->f_flags = O_RDWR | (flags & O_NONBLOCK);
> - file->f_pos = 0;
> file->private_data = sock;
>
> - return 0;
> + return fd;
> +out_err:
> + if (fd >= 0)
> + put_unused_fd(fd);
> + if (dentry)
> + dput(dentry);
Could you please use separate labels intead of conditionals here?
Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists