All of lore.kernel.org
 help / color / mirror / Atom feed
From: bmarzins@sourceware.org <bmarzins@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] Cluster Project branch, RHEL5, updated. cmirror_1_1_15-121-gb7a5aea
Date: 19 Jun 2008 21:05:13 -0000	[thread overview]
Message-ID: <20080619210513.29494.qmail@sourceware.org> (raw)

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



                 reply	other threads:[~2008-06-19 21:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080619210513.29494.qmail@sourceware.org \
    --to=bmarzins@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.