[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6599ad831001061701x72098dacn7a5d916418396e33@mail.gmail.com>
Date: Wed, 6 Jan 2010 17:01:21 -0800
From: Paul Menage <menage@...gle.com>
To: "Kirill A. Shutemov" <kirill@...temov.name>
Cc: containers@...ts.linux-foundation.org, linux-mm@...ck.org,
Li Zefan <lizf@...fujitsu.com>,
Andrew Morton <akpm@...ux-foundation.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Balbir Singh <balbir@...ux.vnet.ibm.com>,
Pavel Emelyanov <xemul@...nvz.org>,
Dan Malek <dan@...eddedalley.com>,
Vladislav Buzov <vbuzov@...eddedalley.com>,
Daisuke Nishimura <nishimura@....nes.nec.co.jp>,
Alexander Shishkin <virtuoso@...nd.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 1/4] cgroup: implement eventfd-based generic API for
notifications
On Wed, Dec 30, 2009 at 7:57 AM, Kirill A. Shutemov
<kirill@...temov.name> wrote:
> This patch introduces write-only file "cgroup.event_control" in every
> cgroup.
This looks like a nice generic API for doing event notifications - thanks!
Sorry I hadn't had a chance to review it before now, due to travelling
and day-job pressures.
> +}
> +
> +static int cgroup_event_wake(wait_queue_t *wait, unsigned mode,
> + int sync, void *key)
Maybe some comments here indicating how/when it gets called? (And more
comments for each function generally?)
> + if (flags & POLLHUP) {
> + spin_lock(&cgrp->event_list_lock);
> + list_del(&event->list);
> + spin_unlock(&cgrp->event_list_lock);
> + schedule_work(&event->remove);
Comment saying why we can't do the remove immediately in this context?
> +
> +fail:
> + if (!IS_ERR(cfile))
> + fput(cfile);
cfile is either valid or NULL - it never contains an error value.
> +
> + if (!IS_ERR(efile))
> + fput(efile);
While this is OK currently, it's a bit fragile. efile starts as NULL,
and IS_ERR(NULL) is false. So if we jump to fail: before trying to do
the eventfd_fget() then we'll try to fput(NULL), which will oops. This
works because we don't currently jump to fail: until after
eventfd_fget(), but someone could add an extra setup step between the
kzalloc() and the eventfd_fget() which could fail.
Paul
--
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