X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=lib%2Fringbuffer%2Fring_buffer_vfs.c;h=fecef217c8bfdd9a51587f930a5dc7c2dcecac64;hb=254ec7bc4c72da11a4e3f2c90904b111a06a2c55;hp=6a9fb469ca4f73ccc4940b755a3607ec4bf3784d;hpb=f3bc08c50e1b302bceea699027d889fd6d9af525;p=lttng-modules.git diff --git a/lib/ringbuffer/ring_buffer_vfs.c b/lib/ringbuffer/ring_buffer_vfs.c index 6a9fb469..fecef217 100644 --- a/lib/ringbuffer/ring_buffer_vfs.c +++ b/lib/ringbuffer/ring_buffer_vfs.c @@ -86,19 +86,24 @@ unsigned int lib_ring_buffer_poll(struct file *filp, poll_table *wait) struct lib_ring_buffer *buf = filp->private_data; struct channel *chan = buf->backend.chan; const struct lib_ring_buffer_config *config = chan->backend.config; - int finalized; + int finalized, disabled; if (filp->f_mode & FMODE_READ) { - poll_wait_set_exclusive(wait); + init_poll_funcptr(wait, wrapper_pollwait_exclusive); poll_wait(filp, &buf->read_wait, wait); finalized = lib_ring_buffer_is_finalized(config, buf); + disabled = lib_ring_buffer_channel_is_disabled(chan); + /* * lib_ring_buffer_is_finalized() contains a smp_rmb() ordering * finalized load before offsets loads. */ WARN_ON(atomic_long_read(&buf->active_readers) != 1); retry: + if (disabled) + return POLLERR; + if (subbuf_trunc(lib_ring_buffer_get_offset(config, buf), chan) - subbuf_trunc(lib_ring_buffer_get_consumed(config, buf), chan) == 0) { @@ -159,6 +164,9 @@ long lib_ring_buffer_ioctl(struct file *filp, unsigned int cmd, unsigned long ar struct channel *chan = buf->backend.chan; const struct lib_ring_buffer_config *config = chan->backend.config; + if (lib_ring_buffer_channel_is_disabled(chan)) + return -EIO; + switch (cmd) { case RING_BUFFER_SNAPSHOT: return lib_ring_buffer_snapshot(buf, &buf->cons_snapshot, @@ -250,6 +258,9 @@ long lib_ring_buffer_compat_ioctl(struct file *filp, unsigned int cmd, struct channel *chan = buf->backend.chan; const struct lib_ring_buffer_config *config = chan->backend.config; + if (lib_ring_buffer_channel_is_disabled(chan)) + return -EIO; + switch (cmd) { case RING_BUFFER_SNAPSHOT: return lib_ring_buffer_snapshot(buf, &buf->cons_snapshot,