Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1393600 > unrolled thread

[PATCH v2 0/2] nbd: fix might_sleep warning and checkpatch fixes.

Started by"Pranay Kr. Srivastava" <pranjas@gmail.com>
First post2016-05-03 18:40 +0200
Last post2016-05-03 20:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/2] nbd: fix might_sleep warning and checkpatch fixes. "Pranay Kr. Srivastava" <pranjas@gmail.com> - 2016-05-03 18:40 +0200
    [PATCH v2 2/2] nbd: Fix checkpatch errors. "Pranay Kr. Srivastava" <pranjas@gmail.com> - 2016-05-03 18:40 +0200
      Re: [PATCH v2 2/2] nbd: Fix checkpatch errors. Greg KH <gregkh@linuxfoundation.org> - 2016-05-03 20:20 +0200

#1393600 — [PATCH v2 0/2] nbd: fix might_sleep warning and checkpatch fixes.

From"Pranay Kr. Srivastava" <pranjas@gmail.com>
Date2016-05-03 18:40 +0200
Subject[PATCH v2 0/2] nbd: fix might_sleep warning and checkpatch fixes.
Message-ID<ruLwC-2Zw-3@gated-at.bofh.it>
This patch series fixes

01) might_sleep warning generated on a xmit_timeout as the socket
    is shutdown while holding the spin_lock. Instead now the socket
    is shutdown in the sender kernel thread.

02) checkpatch errors.

Pranay Kr. Srivastava (2):
  nbd: Fix might_sleep warning on xmit timeout
  nbd: Fix checkpatch errors.

 drivers/block/nbd.c | 94 +++++++++++++++++++++++++++++++----------------------
 1 file changed, 55 insertions(+), 39 deletions(-)

-- 
2.6.2

[toc] | [next] | [standalone]


#1393601 — [PATCH v2 2/2] nbd: Fix checkpatch errors.

From"Pranay Kr. Srivastava" <pranjas@gmail.com>
Date2016-05-03 18:40 +0200
Subject[PATCH v2 2/2] nbd: Fix checkpatch errors.
Message-ID<ruLwC-2Zw-15@gated-at.bofh.it>
In reply to#1393600
Signed-off-by: Pranay Kr. Srivastava <pranjas@gmail.com>
---
 drivers/block/nbd.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index c79bcd7..9ab3a27 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -3,7 +3,7 @@
  *
  * Note that you can not swap over this thing, yet. Seems to work but
  * deadlocks sometimes - you can not swap over TCP in general.
- * 
+ *
  * Copyright 1997-2000, 2008 Pavel Machek <pavel@ucw.cz>
  * Parts copyright 2001 Steven Whitehouse <steve@chygwyn.com>
  *
