FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 09-28-2011, 05:31 AM
"Fabio M. Di Nitto"
 
Default fence_scsi: remove unlink of fence_scsi.dev file

Oh cool! that was a nice and quick fix for the BZ.

ACK for upstream/master/RHEl, but please hold the cherry pick to RHEL
till next tuesday.

Thanks
Fabio

On 09/28/2011 12:21 AM, Ryan O'Hara wrote:
> This patch removes the call to unlink the fence_scsi.dev file during
> unfencing (action=on). Instead of unlinking the file, check to see if
> the current device is already in the fence_scsi.dev file before writing
> it to the file. Note that since this file exists in /var/run/cluster
> directory, it should be removed on reboot.
>
> Resolves: rhbz#741339
>
> Signed-off-by: Ryan O'Hara <rohara@redhat.com>
> ---
> fence/agents/scsi/fence_scsi.pl | 14 +++++++++++---
> 1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
> index 93f5056..87a599c 100644
> --- a/fence/agents/scsi/fence_scsi.pl
> +++ b/fence/agents/scsi/fence_scsi.pl
> @@ -41,7 +41,6 @@ sub do_action_on ($@)
> my $self = (caller(0))[3];
> my ($node_key, @devices) = @_;
>
> - dev_unlink ();
> key_write ($node_key);
>
> foreach $dev (@devices) {
> @@ -369,8 +368,17 @@ sub dev_write ($)
> mkpath ("/var/run/cluster");
> }
>
> - open (*FILE, ">>$file") or die "$!
";
> - print FILE "$dev
";
> + open (*FILE, "+>>$file") or die "$!
";
> +
> + ## since the file is opened for read, write and append,
> + ## we need to seek to the beginning of the file before grep.
> +
> + seek (FILE, 0, 0);
> +
> + if (! grep { /^$dev$/ } <FILE>) {
> + print FILE "$dev
";
> + }
> +
> close (FILE);
>
> return;
 

Thread Tools




All times are GMT. The time now is 12:05 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org