]> git.baikalelectronics.ru Git - kernel.git/commit
tuntap: allow polling/writing/reading when detached
authorJason Wang <jasowang@redhat.com>
Mon, 28 Jan 2013 01:05:19 +0000 (01:05 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 29 Jan 2013 20:43:04 +0000 (15:43 -0500)
commitb871d86b55e2e7b0d0fb03c5ffe97cff078577fa
treebb31d4d5e54a54ad587dc6301e0c8e48745b0986
parente384fc9b3a7c72b156e4f1a2c97a460ba5783b6f
tuntap: allow polling/writing/reading when detached

We forbid polling, writing and reading when the file were detached, this may
complex the user in several cases:

- when guest pass some buffers to vhost/qemu and then disable some queues,
  host/qemu needs to do its own cleanup on those buffers which is complex
  sometimes. We can do this simply by allowing a user can still write to an
  disabled queue. Write to an disabled queue will cause the packet pass to the
  kernel and read will get nothing.
- align the polling behavior with macvtap which never fails when the queue is
  created. This can simplify the polling errors handling of its user (e.g vhost)

We can simply achieve this by don't assign NULL to tfile->tun when detached.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c