From: Fabio M. Di Nitto <fdinitto@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] fence_scsi: remove unlink of fence_scsi.dev file
Date: Wed, 28 Sep 2011 07:31:48 +0200 [thread overview]
Message-ID: <4E82B144.7000608@redhat.com> (raw)
In-Reply-To: <1317162095-15479-1-git-send-email-rohara@redhat.com>
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 "$!\n";
> - print FILE "$dev\n";
> + open (\*FILE, "+>>$file") or die "$!\n";
> +
> + ## 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\n";
> + }
> +
> close (FILE);
>
> return;
prev parent reply other threads:[~2011-09-28 5:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-27 22:21 [Cluster-devel] [PATCH] fence_scsi: remove unlink of fence_scsi.dev file Ryan O'Hara
2011-09-28 5:31 ` Fabio M. Di Nitto [this message]
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=4E82B144.7000608@redhat.com \
--to=fdinitto@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 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.