This patch 1) uses spin_lock instead of irq version. 2) removes the goto statement in case a socket is already assigned with simple if-else statement.
Signed-off-by: Pranay Kr. Srivastava <[email protected]> --- drivers/block/nbd.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 0339d40..da2b0a4 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -657,17 +657,14 @@ static int nbd_set_socket(struct nbd_device *nbd, struct socket *sock) { int ret = 0; - spin_lock_irq(&nbd->sock_lock); + spin_lock(&nbd->sock_lock); - if (nbd->sock) { + if (nbd->sock) ret = -EBUSY; - goto out; - } - - nbd->sock = sock; + else + nbd->sock = sock; -out: - spin_unlock_irq(&nbd->sock_lock); + spin_unlock(&nbd->sock_lock); return ret; } -- 2.6.2 ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e _______________________________________________ Nbd-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nbd-general
