Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1338897 > unrolled thread
| Started by | Markus Pargmann <mpa@pengutronix.de> |
|---|---|
| First post | 2016-02-21 19:00 +0100 |
| Last post | 2016-02-21 19:00 +0100 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PULL] NBD for 4.6 Markus Pargmann <mpa@pengutronix.de> - 2016-02-21 19:00 +0100
[PATCH 3/7] nbd: Timeouts are not user requested disconnects Markus Pargmann <mpa@pengutronix.de> - 2016-02-21 19:00 +0100
| From | Markus Pargmann <mpa@pengutronix.de> |
|---|---|
| Date | 2016-02-21 19:00 +0100 |
| Subject | [PULL] NBD for 4.6 |
| Message-ID | <r4Gsy-16v-5@gated-at.bofh.it> |
Hi Jens,
This pull request contains 7 patches for 4.6.
Patch 1 fixes some unnecessarily complicated code I introduced some versions
ago for debugfs.
Patch 2 removes the criticised signal usage within NBD to kill the NBD threads
after a timeout. This code was used for the last years and is now replaced by
simply killing the tcp connection.
Patches 3-6 are some smaller cleanups.
Patch 7 uevents for the userspace. This way udev/systemd can react on connected
NBD devices.
Best Regards,
Markus
The following changes since commit 92e963f50fc74041b5e9e744c330dca48e04f08d:
Linux 4.5-rc1 (2016-01-24 13:06:47 -0800)
are available in the git repository at:
git://git.pengutronix.de/git/mpa/linux-nbd.git tags/nbd-for-4.6
for you to fetch changes up to 37091fdd831f28a6509008542174ed324dd645bc:
nbd: Create size change events for userspace (2016-02-15 10:35:47 +0100)
----------------------------------------------------------------
NBD for 4.6
----------------------------------------------------------------
Dan Streetman (1):
nbd: ratelimit error msgs after socket close
Markus Pargmann (6):
nbd: Fix debugfs error handling
nbd: Remove signal usage
nbd: Timeouts are not user requested disconnects
nbd: Cleanup reset of nbd and bdev after a disconnect
nbd: Move flag parsing to a function
nbd: Create size change events for userspace
drivers/block/nbd.c | 335 ++++++++++++++++++++++++++--------------------------
1 file changed, 170 insertions(+), 165 deletions(-)
--
2.7.0
[toc] | [next] | [standalone]
| From | Markus Pargmann <mpa@pengutronix.de> |
|---|---|
| Date | 2016-02-21 19:00 +0100 |
| Subject | [PATCH 3/7] nbd: Timeouts are not user requested disconnects |
| Message-ID | <r4Gsz-16v-33@gated-at.bofh.it> |
| In reply to | #1338897 |
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 <mpa@pengutronix.de>
---
drivers/block/nbd.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 438f4dc549db..2e14e51b5ea3 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -57,6 +57,7 @@ struct nbd_device {
int blksize;
loff_t bytesize;
int xmit_timeout;
+ bool timedout;
bool disconnect; /* a disconnect has been requested by user */
struct timer_list timeout_timer;
@@ -154,10 +155,9 @@ static void nbd_xmit_timeout(unsigned long arg)
if (list_empty(&nbd->queue_head))
return;
- nbd->disconnect = true;
-
spin_lock_irqsave(&nbd->sock_lock, flags);
+ nbd->timedout = true;
if (nbd->sock)
kernel_sock_shutdown(nbd->sock, SHUT_RDWR);
@@ -754,7 +754,10 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
if (max_part > 0)
blkdev_reread_part(bdev);
if (nbd->disconnect) /* user requested, ignore socket errors */
- return 0;
+ error = 0;
+ if (nbd->timedout)
+ error = -ETIMEDOUT;
+
return error;
}
--
2.7.0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web