Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1278536

->poll() instances shouldn't be indefinitely blocking

From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject ->poll() instances shouldn't be indefinitely blocking
Date 2015-11-27 06:10 +0100
Message-ID <qzjse-6P9-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

->poll() instances shouldn't be indefinitely blocking Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-27 06:10 +0100
  Re: ->poll() instances shouldn't be indefinitely blocking Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2015-11-27 16:20 +0100
    Re: ->poll() instances shouldn't be indefinitely blocking Linus Torvalds <torvalds@linux-foundation.org> - 2015-11-27 18:50 +0100
      Re: ->poll() instances shouldn't be indefinitely blocking Al Viro <viro@ZenIV.linux.org.uk> - 2015-11-30 04:10 +0100

csiph-web