public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* Cluster Project branch, RHEL5, updated. cmirror_1_1_15-121-gb7a5aea
@ 2008-06-19 21:05 bmarzins
  0 siblings, 0 replies; only message in thread
From: bmarzins @ 2008-06-19 21:05 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=b7a5aea8b738a99c00333837a86dcbf6d3f1f2ac

The branch, RHEL5 has been updated
       via  b7a5aea8b738a99c00333837a86dcbf6d3f1f2ac (commit)
      from  656a865047bb5f6f9461a7cde7a78d45602fc1fa (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 b7a5aea8b738a99c00333837a86dcbf6d3f1f2ac
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 41b0c2b..333392d 100644
--- a/gnbd-kernel/src/gnbd.c
+++ b/gnbd-kernel/src/gnbd.c
@@ -404,6 +404,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);
@@ -458,6 +464,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:
@@ -522,6 +529,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;
@@ -791,6 +803,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 50da10b..8b32a8e 100644
--- a/gnbd-kernel/src/gnbd.h
+++ b/gnbd-kernel/src/gnbd.h
@@ -58,6 +58,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-19 21:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-19 21:05 Cluster Project branch, RHEL5, updated. cmirror_1_1_15-121-gb7a5aea bmarzins

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).