@@ -35,14 +35,14 @@
 #include <linux/types.h>
 #include <linux/debugfs.h>
 
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include <asm/types.h>
 
 #include <linux/nbd.h>
 
 struct nbd_device {
 	u32 flags;
-	struct socket * sock;	/* If == NULL, device is not ready, yet	*/
+	struct socket *sock;	/* If == NULL, device is not ready, yet	*/
 	int magic;
 
 	spinlock_t queue_lock;
@@ -257,6 +257,7 @@ static inline int sock_send_bvec(struct nbd_device *nbd, struct bio_vec *bvec,
 {
 	int result;
 	void *kaddr = kmap(bvec->bv_page);
+
 	result = sock_xmit(nbd, 1, kaddr + bvec->bv_offset,
 			   bvec->bv_len, flags);
 	kunmap(bvec->bv_page);
@@ -354,6 +355,7 @@ static inline int sock_recv_bvec(struct nbd_device *nbd, struct bio_vec *bvec)
 {
 	int result;
 	void *kaddr = kmap(bvec->bv_page);
+
 	result = sock_xmit(nbd, 0, kaddr + bvec->bv_offset, bvec->bv_len,
 			MSG_WAITALL);
 	kunmap(bvec->bv_page);
@@ -585,8 +587,7 @@ static int nbd_thread_send(void *data)
 				nbd_send_req(nbd, &sreq);
 				mutex_unlock(&nbd->tx_lock);
 				dev_err(disk_to_dev(nbd->disk),
-					"Device Timeout occured.Shutting down"
-					" socket.");
+				"Device Timeout occured.Shutting down socket.");
 			}
 			mutex_unlock(&nbd->sock_lock);
 			sock_shutdown(nbd);
@@ -616,8 +617,8 @@ static int nbd_thread_send(void *data)
 }
 
 /*
- * We always wait for result of write, for now. It would be nice to make it optional
- * in future
+ * We always wait for result of write, for now. It would be nice to make it
+ * optional in future
  * if ((rq_data_dir(req) == WRITE) && (nbd->flags & NBD_WRITE_NOCHK))
  *   { printk( "Warning: Ignoring result!\n"); nbd_end_request( req ); }
  */
@@ -626,7 +627,7 @@ static void nbd_request_handler(struct request_queue *q)
 		__releases(q->queue_lock) __acquires(q->queue_lock)
 {
 	struct request *req;
-	
+
 	while ((req = blk_fetch_request(q)) != NULL) {
 		struct nbd_device *nbd;
 
@@ -744,7 +745,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
 		nbd_send_req(nbd, &sreq);
 		return 0;
 	}
- 
+
 	case NBD_CLEAR_SOCK:
 		sock_shutdown(nbd);
 		nbd_clear_que(nbd);
@@ -869,8 +870,7 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode,
 	return error;
 }
 
-static const struct block_device_operations nbd_fops =
-{
+static const struct block_device_operations nbd_fops = {
 	.owner =	THIS_MODULE,
 	.ioctl =	nbd_ioctl,
 	.compat_ioctl =	nbd_ioctl,
@@ -1005,7 +1005,7 @@ static void nbd_dbg_close(void)
 #endif
 
 /*
- * And here should be modules and kernel interface 
+ * And here should be modules and kernel interface
  *  (Just smiley confuses emacs :-)
  */
 
@@ -1018,7 +1018,7 @@ static int __init nbd_init(void)
 	BUILD_BUG_ON(sizeof(struct nbd_request) != 28);
 
 	if (max_part < 0) {
-		printk(KERN_ERR "nbd: max_part must be >= 0\n");
+		pr_err("nbd: max_part must be >= 0\n");
 		return -EINVAL;
 	}
 
@@ -1049,6 +1049,7 @@ static int __init nbd_init(void)
 
 	for (i = 0; i < nbds_max; i++) {
 		struct gendisk *disk = alloc_disk(1 << part_shift);
+
 		if (!disk)
 			goto out;
 		nbd_dev[i].disk = disk;
@@ -1079,12 +1080,13 @@ static int __init nbd_init(void)
 		goto out;
 	}
 
-	printk(KERN_INFO "nbd: registered device at major %d\n", NBD_MAJOR);
+	pr_info("nbd: registered device at major %d\n", NBD_MAJOR);
 
 	nbd_dbg_init();
 
 	for (i = 0; i < nbds_max; i++) {
 		struct gendisk *disk = nbd_dev[i].disk;
+
 		nbd_dev[i].magic = NBD_MAGIC;
 		INIT_LIST_HEAD(&nbd_dev[i].waiting_queue);
 		spin_lock_init(&nbd_dev[i].queue_lock);
@@ -1123,6 +1125,7 @@ static void __exit nbd_cleanup(void)
 
 	for (i = 0; i < nbds_max; i++) {
 		struct gendisk *disk = nbd_dev[i].disk;
+
 		nbd_dev[i].magic = 0;
 		if (disk) {
 			del_gendisk(disk);
@@ -1132,7 +1135,7 @@ static void __exit nbd_cleanup(void)
 	}
 	unregister_blkdev(NBD_MAJOR, "nbd");
 	kfree(nbd_dev);
-	printk(KERN_INFO "nbd: unregistered device at major %d\n", NBD_MAJOR);
+	pr_info("nbd: unregistered device at major %d\n", NBD_MAJOR);
 }
 
 module_init(nbd_init);
-- 
2.6.2

[toc] | [prev] | [next] | [standalone]


#1393711 — Re: [PATCH v2 2/2] nbd: Fix checkpatch errors.

FromGreg KH <gregkh@linuxfoundation.org>
Date2016-05-03 20:20 +0200
SubjectRe: [PATCH v2 2/2] nbd: Fix checkpatch errors.
Message-ID<ruN5n-4B9-3@gated-at.bofh.it>
In reply to#1393601
On Tue, May 03, 2016 at 07:38:27PM +0300, Pranay Kr. Srivastava wrote:
> Signed-off-by: Pranay Kr. Srivastava <pranjas@gmail.com>

You have to have a changelog text.

And try doing one-patch-per-checkpatch-warning-type.

That's all I will accept for drivers/staging/ files, but maybe the nbd.c
maintainer has different rules.

good luck!

greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web