public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* ->poll() instances shouldn't be indefinitely blocking
@ 2015-11-27  5:00 Al Viro
  2015-11-27 15:18 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2015-11-27  5:00 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: Linus Torvalds, linux-kernel, linux-fsdevel

Take a look at this:
static unsigned int gsc_m2m_poll(struct file *file,
                                        struct poll_table_struct *wait)
{
        struct gsc_ctx *ctx = fh_to_ctx(file->private_data);
        struct gsc_dev *gsc = ctx->gsc_dev;
        int ret;

        if (mutex_lock_interruptible(&gsc->lock))
                return -ERESTARTSYS;

        ret = v4l2_m2m_poll(file, ctx->m2m_ctx, wait);
        mutex_unlock(&gsc->lock);

        return ret;
}

a) ->poll() should not return -E...; callers expect just a bitmap of
POLL... values.

b) sure, it's nice that if this thing hangs, we'll be able to kill it.
However, if one's ->poll() can hang indefinitely, it means bad things
for poll(2), select(2), etc. semantics.  What the hell had been intended
there?

c) a bunch of v4l2_m2m_poll() callers are also taking some kind of
mutex; AFAICS, all of those appear bogus (the rest of them do not
play wiht ERESTARTSYS, just plain mutex_lock() for those).

What's going on there?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-11-30  3:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-27  5:00 ->poll() instances shouldn't be indefinitely blocking Al Viro
2015-11-27 15:18 ` Mauro Carvalho Chehab
2015-11-27 17:49   ` Linus Torvalds
2015-11-30  3:04     ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox