public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: fabbione@sourceware.org
To: cluster-cvs@sources.redhat.com, cluster-devel@redhat.com
Subject: Cluster Project branch, master, updated. cluster-2.99.04-31-g4f32341
Date: Fri, 20 Jun 2008 04:19:00 -0000	[thread overview]
Message-ID: <20080620041953.16262.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=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


                 reply	other threads:[~2008-06-20  4:19 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=20080620041953.16262.qmail@sourceware.org \
    --to=fabbione@sourceware.org \
    --cc=cluster-cvs@sources.redhat.com \
    --cc=cluster-devel@redhat.com \
    /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 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).