<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/block/nbd.c, branch v4.6</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>nbd: use correct div_s64 helper</title>
<updated>2016-03-05T00:20:12+00:00</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2016-03-04T23:49:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=5e454c67fc594150e6c0da32b388a43d40200759'/>
<id>5e454c67fc594150e6c0da32b388a43d40200759</id>
<content type='text'>
The do_div() macro now checks its arguments for the correct type,
and refuses anything other than u64, so we get a warning about
nbd_ioctl passing in an loff_t:

drivers/block/nbd.c: In function '__nbd_ioctl':
drivers/block/nbd.c:757:77: error: comparison of distinct pointer types lacks a cast [-Werror]

This changes the nbd code to use div_s64() instead, which takes
a signed argument.

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Fixes: 37091fdd831f ("nbd: Create size change events for userspace")
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The do_div() macro now checks its arguments for the correct type,
and refuses anything other than u64, so we get a warning about
nbd_ioctl passing in an loff_t:

drivers/block/nbd.c: In function '__nbd_ioctl':
drivers/block/nbd.c:757:77: error: comparison of distinct pointer types lacks a cast [-Werror]

This changes the nbd code to use div_s64() instead, which takes
a signed argument.

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Fixes: 37091fdd831f ("nbd: Create size change events for userspace")
Signed-off-by: Jens Axboe &lt;axboe@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nbd: Create size change events for userspace</title>
<updated>2016-02-15T09:35:47+00:00</updated>
<author>
<name>Markus Pargmann</name>
<email>mpa@pengutronix.de</email>
</author>
<published>2015-07-27T05:36:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=37091fdd831f28a6509008542174ed324dd645bc'/>
<id>37091fdd831f28a6509008542174ed324dd645bc</id>
<content type='text'>
The userspace needs to know when nbd devices are ready for use.
Currently no events are created for the userspace which doesn't work for
systemd.

See the discussion here: https://github.com/systemd/systemd/pull/358

This patch uses a central point to setup the nbd-internal sizes. A ioctl
to set a size does not lead to a visible size change. The size of the
block device will be kept at 0 until nbd is connected. As soon as it
connects, the size will be changed to the real value and a uevent is
created. When disconnecting, the blockdevice is set to 0 size and
another uevent is generated.

Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The userspace needs to know when nbd devices are ready for use.
Currently no events are created for the userspace which doesn't work for
systemd.

See the discussion here: https://github.com/systemd/systemd/pull/358

This patch uses a central point to setup the nbd-internal sizes. A ioctl
to set a size does not lead to a visible size change. The size of the
block device will be kept at 0 until nbd is connected. As soon as it
connects, the size will be changed to the real value and a uevent is
created. When disconnecting, the blockdevice is set to 0 size and
another uevent is generated.

Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nbd: ratelimit error msgs after socket close</title>
<updated>2016-02-05T07:55:15+00:00</updated>
<author>
<name>Dan Streetman</name>
<email>dan.streetman@canonical.com</email>
</author>
<published>2016-01-14T18:42:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=da6ccaaa79caca4f38b540b651238f87215217a2'/>
<id>da6ccaaa79caca4f38b540b651238f87215217a2</id>
<content type='text'>
Make the "Attempted send on closed socket" error messages generated in
nbd_request_handler() ratelimited.

When the nbd socket is shutdown, the nbd_request_handler() function emits
an error message for every request remaining in its queue.  If the queue
is large, this will spam a large amount of messages to the log.  There's
no need for a separate error message for each request, so this patch
ratelimits it.

In the specific case this was found, the system was virtual and the error
messages were logged to the serial port, which overwhelmed it.

Fixes: 4d48a542b427 ("nbd: fix I/O hang on disconnected nbds")
Signed-off-by: Dan Streetman &lt;dan.streetman@canonical.com&gt;
Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make the "Attempted send on closed socket" error messages generated in
nbd_request_handler() ratelimited.

When the nbd socket is shutdown, the nbd_request_handler() function emits
an error message for every request remaining in its queue.  If the queue
is large, this will spam a large amount of messages to the log.  There's
no need for a separate error message for each request, so this patch
ratelimits it.

In the specific case this was found, the system was virtual and the error
messages were logged to the serial port, which overwhelmed it.

Fixes: 4d48a542b427 ("nbd: fix I/O hang on disconnected nbds")
Signed-off-by: Dan Streetman &lt;dan.streetman@canonical.com&gt;
Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nbd: Move flag parsing to a function</title>
<updated>2016-02-05T07:52:33+00:00</updated>
<author>
<name>Markus Pargmann</name>
<email>mpa@pengutronix.de</email>
</author>
<published>2015-10-29T11:06:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d02cf53107792df373558851d6162dc4e4ceb95a'/>
<id>d02cf53107792df373558851d6162dc4e4ceb95a</id>
<content type='text'>
nbd changes properties of the blockdevice depending on flags that were
received. This patch moves this flag parsing into a separate function
nbd_parse_flags().

Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
nbd changes properties of the blockdevice depending on flags that were
received. This patch moves this flag parsing into a separate function
nbd_parse_flags().

Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nbd: Cleanup reset of nbd and bdev after a disconnect</title>
<updated>2016-02-05T07:52:32+00:00</updated>
<author>
<name>Markus Pargmann</name>
<email>mpa@pengutronix.de</email>
</author>
<published>2015-10-29T11:04:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=0e4f0f6f63d3416a9e529d99febfe98545427b81'/>
<id>0e4f0f6f63d3416a9e529d99febfe98545427b81</id>
<content type='text'>
Group all variables that are reset after a disconnect into reset
functions. This patch adds two of these functions, nbd_reset() and
nbd_bdev_reset().

Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Group all variables that are reset after a disconnect into reset
functions. This patch adds two of these functions, nbd_reset() and
nbd_bdev_reset().

Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nbd: Timeouts are not user requested disconnects</title>
<updated>2016-02-05T07:52:31+00:00</updated>
<author>
<name>Markus Pargmann</name>
<email>mpa@pengutronix.de</email>
</author>
<published>2015-10-29T11:01:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=1f7b5cf1be4351e60cf8ae7aab976503dd73c5f8'/>
<id>1f7b5cf1be4351e60cf8ae7aab976503dd73c5f8</id>
<content type='text'>
It may be useful to know in the client that a connection timed out. The
current code returns success for a timeout.

