From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16309 invoked by alias); 20 Jun 2008 04:19:53 -0000 Received: (qmail 16279 invoked by uid 9702); 20 Jun 2008 04:19:53 -0000 Date: Fri, 20 Jun 2008 04:19:00 -0000 Message-ID: <20080620041953.16262.qmail@sourceware.org> 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 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 0b922103eb3c7d5d99aa77fc30dc3ddfa22f8521 X-Git-Newrev: 4f32341cc111bd6e8dc888b483db2e7951b96c2a Mailing-List: contact cluster-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cluster-cvs-owner@sourceware.org X-SW-Source: 2008-q2/txt/msg00508.txt.bz2 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 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