From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161362AbcFBPZx (ORCPT ); Thu, 2 Jun 2016 11:25:53 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:35274 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750948AbcFBPZv (ORCPT ); Thu, 2 Jun 2016 11:25:51 -0400 From: "Pranay Kr. Srivastava" To: mpa@pengutronix.de, nbd-general@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: "Pranay Kr. Srivastava" Subject: [PATCH v2 0/5] nbd: fixes for nbd Date: Thu, 2 Jun 2016 13:24:56 +0300 Message-Id: <1464863101-16805-1-git-send-email-pranjas@gmail.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <3898019.JRqDjBPssX@adelgunde> References: <3898019.JRqDjBPssX@adelgunde> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch series fixes the following 1) fix might_sleep warning on socket shutdown: Fix sock_shutdown to avoid calling kernel_sock_shutdown while holding spin_lock. 2) cleanup nbd_set_socket Cleanup nbd_set_socket to use spin_lock instead of irq version and remove the goto statement in favour of a simple if-else statement. 3) fix various coding standard warnings Make shutdown get called in a process context instead, using system_wq. 4) make nbd device wait for its users. When a timeout or error occurs then nbd driver simply kills the block device. Many filesystem(s) example ext2/ext3 don't expect their buffer heads to disappear like that. Fix this by making nbd device wait for its users. Introduced a new field to check if the device is currently in use or not. This helps to check if the kref_put should be done on device release or not. This field needs to be atomic as the release function may be called from NBD_DO_IT as well as from device's release function. 5) use device_attr macros for sysfs attribute use DEVICE_ATTR_RO for sysfs pid attribute. Changelog for v2: 1) fix might_sleep warning on socket shutdown use bool timedout instead of atomic 2) cleanup nbd_set_socket Added this new patch to this series. 3) fix various coding standard warnings No Change. 4) make nbd device wait for its users Earlier version used to do a final kref put when the kref->counter == 2. This required a check of the internal atomic counter of kref which was ugly. v2 of this patch make this more readable and doesn't do manual check of the internal counter used by kref. 5) use device_attr macros for sysfs attribute No Change. Pranay Kr. Srivastava (5): fix might_sleep warning on socket shutdown. cleanup nbd_set_socket fix various coding standard warnings make nbd device wait for its users. use device_attr macros for sysfs attribute drivers/block/nbd.c | 173 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 124 insertions(+), 49 deletions(-) -- 2.6.2