This patch reports the error code -ETIMEDOUT for a timeout.

Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It may be useful to know in the client that a connection timed out. The
current code returns success for a timeout.

This patch reports the error code -ETIMEDOUT for a timeout.

Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nbd: Remove signal usage</title>
<updated>2016-02-05T07:52:25+00:00</updated>
<author>
<name>Markus Pargmann</name>
<email>mpa@pengutronix.de</email>
</author>
<published>2015-10-29T10:51:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=23272a6754b81ff6503e09c743bb4ceeeab39997'/>
<id>23272a6754b81ff6503e09c743bb4ceeeab39997</id>
<content type='text'>
As discussed on the mailing list, the usage of signals for timeout
handling has a lot of potential issues. The nbd driver used for some
time signals for timeouts. These signals where able to get the threads
out of the blocking socket operations.

This patch removes all signal usage and uses a socket shutdown instead.
The socket descriptor itself is cleared later when the whole nbd device
is closed.

The tasks_lock is removed as we do not depend on this anymore. Instead
a new lock for the socket is introduced so we can safely work with the
socket in the timeout handler outside of the two main threads.

Cc: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As discussed on the mailing list, the usage of signals for timeout
handling has a lot of potential issues. The nbd driver used for some
time signals for timeouts. These signals where able to get the threads
out of the blocking socket operations.

This patch removes all signal usage and uses a socket shutdown instead.
The socket descriptor itself is cleared later when the whole nbd device
is closed.

The tasks_lock is removed as we do not depend on this anymore. Instead
a new lock for the socket is introduced so we can safely work with the
socket in the timeout handler outside of the two main threads.

Cc: Oleg Nesterov &lt;oleg@redhat.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nbd: Fix debugfs error handling</title>
<updated>2016-02-03T10:02:56+00:00</updated>
<author>
<name>Markus Pargmann</name>
<email>mpa@pengutronix.de</email>
</author>
<published>2015-10-24T19:15:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=27ea43fe2a32f63bb6f442dafc2133232b8af4a6'/>
<id>27ea43fe2a32f63bb6f442dafc2133232b8af4a6</id>
<content type='text'>
Static checker complains about the implemented error handling. It is
indeed wrong. We don't care about the return values of created debugfs
files.

We only have to check the return values of created dirs for NULL
pointer. If we use a null pointer as parent directory for files, this
may lead to debugfs files in wrong places.

Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Static checker complains about the implemented error handling. It is
indeed wrong. We don't care about the return values of created debugfs
files.

We only have to check the return values of created dirs for NULL
pointer. If we use a null pointer as parent directory for files, this
may lead to debugfs files in wrong places.

Signed-off-by: Markus Pargmann &lt;mpa@pengutronix.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nbd: use -&gt;compat_ioctl()</title>
<updated>2016-01-09T02:20:32+00:00</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2016-01-07T15:04:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=263a3df18fa2c078ab3e8b14fece6cfa6053e86a'/>
<id>263a3df18fa2c078ab3e8b14fece6cfa6053e86a</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>signal: turn dequeue_signal_lock() into kernel_dequeue_signal()</title>
<updated>2015-11-07T01:50:42+00:00</updated>
<author>
<name>Oleg Nesterov</name>
<email>oleg@redhat.com</email>
</author>
<published>2015-11-07T00:32:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=be0e6f290f78b84a3b21b8c8c46819c4514fe632'/>
<id>be0e6f290f78b84a3b21b8c8c46819c4514fe632</id>
<content type='text'>
1. Rename dequeue_signal_lock() to kernel_dequeue_signal(). This
   matches another "for kthreads only" kernel_sigaction() helper.

2. Remove the "tsk" and "mask" arguments, they are always current
   and current-&gt;blocked. And it is simply wrong if tsk != current.

3. We could also remove the 3rd "siginfo_t *info" arg but it looks
   potentially useful. However we can simplify the callers if we
   change kernel_dequeue_signal() to accept info =&gt; NULL.

4. Remove _irqsave, it is never called from atomic context.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Reviewed-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: David Woodhouse &lt;dwmw2@infradead.org&gt;
Cc: Felipe Balbi &lt;balbi@ti.com&gt;
Cc: Markus Pargmann &lt;mpa@pengutronix.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
1. Rename dequeue_signal_lock() to kernel_dequeue_signal(). This
   matches another "for kthreads only" kernel_sigaction() helper.

2. Remove the "tsk" and "mask" arguments, they are always current
   and current-&gt;blocked. And it is simply wrong if tsk != current.

3. We could also remove the 3rd "siginfo_t *info" arg but it looks
   potentially useful. However we can simplify the callers if we
   change kernel_dequeue_signal() to accept info =&gt; NULL.

4. Remove _irqsave, it is never called from atomic context.

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Reviewed-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: David Woodhouse &lt;dwmw2@infradead.org&gt;
Cc: Felipe Balbi &lt;balbi@ti.com&gt;
Cc: Markus Pargmann &lt;mpa@pengutronix.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
