public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* Cluster Project branch, master, updated. cluster-2.99.04-31-g4f32341
@ 2008-06-20  4:19 fabbione
  0 siblings, 0 replies; only message in thread
From: fabbione @ 2008-06-20  4:19 UTC (permalink / raw)
  To: cluster-cvs, cluster-devel

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=4f32341cc111bd6e8dc888b483db2e7951b96c2a

The branch, master has been updated
       via  4f32341cc111bd6e8dc888b483db2e7951b96c2a (commit)
      from  0b922103eb3c7d5d99aa77fc30dc3ddfa22f8521 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4f32341cc111bd6e8dc888b483db2e7951b96c2a
Author: Benjamin Marzinski <bmarzins@redhat.com>
Date:   Thu Jun 19 15:44:27 2008 -0500

    [gnbd-kernel] bz 449812: disallow sending requests after a send has failed.
    
    This fix adds a "corrupt" flag to the gnbd device structure. This flag is
    cleared when a new socket connection is opened to the server. It is set
    whenever a send fails.  After this all future sends will fail, and the receiver
    process will stop accepting replies as soon as it notices the flag.

-----------------------------------------------------------------------

Summary of changes:
 gnbd-kernel/src/gnbd.c |   13 +++++++++++++
 gnbd-kernel/src/gnbd.h |    1 +
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/gnbd-kernel/src/gnbd.c b/gnbd-kernel/src/gnbd.c
index a52252d..5cc34fb 100644
--- a/gnbd-kernel/src/gnbd.c
+++ b/gnbd-kernel/src/gnbd.c
@@ -388,6 +388,12 @@ int __gnbd_send_req(struct gnbd_device *dev, struct socket *sock,
 
 	down(&dev->tx_lock);
 
+	if (dev->corrupt) {
+		printk(KERN_ERR "%s: Attempted to send on a faulty socket\n",
+		       dev->disk->disk_name);
+		result = -EBADFD;
+		goto error_out;
+	}
 	if (!sock) {
 		printk(KERN_ERR "%s: Attempted send on closed socket\n",
 				dev->disk->disk_name);
@@ -440,6 +446,7 @@ int __gnbd_send_req(struct gnbd_device *dev, struct socket *sock,
 	return 0;
 
 send_error_out:
+	dev->corrupt = 1;
 	dev->current_request = NULL;
 	wake_up(&dev->tx_wait);
 error_out:
@@ -502,6 +509,11 @@ int gnbd_do_it(struct gnbd_device *dev)
 	BUG_ON(dev->magic != GNBD_MAGIC);
 
 	while((result = sock_xmit(sock, 0, &reply,sizeof(reply), MSG_WAITALL, 1)) > 0){
+		if (dev->corrupt) {
+			printk(KERN_ERR "%s: faulty socket\n",dev->disk->disk_name);
+			return -EBADFD;
+		}
+
 		if (ntohl(reply.magic) == GNBD_KEEP_ALIVE_MAGIC)
 			/* FIXME -- I should reset the wait time here */
 			continue;
@@ -771,6 +783,7 @@ static int gnbd_ctl_ioctl(struct inode *inode, struct file *file,
 		}
 		dev->file = file;
 		dev->sock = SOCKET_I(inode);
+		dev->corrupt = 0;
 		dev->receiver_pid = current->pid; 
 		blk_run_queue(dev->disk->queue);
 		error = gnbd_do_it(dev);
diff --git a/gnbd-kernel/src/gnbd.h b/gnbd-kernel/src/gnbd.h
index 7af7f0e..b0b45dc 100644
--- a/gnbd-kernel/src/gnbd.h
+++ b/gnbd-kernel/src/gnbd.h
@@ -45,6 +45,7 @@ struct gnbd_device {
 	struct block_device *bdev;
 	struct request *current_request;
 	wait_queue_head_t tx_wait;
+	int corrupt;
 };
 
 #endif /* __KERNEL__ */


hooks/post-receive
--
Cluster Project


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-20  4:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-20  4:19 Cluster Project branch, master, updated. cluster-2.99.04-31-g4f32341 fabbione

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).