fence-agents: master - fence_cisco_ucs: New fence agent for Cisco UCS
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 79df6ecd14f568dbb39396cb9f00a91572effe67
Parent: 5035c43a1f595a6d776d0c6b988b4eb122877f19
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Sep 24 20:31:12 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Fri Sep 24 20:31:12 2010 +0200
fence_cisco_ucs: New fence agent for Cisco UCS
---
configure.ac | 1 +
fence/agents/Makefile.am | 1 +
fence/agents/cisco_ucs/Makefile.am | 15 +++
fence/agents/cisco_ucs/fence_cisco_ucs.py | 138 +++++++++++++++++++++++++++++
4 files changed, 155 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index 439eb9f..3b70cfe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -243,6 +243,7 @@ AC_CONFIG_FILES([Makefile
fence/agents/brocade/Makefile
fence/agents/bullpap/Makefile
fence/agents/cisco_mds/Makefile
+ fence/agents/cisco_ucs/Makefile
fence/agents/cpint/Makefile
fence/agents/drac/Makefile
fence/agents/drac5/Makefile
diff --git a/fence/agents/Makefile.am b/fence/agents/Makefile.am
index 4cd1564..3a91ed4 100644
--- a/fence/agents/Makefile.am
+++ b/fence/agents/Makefile.am
@@ -9,6 +9,7 @@ SUBDIRS = lib \
brocade \
bullpap \
cisco_mds \
+ cisco_ucs \
cpint \
drac \
drac5 \
diff --git a/fence/agents/cisco_ucs/Makefile.am b/fence/agents/cisco_ucs/Makefile.am
new file mode 100644
index 0000000..77e3a74
--- /dev/null
+++ b/fence/agents/cisco_ucs/Makefile.am
@@ -0,0 +1,15 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+TARGET = fence_cisco_ucs
+
+EXTRA_DIST = $(TARGET).py
+
+sbin_SCRIPTS = $(TARGET)
+
+dist_man_MANS = $(TARGET).8
+
+include $(top_srcdir)/make/fencebuild.mk
+include $(top_srcdir)/make/fenceman.mk
+
+clean-local: clean-man
+ rm -f $(TARGET)
diff --git a/fence/agents/cisco_ucs/fence_cisco_ucs.py b/fence/agents/cisco_ucs/fence_cisco_ucs.py
new file mode 100755
index 0000000..07375b3
--- /dev/null
+++ b/fence/agents/cisco_ucs/fence_cisco_ucs.py
@@ -0,0 +1,138 @@
+#!/usr/bin/python
+
+import sys, re, pexpect, socket
+import pycurl, StringIO
+sys.path.append("@FENCEAGENTSLIBDIR@")
+from fencing import *
+
+#BEGIN_VERSION_GENERATION
+RELEASE_VERSION="New Cisco UCS Agent - test release on steroids"
+REDHAT_COPYRIGHT=""
+BUILD_DATE="March, 2008"
+#END_VERSION_GENERATION
+
+re_cookie = re.compile("<aaaLogin .* outCookie=\"(.*?)\"", re.IGNORECASE);
+re_status = re.compile("<lsPower .*? state=\"(.*?)\"", re.IGNORECASE);
+re_get_dn = re.compile(" dn=\"(.*?)\"", re.IGNORECASE)
+re_get_desc = re.compile(" descr=\"(.*?)\"", re.IGNORECASE)
+
+def get_power_status(conn, options):
+ try:
+ res = send_command(options, "<configResolveDn cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" dn=\"org-root/ls-" + options["-n"] + "/power\"/>")
+ except pycurl.error, e:
+ sys.stderr.write(e[1] + "\n")
+ fail(EC_TIMED_OUT)
+
+ result = re_status.search(res)
+ if (result == None):
+ fail(EC_STATUS)
+ else:
+ status = result.group(1)
+
+ if (status == "up"):
+ return "on"
+ else:
+ return "off"
+
+def set_power_status(conn, options):
+ action = {
+ 'on' : "up",
+ 'off' : "down"
+ }[options["-o"]]
+
+ try:
+ res = send_command(options, "<configConfMos cookie=\"" + options["cookie"] + "\" inHierarchical=\"no\"><inConfigs><pair key=\"org-root/ls-" + options["-n"] + "/power\"><lsPower dn=\"org-root/ls-" + options["-n"] + "/power\" state=\"" + action + "\" status=\"modified\" /></pair></inConfigs></configConfMos>")
+ except pycurl.error, e:
+ sys.stderr.write(e[1] + "\n")
+ fail(EC_TIMED_OUT)
+
+ return
+
+def get_list(conn, options):
+ outlets = { }
+
+ try:
+ try:
+ res = send_command(options, "<configResolveClass cookie=\"" + options["cookie"] + "\" inHierarchical=\"false\" classId=\"lsServer\"/>")
+ except pycurl.error, e:
+ sys.stderr.write(e[1] + "\n")
+ fail(EC_TIMED_OUT)
+
+ lines = res.split("<lsServer ")
+ for i in range(1, len(lines)):
+ dn = re_get_dn.search(lines[i]).group(1)
+ desc = re_get_desc.search(lines[i]).group(1)
+ outlets[dn] = (desc, None)
+ except AttributeError:
+ return { }
+ except IndexError:
+ return { }
+
+ return outlets
+
+def send_command(opt, command):
+ ## setup correct URL
+ if opt.has_key("-z"):
+ url = "https:"
+ else:
+ url = "http:"
+
+ url += "//" + opt["-a"] + ":" + str(opt["-u"]) + "/nuova"
+
+ ## send command through pycurl
+ c = pycurl.Curl()
+ b = StringIO.StringIO()
+ c.setopt(pycurl.URL, url)
+ c.setopt(pycurl.HTTPHEADER, [ "Content-type: text/xml" ])
+ c.setopt(pycurl.POSTFIELDS, command)
+ c.setopt(pycurl.WRITEFUNCTION, b.write)
+ c.setopt(pycurl.TIMEOUT, int(opt["-Y"]))
+ c.setopt(pycurl.SSL_VERIFYPEER, 0)
+ c.perform()
+ result = b.getvalue()
+
+ if opt["log"] >= LOG_MODE_VERBOSE:
+ opt["debug_fh"].write(command + "\n")
+ opt["debug_fh"].write(result + "\n")
+
+ return result
+
+def main():
+ device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
+ "action", "ipaddr", "login", "passwd", "passwd_script",
+ "ssl", "inet4_only", "inet6_only", "ipport", "port",
+ "web", "separator", "power_wait", "power_timeout",
+ "shell_timeout" ]
+
+ atexit.register(atexit_handler)
+
+ options = check_input(device_opt, process_input(device_opt))
+
+ docs = { }
+ docs["shortdesc"] = "Fence agent for Cisco UCS"
+ docs["longdesc"] = "fence_cisco_ucs is an I/O Fencing agent which can be \
+used with Cisco UCS to fence machines."
+ docs["vendorurl"] = "http://www.cisco.com"
+ show_docs(options, docs)
+
+ ### Login
+ res = send_command(options, "<aaaLogin inName=\"" + options["-l"] + "\" inPassword=\"" + options["-p"] + "\" />")
+ result = re_cookie.search(res)
+ if (result == None):
+ ## Cookie is absenting in response
+ fail(EC_LOGIN_DENIED)
+
+ options["cookie"] = result.group(1);
+
+ ##
+ ## Fence operations
+ ####
+ result = fence_action(None, options, set_power_status, get_power_status, get_list)
+
+ ### Logout; we do not care about result as we will end in any case
+ send_command(options, "<aaaLogout inCookie=\"" + options["cookie"] + "\" />")
+
+ sys.exit(result)
+
+if __name__ == "__main__":
+ main()
13 years, 8 months
fence-agents: master - fence_rhevm: New fence agent for RHEV-M REST API
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: 5035c43a1f595a6d776d0c6b988b4eb122877f19
Parent: ae8ee07ad63567264bcd5da282ea6a338c039cc2
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Fri Sep 24 20:02:00 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Fri Sep 24 20:02:00 2010 +0200
fence_rhevm: New fence agent for RHEV-M REST API
---
configure.ac | 1 +
fence/agents/Makefile.am | 1 +
fence/agents/lib/fencing.py.py | 8 ++-
fence/agents/rhevm/Makefile.am | 15 ++++
fence/agents/rhevm/fence_rhevm.py | 145 +++++++++++++++++++++++++++++++++++++
5 files changed, 169 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index 71bc6d2..439eb9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -262,6 +262,7 @@ AC_CONFIG_FILES([Makefile
fence/agents/node_assassin/Makefile
fence/agents/nss_wrapper/Makefile
fence/agents/rackswitch/Makefile
+ fence/agents/rhevm/Makefile
fence/agents/rsa/Makefile
fence/agents/rsb/Makefile
fence/agents/sanbox2/Makefile
diff --git a/fence/agents/Makefile.am b/fence/agents/Makefile.am
index 2159558..4cd1564 100644
--- a/fence/agents/Makefile.am
+++ b/fence/agents/Makefile.am
@@ -27,6 +27,7 @@ SUBDIRS = lib \
node_assassin \
nss_wrapper \
rackswitch \
+ rhevm \
rsa \
rsb \
sanbox2 \
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 4c5a0db..7e49649 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -75,6 +75,10 @@ all_opt = {
"getopt" : "",
"help" : "",
"order" : 1 },
+ "web" : {
+ "getopt" : "",
+ "help" : "",
+ "order" : 1 },
"action" : {
"getopt" : "o:",
"longopt" : "action",
@@ -342,7 +346,7 @@ all_opt = {
"help" : "--shell-timeout <seconds> Wait X seconds for cmd prompt after issuing command",
"default" : "3",
"required" : "0",
- "shortdesc" : "Wait X seconds for cmd promprt after issuing command",
+ "shortdesc" : "Wait X seconds for cmd prompt after issuing command",
"order" : 200 },
"power_timeout" : {
"getopt" : "g:",
@@ -693,6 +697,8 @@ def check_input(device_opt, opt):
options["-u"] = 22
elif options.has_key("-z"):
options["-u"] = 443
+ elif device_opt.count("web"):
+ options["-u"] = 80
else:
options["-u"] = 23
diff --git a/fence/agents/rhevm/Makefile.am b/fence/agents/rhevm/Makefile.am
new file mode 100644
index 0000000..fc4635f
--- /dev/null
+++ b/fence/agents/rhevm/Makefile.am
@@ -0,0 +1,15 @@
+MAINTAINERCLEANFILES = Makefile.in
+
+TARGET = fence_rhevm
+
+EXTRA_DIST = $(TARGET).py
+
+sbin_SCRIPTS = $(TARGET)
+
+dist_man_MANS = $(TARGET).8
+
+include $(top_srcdir)/make/fencebuild.mk
+include $(top_srcdir)/make/fenceman.mk
+
+clean-local: clean-man
+ rm -f $(TARGET)
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
new file mode 100755
index 0000000..376e6e3
--- /dev/null
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -0,0 +1,145 @@
+#!/usr/bin/python
+
+import sys, re, pexpect, socket
+import pycurl, StringIO
+sys.path.append("@FENCEAGENTSLIBDIR@")
+from fencing import *
+
+#BEGIN_VERSION_GENERATION
+RELEASE_VERSION="New RHEV-M Agent - test release on steroids"
+REDHAT_COPYRIGHT=""
+BUILD_DATE="March, 2008"
+#END_VERSION_GENERATION
+
+
+re_get_id = re.compile("<vm id=\"(.*?)\"", re.IGNORECASE);
+re_status = re.compile("<status>(.*?)</status>", re.IGNORECASE);
+re_get_name = re.compile("<name>(.*?)</name>", re.IGNORECASE);
+
+def get_power_status(conn, options):
+ ### Obtain real ID from name
+ try:
+ res = send_command(options, "vms/?search=name%3D" + options["-n"])
+ except pycurl.error, e:
+ sys.stderr.write(e[1] + "\n")
+ fail(EC_TIMED_OUT)
+
+ result = re_get_id.search(res)
+ if (result == None):
+ # Unable to obtain ID needed to access virtual machine
+ fail(EC_STATUS)
+
+ options["id"] = result.group(1);
+
+ re_status.search(res)
+ result = re_status.search(res)
+ if (result == None):
+ # We were able to parse ID so output is correct
+ # in some cases it is possible that RHEV-M output does not
+ # contain <status> line. We can assume machine is OFF then
+ return "off"
+ else:
+ status = result.group(1)
+
+ if (status == "RUNNING"):
+ return "on"
+ else:
+ return "off"
+
+def set_power_status(conn, options):
+ action = {
+ 'on' : "start",
+ 'off' : "stop"
+ }[options["-o"]]
+
+ url = "vms/" + options["id"] + "/" + action
+ try:
+ res = send_command(options, url, "POST")
+ except pycurl.error, e:
+ sys.stderr.write(e[1] + "\n")
+ fail(EC_TIMED_OUT)
+
+ return
+
+def get_list(conn, options):
+ outlets = { }
+
+ try:
+ try:
+ res = send_command(options, "vms")
+ except pycurl.error, e:
+ sys.stderr.write(e[1] + "\n")
+ fail(EC_TIMED_OUT)
+
+ lines = res.split("<vm ")
+ for i in range(1, len(lines)):
+ name = re_get_name.search(lines[i]).group(1)
+ outlets[name] = ("", None)
+ except AttributeError:
+ return { }
+ except IndexError:
+ return { }
+
+ return outlets
+
+def send_command(opt, command, method = "GET"):
+ ## setup correct URL
+ if opt.has_key("-z"):
+ url = "https:"
+ else:
+ url = "http:"
+
+ url += "//" + opt["-a"] + ":" + str(opt["-u"]) + "/rhevm-api-powershell/" + command
+
+ ## send command through pycurl
+ c = pycurl.Curl()
+ b = StringIO.StringIO()
+ c.setopt(pycurl.URL, url)
+ c.setopt(pycurl.HTTPHEADER, [ "Content-type: application/xml", "Accept: application/xml" ])
+ c.setopt(pycurl.HTTPAUTH, pycurl.HTTPAUTH_BASIC)
+ c.setopt(pycurl.USERPWD, opt["-l"] + ":" + opt["-p"])
+ c.setopt(pycurl.TIMEOUT, int(opt["-Y"]))
+ c.setopt(pycurl.SSL_VERIFYPEER, 0)
+
+ if (method == "POST"):
+ c.setopt(pycurl.POSTFIELDS, "<action />")
+
+ c.setopt(pycurl.WRITEFUNCTION, b.write)
+ c.perform()
+ result = b.getvalue()
+
+ if opt["log"] >= LOG_MODE_VERBOSE:
+ opt["debug_fh"].write(command + "\n")
+ opt["debug_fh"].write(result + "\n")
+
+ return result
+
+def main():
+ device_opt = [ "help", "version", "agent", "quiet", "verbose", "debug",
+ "action", "ipaddr", "login", "passwd", "passwd_script",
+ "ssl", "inet4_only", "inet6_only", "ipport", "port",
+ "web", "separator", "power_wait", "power_timeout",
+ "shell_timeout" ]
+
+ atexit.register(atexit_handler)
+
+ all_opt["power_wait"]["default"] = "1"
+
+ options = check_input(device_opt, process_input(device_opt))
+
+ docs = { }
+ docs["shortdesc"] = "Fence agent for RHEV-M REST API"
+ docs["longdesc"] = "fence_rhevm is an I/O Fencing agent which can be \
+used with RHEV-M REST API to fence virtual machines."
+ docs["vendorurl"] = "http://www.redhat.com"
+ show_docs(options, docs)
+
+ ##
+ ## Fence operations
+ ####
+ result = fence_action(None, options, set_power_status, get_power_status, get_list)
+
+ sys.exit(result)
+
+if __name__ == "__main__":
+ main()
13 years, 8 months
cluster: RHEL6 - GFS2: fsck.gfs2 seems to process large files twice
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 4548cf064eca28c59e12d7b88ed3ded193907c98
Parent: f230a400c7b99d9cc95e19ab6fdca9fcd64811ee
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Thu Sep 23 10:33:06 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Thu Sep 23 10:38:25 2010 -0500
GFS2: fsck.gfs2 seems to process large files twice
This patch allows each pass to define its own callback function for
reporting its progress for large files. The initial pass through the
metadata made by pass1 as a sanity check has no such callback so
pass1 will stop reporting its progress through the file twice.
rhbz#621313
---
gfs2/fsck/metawalk.c | 6 +++---
gfs2/fsck/metawalk.h | 1 +
gfs2/fsck/pass1.c | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 2151ced..ff348e4 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1345,14 +1345,14 @@ int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass)
if (rc && (!error || rc < 0))
error = rc;
- if (ip->i_di.di_blocks > COMFORTABLE_BLKS)
- big_file_comfort(ip, blks_checked);
+ if (pass->big_file_msg && ip->i_di.di_blocks > COMFORTABLE_BLKS)
+ pass->big_file_msg(ip, blks_checked);
if (bh == ip->i_bh)
osi_list_del(&bh->b_altlist);
else
brelse(bh);
}
- if (ip->i_di.di_blocks > COMFORTABLE_BLKS) {
+ if (pass->big_file_msg && ip->i_di.di_blocks > COMFORTABLE_BLKS) {
log_notice( _("\rLarge file at %lld (0x%llx) - 100 percent "
"complete. "
"\n"),
diff --git a/gfs2/fsck/metawalk.h b/gfs2/fsck/metawalk.h
index 7aae9f2..3ee12fe 100644
--- a/gfs2/fsck/metawalk.h
+++ b/gfs2/fsck/metawalk.h
@@ -89,6 +89,7 @@ struct metawalk_fxns {
void *private);
int (*finish_eattr_indir) (struct gfs2_inode *ip, int leaf_pointers,
int leaf_pointer_errors, void *private);
+ void (*big_file_msg) (struct gfs2_inode *ip, uint64_t blks_checked);
};
#endif /* _METAWALK_H */
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index bc500fd..6613bd1 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -87,6 +87,7 @@ struct metawalk_fxns pass1_fxns = {
.check_eattr_entry = check_eattr_entries,
.check_eattr_extentry = check_extended_leaf_eattr,
.finish_eattr_indir = finish_eattr_indir,
+ .big_file_msg = big_file_comfort,
};
struct metawalk_fxns undo_fxns = {
13 years, 8 months
cluster: STABLE3 - GFS2: fsck.gfs2 seems to process large files twice
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: aba16879c13221c0bf97882627b16af99793ef29
Parent: 806743e2063b7f0db573c784eb6a7fc14378e93c
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Thu Sep 23 10:33:06 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Thu Sep 23 10:39:23 2010 -0500
GFS2: fsck.gfs2 seems to process large files twice
This patch allows each pass to define its own callback function for
reporting its progress for large files. The initial pass through the
metadata made by pass1 as a sanity check has no such callback so
pass1 will stop reporting its progress through the file twice.
rhbz#621313
---
gfs2/fsck/metawalk.c | 6 +++---
gfs2/fsck/metawalk.h | 1 +
gfs2/fsck/pass1.c | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 2151ced..ff348e4 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1345,14 +1345,14 @@ int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass)
if (rc && (!error || rc < 0))
error = rc;
- if (ip->i_di.di_blocks > COMFORTABLE_BLKS)
- big_file_comfort(ip, blks_checked);
+ if (pass->big_file_msg && ip->i_di.di_blocks > COMFORTABLE_BLKS)
+ pass->big_file_msg(ip, blks_checked);
if (bh == ip->i_bh)
osi_list_del(&bh->b_altlist);
else
brelse(bh);
}
- if (ip->i_di.di_blocks > COMFORTABLE_BLKS) {
+ if (pass->big_file_msg && ip->i_di.di_blocks > COMFORTABLE_BLKS) {
log_notice( _("\rLarge file at %lld (0x%llx) - 100 percent "
"complete. "
"\n"),
diff --git a/gfs2/fsck/metawalk.h b/gfs2/fsck/metawalk.h
index 7aae9f2..3ee12fe 100644
--- a/gfs2/fsck/metawalk.h
+++ b/gfs2/fsck/metawalk.h
@@ -89,6 +89,7 @@ struct metawalk_fxns {
void *private);
int (*finish_eattr_indir) (struct gfs2_inode *ip, int leaf_pointers,
int leaf_pointer_errors, void *private);
+ void (*big_file_msg) (struct gfs2_inode *ip, uint64_t blks_checked);
};
#endif /* _METAWALK_H */
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index bc500fd..6613bd1 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -87,6 +87,7 @@ struct metawalk_fxns pass1_fxns = {
.check_eattr_entry = check_eattr_entries,
.check_eattr_extentry = check_extended_leaf_eattr,
.finish_eattr_indir = finish_eattr_indir,
+ .big_file_msg = big_file_comfort,
};
struct metawalk_fxns undo_fxns = {
13 years, 8 months
gfs2-utils: master - GFS2: fsck.gfs2 seems to process large files twice
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: afabf7e6c8547e9651ee8a168e5dc65675c76d8e
Parent: 8ef7be619e783c92bf75cbf4dfb8e7a05399c399
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Thu Sep 23 10:33:06 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Thu Sep 23 10:42:01 2010 -0500
GFS2: fsck.gfs2 seems to process large files twice
This patch allows each pass to define its own callback function for
reporting its progress for large files. The initial pass through the
metadata made by pass1 as a sanity check has no such callback so
pass1 will stop reporting its progress through the file twice.
rhbz#621313
---
gfs2/fsck/metawalk.c | 6 +++---
gfs2/fsck/metawalk.h | 1 +
gfs2/fsck/pass1.c | 1 +
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 421a645..e3c0eff 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1347,14 +1347,14 @@ int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass)
if (rc && (!error || rc < 0))
error = rc;
- if (ip->i_di.di_blocks > COMFORTABLE_BLKS)
- big_file_comfort(ip, blks_checked);
+ if (pass->big_file_msg && ip->i_di.di_blocks > COMFORTABLE_BLKS)
+ pass->big_file_msg(ip, blks_checked);
if (bh == ip->i_bh)
osi_list_del(&bh->b_altlist);
else
brelse(bh);
}
- if (ip->i_di.di_blocks > COMFORTABLE_BLKS) {
+ if (pass->big_file_msg && ip->i_di.di_blocks > COMFORTABLE_BLKS) {
log_notice( _("\rLarge file at %lld (0x%llx) - 100 percent "
"complete. "
"\n"),
diff --git a/gfs2/fsck/metawalk.h b/gfs2/fsck/metawalk.h
index 7aae9f2..3ee12fe 100644
--- a/gfs2/fsck/metawalk.h
+++ b/gfs2/fsck/metawalk.h
@@ -89,6 +89,7 @@ struct metawalk_fxns {
void *private);
int (*finish_eattr_indir) (struct gfs2_inode *ip, int leaf_pointers,
int leaf_pointer_errors, void *private);
+ void (*big_file_msg) (struct gfs2_inode *ip, uint64_t blks_checked);
};
#endif /* _METAWALK_H */
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 0aea38c..b891d1b 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -89,6 +89,7 @@ struct metawalk_fxns pass1_fxns = {
.check_eattr_entry = check_eattr_entries,
.check_eattr_extentry = check_extended_leaf_eattr,
.finish_eattr_indir = finish_eattr_indir,
+ .big_file_msg = big_file_comfort,
};
struct metawalk_fxns undo_fxns = {
13 years, 8 months
cluster: RHEL56 - GFS2 mount fails incorrectly after correctly failed second-mount attempt
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 6a3d7a53e4c9ca2e06e8c6043db86c08eba4d481
Parent: ab8fc1a2100c81e7417bc15496cf293dde6512cd
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Thu Sep 23 08:21:45 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Thu Sep 23 08:21:45 2010 -0500
GFS2 mount fails incorrectly after correctly failed second-mount attempt
When a user attempts to mount a GFS2 file system to a second mount
point, gfs_controld was not properly storing the id of the second
mount point in its mount point information. If the mount attempt
fails, (for example, due to mount options incompatible with the
original mount), the mount point information was not being deleted
properly because of the missing id. That caused subsequent mount
attempts to fail. This patch stores the ID in the mount point
information so that it can be found later and removed properly for
failed mounts.
rhbz#559735
---
group/gfs_controld/recover.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/group/gfs_controld/recover.c b/group/gfs_controld/recover.c
index 597516c..b33b3fd 100644
--- a/group/gfs_controld/recover.c
+++ b/group/gfs_controld/recover.c
@@ -1559,6 +1559,7 @@ int add_another_mountpoint(struct mountgroup *mg, char *dir, char *dev, int ci)
memset(mp, 0, sizeof(struct mountpoint));
strncpy(mp->dir, dir, sizeof(mp->dir));
list_add(&mp->list, &mg->mountpoints);
+ mp->client = ci;
mg->mount_client = ci;
/* we return this special error to mount.gfs which mount.gfs will
13 years, 8 months
cluster: RHEL56 - NFS over GFS issue (fatal: assertion "!bd->bd_pinned && !buffer_busy(bh)" failed)
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: ab8fc1a2100c81e7417bc15496cf293dde6512cd
Parent: 53dba11a565ed574c6433ed8ba8c12c274185911
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Tue Sep 21 17:05:29 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Tue Sep 21 17:05:29 2010 -0500
NFS over GFS issue (fatal: assertion "!bd->bd_pinned && !buffer_busy(bh)" failed)
There were several places in the code that tried to remove buffers
from the two active items lists (transaction and glock ail) but each
one was using a different set of criteria, none of which were
consistent. This patch introduces a new function,
gfs_bd_ail_tryremove, that checks the condition of the buffer using
uniform criteria before removing it from the ail. All the places
that were doing this haphazardly now call the new function.
So really, not counting the scsi device driver bug, there were six
main gfs bugs found with this one scenario:
1. There was a timing window whereby a process could mark a buffer
dirty while it was being synced to disk. This was fixed by
introducing a new semaphore, sd_log_flush_lock, which keeps
that from happening.
2. Buffers were being taken off the ail list at different times
using different criteria. That was fixed by the new function
as mentioned above.
3. Some buffers were not being added to the transaction, especially
in cases where the files were journaled, which happens mostly
with directory hash table data. That was fixed by the
introduction of the necessary calls to gfs_trans_add_bh.
4. The transaction glock was prematurely being released when the
glocks hit a capacity watermark. That's why it often took so
long to recreate some of these problems. To prevent this, new
code was added to function clear_glock so that it would only
release the transaction glock at unmount time. I'm using the
number of glockd daemons to determine whether the call was made
during normal operations or at unmount time. So in order to
accomodate that change, I had to fix a bit of code where the
number of glockd daemons was going negative.
5. When finding its place in the journal, function gfs_find_jhead
was not holding the journal log lock. That causing another
nasty timing window where the journal was being changed while
the proper journal location was being located.
6. This patch fixes a problem whereby GFS read-ahead was interfering
with GFS write requests by continuously re-trying the read-aheads.
The patch reduces the extra read-aheads so that the read-ahead for
each block is only done once for any given write request.
rhbz#491369
---
gfs-kernel/src/gfs/dio.c | 135 ++++-----------------------------------
gfs-kernel/src/gfs/dio.h | 29 ++++++++-
gfs-kernel/src/gfs/dir.c | 15 ++++-
gfs-kernel/src/gfs/file.c | 14 +++-
gfs-kernel/src/gfs/glock.c | 5 ++
gfs-kernel/src/gfs/glops.c | 12 +--
gfs-kernel/src/gfs/incore.h | 2 +
gfs-kernel/src/gfs/log.c | 97 ++++++++++++++++++++++++++--
gfs-kernel/src/gfs/log.h | 2 +-
gfs-kernel/src/gfs/ops_export.c | 3 +
gfs-kernel/src/gfs/ops_file.c | 8 +-
gfs-kernel/src/gfs/ops_fstype.c | 5 +-
gfs-kernel/src/gfs/ops_super.c | 6 +-
gfs-kernel/src/gfs/quota.c | 2 +-
gfs-kernel/src/gfs/recovery.c | 3 +
gfs-kernel/src/gfs/trans.c | 9 +--
16 files changed, 189 insertions(+), 158 deletions(-)
diff --git a/gfs-kernel/src/gfs/dio.c b/gfs-kernel/src/gfs/dio.c
index 277b93e..8000954 100644
--- a/gfs-kernel/src/gfs/dio.c
+++ b/gfs-kernel/src/gfs/dio.c
@@ -32,8 +32,6 @@
#include "rgrp.h"
#include "trans.h"
-#define buffer_busy(bh) ((bh)->b_state & ((1ul << BH_Dirty) | (1ul << BH_Lock)))
-
/**
* aspace_get_block -
* @inode:
@@ -274,20 +272,8 @@ gfs_ail_start_trans(struct gfs_sbd *sdp, struct gfs_trans *tr)
if (gfs_trylock_buffer(bh))
continue;
- if (bd->bd_pinned) {
- gfs_unlock_buffer(bh);
- continue;
- }
-
- if (!buffer_busy(bh)) {
- if (!buffer_uptodate(bh))
- gfs_io_error_bh(sdp, bh);
-
- list_del_init(&bd->bd_ail_tr_list);
- list_del(&bd->bd_ail_gl_list);
-
+ if (bd->bd_pinned || gfs_bd_ail_tryremove(sdp, bd)) {
gfs_unlock_buffer(bh);
- brelse(bh);
continue;
}
@@ -334,22 +320,10 @@ gfs_ail_empty_trans(struct gfs_sbd *sdp, struct gfs_trans *tr)
bd = list_entry(tmp, struct gfs_bufdata, bd_ail_tr_list);
bh = bd->bd_bh;
- if (gfs_trylock_buffer(bh))
- continue;
-
- if (bd->bd_pinned || buffer_busy(bh)) {
+ if (gfs_trylock_buffer(bh) == 0) {
+ gfs_bd_ail_tryremove(sdp, bd);
gfs_unlock_buffer(bh);
- continue;
}
-
- if (!buffer_uptodate(bh))
- gfs_io_error_bh(sdp, bh);
-
- list_del_init(&bd->bd_ail_tr_list);
- list_del(&bd->bd_ail_gl_list);
-
- gfs_unlock_buffer(bh);
- brelse(bh);
}
ret = list_empty(head);
@@ -360,85 +334,6 @@ gfs_ail_empty_trans(struct gfs_sbd *sdp, struct gfs_trans *tr)
}
/**
- * ail_empty_gl - remove all buffers for a given lock from the AIL
- * @gl: the glock
- *
- * None of the buffers should be dirty, locked, or pinned.
- */
-
-static void
-ail_empty_gl(struct gfs_glock *gl)
-{
- struct gfs_sbd *sdp = gl->gl_sbd;
- struct gfs_bufdata *bd;
- struct buffer_head *bh;
-
- spin_lock(&sdp->sd_ail_lock);
-
- while (!list_empty(&gl->gl_ail_bufs)) {
- bd = list_entry(gl->gl_ail_bufs.next,
- struct gfs_bufdata, bd_ail_gl_list);
- bh = bd->bd_bh;
-
- gfs_assert_withdraw(sdp, !bd->bd_pinned && !buffer_busy(bh));
- if (!buffer_uptodate(bh))
- gfs_io_error_bh(sdp, bh);
-
- list_del_init(&bd->bd_ail_tr_list);
- list_del(&bd->bd_ail_gl_list);
-
- brelse(bh);
- }
-
- spin_unlock(&sdp->sd_ail_lock);
-}
-
-/**
- * gfs_inval_buf - Invalidate all buffers associated with a glock
- * @gl: the glock
- *
- */
-
-void
-gfs_inval_buf(struct gfs_glock *gl)
-{
- struct inode *aspace = gl->gl_aspace;
- struct address_space *mapping = gl->gl_aspace->i_mapping;
-
- ail_empty_gl(gl);
-
- atomic_inc(&aspace->i_writecount);
- truncate_inode_pages(mapping, 0);
- atomic_dec(&aspace->i_writecount);
-
- gfs_assert_withdraw(gl->gl_sbd, !mapping->nrpages);
-}
-
-/**
- * gfs_sync_buf - Sync all buffers associated with a glock
- * @gl: The glock
- * @flags: DIO_START | DIO_WAIT | DIO_CHECK
- *
- */
-
-void
-gfs_sync_buf(struct gfs_glock *gl, int flags)
-{
- struct address_space *mapping = gl->gl_aspace->i_mapping;
- int error = 0;
-
- if (flags & DIO_START)
- error = filemap_fdatawrite(mapping);
- if (!error && (flags & DIO_WAIT))
- error = filemap_fdatawait(mapping);
- if (!error && (flags & (DIO_INVISIBLE | DIO_CHECK)) == DIO_CHECK)
- ail_empty_gl(gl);
-
- if (error)
- gfs_io_error(gl->gl_sbd);
-}
-
-/**
* getbuf - Get a buffer with a given address space
* @sdp: the filesystem
* @aspace: the address space
@@ -731,11 +626,7 @@ gfs_dpin(struct gfs_sbd *sdp, struct buffer_head *bh)
to in-place disk block, remove it from the AIL. */
spin_lock(&sdp->sd_ail_lock);
- if (!list_empty(&bd->bd_ail_tr_list) && !buffer_busy(bh)) {
- list_del_init(&bd->bd_ail_tr_list);
- list_del(&bd->bd_ail_gl_list);
- brelse(bh);
- }
+ gfs_bd_ail_tryremove(sdp, bd);
spin_unlock(&sdp->sd_ail_lock);
clear_buffer_dirty(bh);
@@ -1081,11 +972,7 @@ gfs_wipe_buffers(struct gfs_inode *ip, struct gfs_rgrpd *rgd,
add = TRUE;
else {
spin_lock(&sdp->sd_ail_lock);
- if (!list_empty(&bd->bd_ail_tr_list)) {
- list_del_init(&bd->bd_ail_tr_list);
- list_del(&bd->bd_ail_gl_list);
- brelse(bh);
- }
+ gfs_bd_ail_tryremove(sdp, bd);
spin_unlock(&sdp->sd_ail_lock);
}
} else {
@@ -1301,21 +1188,22 @@ gfs_get_data_buffer(struct gfs_inode *ip, uint64_t block, int new,
* @dblock: the starting disk block
* @extlen: the number of blocks in the extent
*
+ * returns: number of blocks for which it submitted read requests.
*/
-void
+int
gfs_start_ra(struct gfs_glock *gl, uint64_t dblock, uint32_t extlen)
{
struct gfs_sbd *sdp = gl->gl_sbd;
struct inode *aspace = gl->gl_aspace;
struct buffer_head *first_bh, *bh;
uint32_t max_ra = gfs_tune_get(sdp, gt_max_readahead) >> sdp->sd_sb.sb_bsize_shift;
- int error;
+ int error, submitted = 0;
if (!extlen)
- return;
+ return 0;
if (!max_ra)
- return;
+ return 0;
if (extlen > max_ra)
extlen = max_ra;
@@ -1325,6 +1213,7 @@ gfs_start_ra(struct gfs_glock *gl, uint64_t dblock, uint32_t extlen)
goto out;
if (!buffer_locked(first_bh)) {
error = gfs_dreread(sdp, first_bh, DIO_START);
+ submitted++;
if (error)
goto out;
}
@@ -1337,6 +1226,7 @@ gfs_start_ra(struct gfs_glock *gl, uint64_t dblock, uint32_t extlen)
if (!buffer_uptodate(bh) && !buffer_locked(bh)) {
error = gfs_dreread(sdp, bh, DIO_START);
+ submitted++;
brelse(bh);
if (error)
goto out;
@@ -1352,4 +1242,5 @@ gfs_start_ra(struct gfs_glock *gl, uint64_t dblock, uint32_t extlen)
out:
brelse(first_bh);
+ return submitted;
}
diff --git a/gfs-kernel/src/gfs/dio.h b/gfs-kernel/src/gfs/dio.h
index 1c4060d..afbf7d1 100644
--- a/gfs-kernel/src/gfs/dio.h
+++ b/gfs-kernel/src/gfs/dio.h
@@ -14,6 +14,8 @@
#ifndef __DIO_DOT_H__
#define __DIO_DOT_H__
+#define buffer_busy(bh) ((bh)->b_state & ((1ul << BH_Dirty) | (1ul << BH_Lock)))
+
void gfs_ail_start_trans(struct gfs_sbd *sdp, struct gfs_trans *tr);
int gfs_ail_empty_trans(struct gfs_sbd *sdp, struct gfs_trans *tr);
@@ -73,7 +75,7 @@ int gfs_get_meta_buffer(struct gfs_inode *ip, int height, uint64_t num, int new,
struct buffer_head **bhp);
int gfs_get_data_buffer(struct gfs_inode *ip, uint64_t block, int new,
struct buffer_head **bhp);
-void gfs_start_ra(struct gfs_glock *gl, uint64_t dblock, uint32_t extlen);
+int gfs_start_ra(struct gfs_glock *gl, uint64_t dblock, uint32_t extlen);
static __inline__ int
gfs_get_inode_buffer(struct gfs_inode *ip, struct buffer_head **bhp)
@@ -85,7 +87,6 @@ struct inode *gfs_aspace_get(struct gfs_sbd *sdp);
void gfs_aspace_put(struct inode *aspace);
void gfs_inval_buf(struct gfs_glock *gl);
-void gfs_sync_buf(struct gfs_glock *gl, int flags);
void gfs_flush_meta_cache(struct gfs_inode *ip);
@@ -167,4 +168,28 @@ gfs_buffer_copy_tail(struct buffer_head *to_bh, int to_head,
from_head - to_head);
}
+/*
+ * gfs_bd_ail_tryremove - try to remove a bd from the ail
+ * returns: 1 if it removed one, else 0
+ */
+static __inline__ int
+gfs_bd_ail_tryremove(struct gfs_sbd *sdp, struct gfs_bufdata *bd)
+{
+ struct buffer_head *bh;
+
+ bh = bd->bd_bh;
+ if (!bd->bd_pinned && !list_empty(&bd->bd_ail_tr_list) &&
+ !buffer_busy(bh)) {
+ if (!buffer_uptodate(bh))
+ gfs_io_error_bh(sdp, bh);
+
+ list_del_init(&bd->bd_ail_tr_list);
+ list_del(&bd->bd_ail_gl_list);
+
+ brelse(bh);
+ return 1;
+ }
+ return 0;
+}
+
#endif /* __DIO_DOT_H__ */
diff --git a/gfs-kernel/src/gfs/dir.c b/gfs-kernel/src/gfs/dir.c
index 34263a2..02d3016 100644
--- a/gfs-kernel/src/gfs/dir.c
+++ b/gfs-kernel/src/gfs/dir.c
@@ -808,7 +808,9 @@ dir_split_leaf(struct gfs_inode *dip, uint32_t index, uint64_t leaf_no)
gfs32_to_cpu(dent->de_hash) < divider) {
name_len = gfs16_to_cpu(dent->de_name_len);
- gfs_dirent_alloc(dip, nbh, name_len, &new);
+ error = gfs_dirent_alloc(dip, nbh, name_len, &new);
+ if (error)
+ goto fail_brelse;
new->de_inum = dent->de_inum; /* No endianness worries */
new->de_hash = dent->de_hash; /* No endianness worries */
@@ -841,7 +843,9 @@ dir_split_leaf(struct gfs_inode *dip, uint32_t index, uint64_t leaf_no)
artificially fill in the first entry. */
if (!moved) {
- gfs_dirent_alloc(dip, nbh, 0, &new);
+ error = gfs_dirent_alloc(dip, nbh, 0, &new);
+ if (error)
+ goto fail_brelse;
new->de_inum.no_formal_ino = 0;
}
@@ -851,6 +855,7 @@ dir_split_leaf(struct gfs_inode *dip, uint32_t index, uint64_t leaf_no)
error = gfs_get_inode_buffer(dip, &dibh);
if (!gfs_assert_withdraw(dip->i_sbd, !error)) {
+ gfs_trans_add_bh(dip->i_gl, dibh);
dip->i_di.di_blocks++;
gfs_dinode_out(&dip->i_di, dibh->b_data);
brelse(dibh);
@@ -936,6 +941,7 @@ dir_double_exhash(struct gfs_inode *dip)
error = gfs_get_inode_buffer(dip, &dibh);
if (!gfs_assert_withdraw(sdp, !error)) {
+ gfs_trans_add_bh(dip->i_gl, dibh);
dip->i_di.di_depth++;
gfs_dinode_out(&dip->i_di, dibh->b_data);
brelse(dibh);
@@ -1461,7 +1467,9 @@ dir_e_add(struct gfs_inode *dip, struct qstr *filename,
nleaf->lf_depth = leaf->lf_depth;
nleaf->lf_dirent_format = cpu_to_gfs32(GFS_FORMAT_DE);
- gfs_dirent_alloc(dip, nbh, filename->len, &dent);
+ error = gfs_dirent_alloc(dip, nbh, filename->len, &dent);
+ if (error)
+ return error;
dip->i_di.di_blocks++;
@@ -1752,6 +1760,7 @@ dir_l_add(struct gfs_inode *dip, struct qstr *filename,
if (error)
return error;
+ gfs_trans_add_bh(dip->i_gl, dibh);
if (gfs_dirent_alloc(dip, dibh, filename->len, &dent)) {
brelse(dibh);
diff --git a/gfs-kernel/src/gfs/file.c b/gfs-kernel/src/gfs/file.c
index c90a704..a559749 100644
--- a/gfs-kernel/src/gfs/file.c
+++ b/gfs-kernel/src/gfs/file.c
@@ -313,7 +313,7 @@ gfs_writei(struct gfs_inode *ip, void *buf,
struct buffer_head *dibh, *bh;
uint64_t lblock, dblock;
unsigned int o;
- uint32_t extlen = 0;
+ uint32_t extlen = 0, blocks_ra = 0;
unsigned int amount;
int new;
int journaled = gfs_is_jdata(ip);
@@ -355,6 +355,7 @@ gfs_writei(struct gfs_inode *ip, void *buf,
error = gfs_block_map(ip, lblock, &new, &dblock, &extlen);
if (error)
goto fail;
+ blocks_ra = 0;
} else {
new = FALSE;
dblock = ip->i_num.no_addr;
@@ -362,8 +363,13 @@ gfs_writei(struct gfs_inode *ip, void *buf,
}
}
- if (journaled && extlen > 1)
- gfs_start_ra(ip->i_gl, dblock, extlen);
+ if (journaled && extlen > 1) {
+ if (!blocks_ra)
+ blocks_ra = gfs_start_ra(ip->i_gl, dblock,
+ extlen);
+ if (blocks_ra)
+ blocks_ra--;
+ }
error = gfs_get_data_buffer(ip, dblock,
(amount == sdp->sd_sb.sb_bsize) ? TRUE : new,
@@ -371,6 +377,8 @@ gfs_writei(struct gfs_inode *ip, void *buf,
if (error)
goto fail;
+ if (journaled)
+ gfs_trans_add_bh(ip->i_gl, bh);
error = copy_fn(ip, bh, &buf, o, amount, new);
brelse(bh);
if (error)
diff --git a/gfs-kernel/src/gfs/glock.c b/gfs-kernel/src/gfs/glock.c
index 493d2a1..54c586e 100644
--- a/gfs-kernel/src/gfs/glock.c
+++ b/gfs-kernel/src/gfs/glock.c
@@ -2718,6 +2718,11 @@ clear_glock(struct gfs_glock *gl, unsigned int *unused)
struct gfs_sbd *sdp = gl->gl_sbd;
struct gfs_gl_hash_bucket *bucket = gl->gl_bucket;
+ /* If this isn't shutdown, keep the transaction glock around. */
+ if (sdp->sd_glockd_num && gl == sdp->sd_trans_gl) {
+ glock_put(gl); /* see examine_bucket() */
+ return;
+ }
spin_lock(&sdp->sd_reclaim_lock);
if (!list_empty(&gl->gl_reclaim)) {
list_del_init(&gl->gl_reclaim);
diff --git a/gfs-kernel/src/gfs/glops.c b/gfs-kernel/src/gfs/glops.c
index da3d1d8..c9f5ad0 100644
--- a/gfs-kernel/src/gfs/glops.c
+++ b/gfs-kernel/src/gfs/glops.c
@@ -51,10 +51,8 @@ meta_go_sync(struct gfs_glock *gl, int flags)
if (!(flags & DIO_METADATA))
return;
- if (test_bit(GLF_DIRTY, &gl->gl_flags)) {
- gfs_log_flush_glock(gl);
- gfs_sync_buf(gl, flags | DIO_START | DIO_WAIT | DIO_CHECK);
- }
+ if (test_bit(GLF_DIRTY, &gl->gl_flags))
+ gfs_log_flush_glock(gl, flags);
/* We've synced everything, clear SYNC request and DIRTY flags */
clear_bit(GLF_DIRTY, &gl->gl_flags);
@@ -234,12 +232,10 @@ inode_go_sync(struct gfs_glock *gl, int flags)
if (test_bit(GLF_DIRTY, &gl->gl_flags)) {
if (meta && data) {
gfs_sync_page(gl, flags | DIO_START);
- gfs_log_flush_glock(gl);
- gfs_sync_buf(gl, flags | DIO_START | DIO_WAIT | DIO_CHECK);
+ gfs_log_flush_glock(gl, flags);
gfs_sync_page(gl, flags | DIO_WAIT | DIO_CHECK);
} else if (meta) {
- gfs_log_flush_glock(gl);
- gfs_sync_buf(gl, flags | DIO_START | DIO_WAIT | DIO_CHECK);
+ gfs_log_flush_glock(gl, flags);
} else if (data)
gfs_sync_page(gl, flags | DIO_START | DIO_WAIT | DIO_CHECK);
}
diff --git a/gfs-kernel/src/gfs/incore.h b/gfs-kernel/src/gfs/incore.h
index 9c4f467..67f7e10 100644
--- a/gfs-kernel/src/gfs/incore.h
+++ b/gfs-kernel/src/gfs/incore.h
@@ -1131,6 +1131,8 @@ struct gfs_sbd {
unsigned int sd_log_buffers; /* # of buffers in the incore log */
struct rw_semaphore sd_log_lock; /* Lock for access to log values */
+ struct semaphore sd_log_flush_lock; /* Lock for function
+ log_flush_internal */
uint64_t sd_log_dump_last;
uint64_t sd_log_dump_last_wrap;
diff --git a/gfs-kernel/src/gfs/log.c b/gfs-kernel/src/gfs/log.c
index d8738fa..2402e54 100644
--- a/gfs-kernel/src/gfs/log.c
+++ b/gfs-kernel/src/gfs/log.c
@@ -38,9 +38,11 @@
#include <asm/semaphore.h>
#include <linux/completion.h>
#include <linux/buffer_head.h>
+#include <linux/mm.h>
#include "gfs.h"
#include "dio.h"
+#include "glock.h"
#include "log.h"
#include "lops.h"
@@ -1037,6 +1039,20 @@ log_flush_internal(struct gfs_sbd *sdp, struct gfs_glock *gl)
sdp->sd_vfs->s_dirt = FALSE;
gfs_log_unlock(sdp);
+}
+
+/**
+ * gfs_log_flush - flush the whole incore log
+ * @sdp: the filesystem
+ *
+ */
+
+void
+gfs_log_flush(struct gfs_sbd *sdp)
+{
+ down(&sdp->sd_log_flush_lock); /* unlocked in gfs_sync_buf */
+ log_flush_internal(sdp, NULL);
+ up(&sdp->sd_log_flush_lock); /* locked in log_flush_internal */
/* Dump if we need to. */
@@ -1045,15 +1061,75 @@ log_flush_internal(struct gfs_sbd *sdp, struct gfs_glock *gl)
}
/**
- * gfs_log_flush - flush the whole incore log
- * @sdp: the filesystem
+ * ail_empty_gl - remove all buffers for a given lock from the AIL
+ * @gl: the glock
+ *
+ * None of the buffers should be dirty, locked, or pinned.
+ */
+
+static void
+ail_empty_gl(struct gfs_glock *gl)
+{
+ struct gfs_sbd *sdp = gl->gl_sbd;
+ struct gfs_bufdata *bd;
+ struct list_head *pos, *tmp;
+
+ spin_lock(&sdp->sd_ail_lock);
+
+ list_for_each_safe(pos, tmp, &gl->gl_ail_bufs) {
+ bd = list_entry(pos, struct gfs_bufdata, bd_ail_gl_list);
+ gfs_bd_ail_tryremove(sdp, bd);
+ }
+
+ spin_unlock(&sdp->sd_ail_lock);
+}
+
+/**
+ * gfs_inval_buf - Invalidate all buffers associated with a glock
+ * @gl: the glock
*
*/
void
-gfs_log_flush(struct gfs_sbd *sdp)
+gfs_inval_buf(struct gfs_glock *gl)
{
- log_flush_internal(sdp, NULL);
+ struct inode *aspace = gl->gl_aspace;
+ struct address_space *mapping = gl->gl_aspace->i_mapping;
+
+ /*down(&gl->gl_sbd->sd_log_flush_lock);*/
+ ail_empty_gl(gl);
+
+ atomic_inc(&aspace->i_writecount);
+ truncate_inode_pages(mapping, 0);
+ atomic_dec(&aspace->i_writecount);
+
+ gfs_assert_withdraw(gl->gl_sbd, !mapping->nrpages);
+ /*up(&gl->gl_sbd->sd_log_flush_lock);*/
+}
+
+/**
+ * gfs_sync_buf - Sync all buffers associated with a glock
+ * @gl: The glock
+ * @flags: DIO_START | DIO_WAIT | DIO_CHECK
+ *
+ */
+
+static void
+gfs_sync_buf(struct gfs_glock *gl, int flags)
+{
+ struct address_space *mapping = gl->gl_aspace->i_mapping;
+ int error = 0;
+
+ error = filemap_fdatawrite(mapping);
+ if (!error)
+ error = filemap_fdatawait(mapping);
+ if (!error) {
+ if (!(flags & DIO_INVISIBLE))
+ ail_empty_gl(gl);
+ }
+ if (error)
+ gfs_io_error(gl->gl_sbd);
+
}
/**
@@ -1063,9 +1139,20 @@ gfs_log_flush(struct gfs_sbd *sdp)
*/
void
-gfs_log_flush_glock(struct gfs_glock *gl)
+gfs_log_flush_glock(struct gfs_glock *gl, int flags)
{
+ struct gfs_sbd *sdp = gl->gl_sbd;
+
+ down(&sdp->sd_log_flush_lock);
log_flush_internal(gl->gl_sbd, gl);
+ if (flags)
+ gfs_sync_buf(gl, flags | DIO_CHECK);
+ up(&sdp->sd_log_flush_lock);
+
+ /* Dump if we need to. */
+
+ if (test_bit(SDF_NEED_LOG_DUMP, &sdp->sd_flags))
+ gfs_log_dump(sdp, FALSE);
}
/**
diff --git a/gfs-kernel/src/gfs/log.h b/gfs-kernel/src/gfs/log.h
index e66b22b..159ec9f 100644
--- a/gfs-kernel/src/gfs/log.h
+++ b/gfs-kernel/src/gfs/log.h
@@ -50,7 +50,7 @@ int gfs_ail_empty(struct gfs_sbd *sdp);
void gfs_log_commit(struct gfs_sbd *sdp, struct gfs_trans *trans);
void gfs_log_flush(struct gfs_sbd *sdp);
-void gfs_log_flush_glock(struct gfs_glock *gl);
+void gfs_log_flush_glock(struct gfs_glock *gl, int flags);
void gfs_log_shutdown(struct gfs_sbd *sdp);
diff --git a/gfs-kernel/src/gfs/ops_export.c b/gfs-kernel/src/gfs/ops_export.c
index e721c58..262af95 100644
--- a/gfs-kernel/src/gfs/ops_export.c
+++ b/gfs-kernel/src/gfs/ops_export.c
@@ -62,6 +62,9 @@ gfs_decode_fh(struct super_block *sb, __u32 *fh, int fh_len, int fh_type,
atomic_inc(&get_v2sdp(sb)->sd_ops_export);
+ if (fh_type != fh_len)
+ return NULL;
+
memset(&parent, 0, sizeof(struct inode_cookie));
switch (fh_type) {
diff --git a/gfs-kernel/src/gfs/ops_file.c b/gfs-kernel/src/gfs/ops_file.c
index 3d748b6..03fcc73 100644
--- a/gfs-kernel/src/gfs/ops_file.c
+++ b/gfs-kernel/src/gfs/ops_file.c
@@ -604,7 +604,7 @@ do_write_direct_alloc(struct file *file, char *buf, size_t size, loff_t *offset,
* 2. does gfs_log_flush_glock flush data ?
*/
if (file->f_flags & O_SYNC)
- gfs_log_flush_glock(ip->i_gl);
+ gfs_log_flush_glock(ip->i_gl, 0);
gfs_inplace_release(ip);
gfs_quota_unlock_m(ip);
@@ -922,7 +922,7 @@ do_do_write_buf(struct file *file, char *buf, size_t size, loff_t *offset,
gfs_trans_end(sdp);
if (file->f_flags & O_SYNC || IS_SYNC(inode)) {
- gfs_log_flush_glock(ip->i_gl);
+ gfs_log_flush_glock(ip->i_gl, 0);
error = filemap_fdatawrite(file->f_mapping);
if (error == 0)
error = filemap_fdatawait(file->f_mapping);
@@ -1626,7 +1626,7 @@ gfs_fsync(struct file *file, struct dentry *dentry, int datasync)
return error;
if (gfs_is_jdata(ip))
- gfs_log_flush_glock(ip->i_gl);
+ gfs_log_flush_glock(ip->i_gl, 0);
else {
if ((!datasync) || (inode->i_state & I_DIRTY_DATASYNC)) {
struct writeback_control wbc = {
@@ -1636,7 +1636,7 @@ gfs_fsync(struct file *file, struct dentry *dentry, int datasync)
error = sync_inode(inode, &wbc);
}
if (gfs_is_stuffed(ip))
- gfs_log_flush_glock(ip->i_gl);
+ gfs_log_flush_glock(ip->i_gl, 0);
}
gfs_glock_dq_uninit(&i_gh);
diff --git a/gfs-kernel/src/gfs/ops_fstype.c b/gfs-kernel/src/gfs/ops_fstype.c
index 1f5e8a5..34d9fa4 100644
--- a/gfs-kernel/src/gfs/ops_fstype.c
+++ b/gfs-kernel/src/gfs/ops_fstype.c
@@ -94,6 +94,7 @@ static struct gfs_sbd *init_sbd(struct super_block *sb)
INIT_LIST_HEAD(&sdp->sd_log_ail);
INIT_LIST_HEAD(&sdp->sd_log_incore);
init_rwsem(&sdp->sd_log_lock);
+ init_MUTEX(&sdp->sd_log_flush_lock);
INIT_LIST_HEAD(&sdp->sd_unlinked_list);
spin_lock_init(&sdp->sd_unlinked_lock);
INIT_LIST_HEAD(&sdp->sd_quota_list);
@@ -268,8 +269,10 @@ fail_mount:
gfs_glock_dq_uninit(mount_gh);
fail:
- while (sdp->sd_glockd_num--)
+ while (sdp->sd_glockd_num > 0) {
+ sdp->sd_glockd_num--;
kthread_stop(sdp->sd_glockd_process[sdp->sd_glockd_num]);
+ }
kthread_stop(sdp->sd_scand_process);
diff --git a/gfs-kernel/src/gfs/ops_super.c b/gfs-kernel/src/gfs/ops_super.c
index 6c513d2..1838e5d 100644
--- a/gfs-kernel/src/gfs/ops_super.c
+++ b/gfs-kernel/src/gfs/ops_super.c
@@ -56,7 +56,7 @@ gfs_write_inode(struct inode *inode, int sync)
atomic_inc(&ip->i_sbd->sd_ops_super);
if (ip && sync)
- gfs_log_flush_glock(ip->i_gl);
+ gfs_log_flush_glock(ip->i_gl, 0);
return 0;
}
@@ -124,8 +124,10 @@ gfs_put_super(struct super_block *sb)
kthread_stop(sdp->sd_recoverd_process);
/* Kill off the glockd threads */
- while (sdp->sd_glockd_num--)
+ while (sdp->sd_glockd_num > 0) {
+ sdp->sd_glockd_num--;
kthread_stop(sdp->sd_glockd_process[sdp->sd_glockd_num]);
+ }
/* Kill off the scand thread */
kthread_stop(sdp->sd_scand_process);
diff --git a/gfs-kernel/src/gfs/quota.c b/gfs-kernel/src/gfs/quota.c
index 211b416..9e8089e 100644
--- a/gfs-kernel/src/gfs/quota.c
+++ b/gfs-kernel/src/gfs/quota.c
@@ -617,7 +617,7 @@ do_quota_sync(struct gfs_sbd *sdp, struct gfs_quota_data **qda,
kfree(ghs);
- gfs_log_flush_glock(ip->i_gl);
+ gfs_log_flush_glock(ip->i_gl, 0);
return 0;
diff --git a/gfs-kernel/src/gfs/recovery.c b/gfs-kernel/src/gfs/recovery.c
index 9852bd2..401d043 100644
--- a/gfs-kernel/src/gfs/recovery.c
+++ b/gfs-kernel/src/gfs/recovery.c
@@ -24,6 +24,7 @@
#include "glock.h"
#include "glops.h"
#include "lm.h"
+#include "log.h"
#include "lops.h"
#include "recovery.h"
@@ -252,6 +253,7 @@ gfs_find_jhead(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
seg1 = 0;
seg2 = jdesc->ji_nsegment - 1;
+ gfs_log_lock(sdp);
for (;;) {
seg_m = (seg1 + seg2) / 2;
@@ -280,6 +282,7 @@ gfs_find_jhead(struct gfs_sbd *sdp, struct gfs_jindex *jdesc,
seg2 = seg_m;
}
+ gfs_log_unlock(sdp);
return error;
}
diff --git a/gfs-kernel/src/gfs/trans.c b/gfs-kernel/src/gfs/trans.c
index 494571f..e23017e 100644
--- a/gfs-kernel/src/gfs/trans.c
+++ b/gfs-kernel/src/gfs/trans.c
@@ -88,6 +88,9 @@ gfs_trans_begin_i(struct gfs_sbd *sdp,
unsigned int blocks;
int error;
+ if (test_bit(SDF_ROFS, &sdp->sd_flags))
+ return -EROFS;
+
tr = kmalloc(sizeof(struct gfs_trans), GFP_KERNEL);
if (!tr)
return -ENOMEM;
@@ -110,12 +113,6 @@ gfs_trans_begin_i(struct gfs_sbd *sdp,
if (error)
goto fail_holder_put;
- if (test_bit(SDF_ROFS, &sdp->sd_flags)) {
- tr->tr_t_gh->gh_flags |= GL_NOCACHE;
- error = -EROFS;
- goto fail_gunlock;
- }
-
/* Do log reservation */
tr->tr_mblks_asked = meta_blocks;
13 years, 8 months
cluster: RHEL56 - unmount GFS2 filesystem fail when other filesystems are mounted
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 53dba11a565ed574c6433ed8ba8c12c274185911
Parent: f4e6157cb9822895a1372cc02c4e793091a87c6c
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Fri Sep 17 15:49:49 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Sep 17 16:56:25 2010 -0500
unmount GFS2 filesystem fail when other filesystems are mounted
The code that parses /proc/mounts was stopping as soon as it
found the mount point in question, ignoring the fact that another
file system might be mounted there, prior in the list. This
patch makes it go through the entire list until it finds the
proper one.
rhbz#627723
---
gfs2/mount/util.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/gfs2/mount/util.c b/gfs2/mount/util.c
index 2970d33..0213e42 100644
--- a/gfs2/mount/util.c
+++ b/gfs2/mount/util.c
@@ -186,7 +186,7 @@ void read_proc_mounts(struct mount_options *mo)
char save_line[PATH_MAX];
char save_opts[PATH_MAX];
char save_device[PATH_MAX];
- int found = 0;
+ int found = 0, is_correct_type = 0;
struct stat st_mo_dev, st_mounts_dev;
file = fopen("/proc/mounts", "r");
@@ -210,8 +210,9 @@ void read_proc_mounts(struct mount_options *mo)
if (st_mo_dev.st_rdev != st_mounts_dev.st_rdev)
continue;
}
+ found = 1;
if (strcmp(type, fsname))
- die("%s is not a %s filesystem\n", mo->dir, fsname);
+ continue;
/* when there is an input dev specified (mount), we should get
only one matching line; when there is no input dev specified
@@ -220,11 +221,14 @@ void read_proc_mounts(struct mount_options *mo)
strncpy(save_device, device, PATH_MAX);
strncpy(save_opts, opts, PATH_MAX);
strncpy(save_line, line, PATH_MAX);
- found = 1;
+ is_correct_type = 1;
}
fclose(file);
+ if (found && !is_correct_type)
+ die("%s is not a %s filesystem\n", mo->dir, fsname);
+
if (!found)
die("can't find /proc/mounts entry for directory %s\n", mo->dir);
else {
13 years, 8 months
cluster: RHEL56 - fence-agents: Add power_wait to fence_ipmilan
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: f4e6157cb9822895a1372cc02c4e793091a87c6c
Parent: 844adf0401b27d788b9780b933b578f0fdef4740
Author: Christine Caulfield <ccaulfie(a)redhat.com>
AuthorDate: Thu Sep 16 14:23:51 2010 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Fri Sep 17 15:59:53 2010 -0400
fence-agents: Add power_wait to fence_ipmilan
Previous patch used power-wait which was inconsistent with
the rest of the fencing agents. Also, help information
for the new option was missing.
Resolves: rhbz#548575
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Signed-off-by: Shane Bradley <sbradley(a)redhat.com>
---
fence/agents/ipmilan/ipmilan.c | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index 163f0c6..e894e60 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -54,6 +54,7 @@ do { \
#define ST_CYCLE 4
#define DEFAULT_TIMEOUT 20
+#define DEFAULT_POWER_WAIT 2
#define DEFAULT_METHOD "onoff"
@@ -112,6 +113,7 @@ struct ipmi {
int i_verbose;
int i_lanplus;
int i_timeout;
+ int i_power_wait;
int i_cipher;
};
@@ -200,6 +202,7 @@ struct xml_parameter_s xml_parameters[]={
{"timeout","-t",0,"string",NULL,"Timeout (sec) for IPMI operation"},
{"cipher","-C",0,"string",NULL,"Ciphersuite to use (same as ipmitool -C parameter)"},
{"method","-M",0,"string",DEFAULT_METHOD,"Method to fence (onoff or cycle)"},
+ {"power_wait","-T",0,"string","2","Wait X seconds after on/off operation"},
{"delay","-f",0,"string",NULL,"Wait X seconds before fencing is started"},
{"verbose","-v",0,"boolean",NULL,"Verbose mode"}};
@@ -478,7 +481,7 @@ ipmi_off(struct ipmi *ipmi)
if (ret != 0)
return ret;
- sleep(2);
+ sleep(ipmi->i_power_wait);
--retries;
ret = ipmi_op(ipmi, ST_STATUS, power_status);
@@ -583,6 +586,7 @@ ipmi_destroy(struct ipmi *i)
static struct ipmi *
ipmi_init(struct ipmi *i, char *host, char *authtype,
char *user, char *password, int lanplus, int verbose,int timeout,
+ int power_wait,
int cipher)
{
const char *p;
@@ -655,6 +659,7 @@ ipmi_init(struct ipmi *i, char *host, char *authtype,
i->i_verbose = verbose;
i->i_lanplus = lanplus;
i->i_timeout = timeout;
+ i->i_power_wait = power_wait;
i->i_cipher = cipher;
return i;
@@ -941,6 +946,7 @@ get_options_stdin(char *ip, size_t iplen,
char *user, size_t userlen,
char *op, size_t oplen,
int *lanplus, int *verbose,int *timeout,
+ int *power_wait,
int *cipher, char *method, int methodlen,
char *delay, size_t delaylen)
{
@@ -1009,6 +1015,10 @@ get_options_stdin(char *ip, size_t iplen,
if ((sscanf(val,"%d",timeout)!=1) || *timeout<1) {
*timeout=DEFAULT_TIMEOUT;
}
+ } else if (!strcasecmp(name,"power_wait")) {
+ if ((sscanf(val,"%d",power_wait)!=1) || *power_wait<1) {
+ *power_wait=DEFAULT_POWER_WAIT;
+ }
} else if (!strcasecmp(name,"cipher")) {
if ((sscanf(val,"%d",cipher)!=1) || *cipher<0) {
*cipher=-1;
@@ -1060,6 +1070,7 @@ printf(" -l <login> Username/Login (if required) to control power\n"
printf(" -o <op> Operation to perform.\n");
printf(" Valid operations: on, off, reboot, status, list or monitor\n");
printf(" -t <timeout> Timeout (sec) for IPMI operation (default %d)\n",DEFAULT_TIMEOUT);
+printf(" -T <timeout> Wait X seconds after on/off operation\n");
printf(" -f <timeout> Wait X seconds before fencing is started\n");
printf(" -C <cipher> Ciphersuite to use (same as ipmitool -C parameter)\n");
printf(" -M <method> Method to fence (onoff or cycle (default %s)\n", DEFAULT_METHOD);
@@ -1078,6 +1089,7 @@ printf(" operation=<op> Same as -o\n");
printf(" action=<op> Same as -o\n");
printf(" delay=<seconds> Same as -f\n");
printf(" timeout=<timeout> Same as -t\n");
+printf(" power_wait=<time> Same as -T\n");
printf(" cipher=<cipher> Same as -C\n");
printf(" method=<method> Same as -M\n");
printf(" verbose Same as -v\n\n");
@@ -1146,6 +1158,7 @@ main(int argc, char **argv)
char *pname = basename(argv[0]);
struct ipmi *i;
int timeout=DEFAULT_TIMEOUT;
+ int down_sleep=DEFAULT_POWER_WAIT;
int cipher=-1;
int print_final_status=1;
int translated_ret = -1;
@@ -1162,7 +1175,7 @@ main(int argc, char **argv)
/*
Parse command line options if any were specified
*/
- while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:C:M:f:")) != EOF) {
+ while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:T:C:M:f:")) != EOF) {
switch(opt) {
case 'A':
/* Auth type */
@@ -1202,6 +1215,12 @@ main(int argc, char **argv)
fail_exit("Timeout option expects positive number parameter");
}
break;
+ case 'T':
+ /* Shutdown Sleep Time */
+ if ((sscanf(optarg,"%d",&down_sleep)!=1) || down_sleep<1) {
+ fail_exit("Shutdown time option expects positive number parameter");
+ }
+ break;
case 'C':
/* Ciphersuite */
if ((sscanf(optarg,"%d",&cipher)!=1) || cipher<0) {
@@ -1236,6 +1255,7 @@ main(int argc, char **argv)
pwd_script, sizeof(pwd_script),
user, sizeof(user),
op, sizeof(op), &lanplus, &verbose,&timeout,
+ &down_sleep,
&cipher, method, sizeof(method),
delay, sizeof(delay)) != 0)
return 1;
@@ -1316,7 +1336,7 @@ main(int argc, char **argv)
}
/* Ok, set up the IPMI struct */
- i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose, timeout, cipher);
+ i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose, timeout, down_sleep, cipher);
if (!i)
fail_exit("Failed to initialize\n");
13 years, 8 months
cluster: RHEL56 - Revert "fence-agents: Add power-wait to fence_ipmilan"
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 844adf0401b27d788b9780b933b578f0fdef4740
Parent: 6f1e7d39673a0c8d145d923204f7daa4dd56a0aa
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Fri Sep 17 15:42:01 2010 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Fri Sep 17 15:46:21 2010 -0400
Revert "fence-agents: Add power-wait to fence_ipmilan"
Patch is inconsistent with other fencing agents.
This reverts commit 18d6d10d0ba6f939b22e65978f0c85233dba1fa1.
---
fence/agents/ipmilan/ipmilan.c | 24 +++---------------------
1 files changed, 3 insertions(+), 21 deletions(-)
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
index 016a0fb..163f0c6 100644
--- a/fence/agents/ipmilan/ipmilan.c
+++ b/fence/agents/ipmilan/ipmilan.c
@@ -54,7 +54,6 @@ do { \
#define ST_CYCLE 4
#define DEFAULT_TIMEOUT 20
-#define DEFAULT_POWER_WAIT 2
#define DEFAULT_METHOD "onoff"
@@ -113,7 +112,6 @@ struct ipmi {
int i_verbose;
int i_lanplus;
int i_timeout;
- int i_power_wait;
int i_cipher;
};
@@ -480,7 +478,7 @@ ipmi_off(struct ipmi *ipmi)
if (ret != 0)
return ret;
- sleep(ipmi->i_power_wait);
+ sleep(2);
--retries;
ret = ipmi_op(ipmi, ST_STATUS, power_status);
@@ -585,7 +583,6 @@ ipmi_destroy(struct ipmi *i)
static struct ipmi *
ipmi_init(struct ipmi *i, char *host, char *authtype,
char *user, char *password, int lanplus, int verbose,int timeout,
- int power_wait,
int cipher)
{
const char *p;
@@ -658,7 +655,6 @@ ipmi_init(struct ipmi *i, char *host, char *authtype,
i->i_verbose = verbose;
i->i_lanplus = lanplus;
i->i_timeout = timeout;
- i->i_power_wait = power_wait;
i->i_cipher = cipher;
return i;
@@ -945,7 +941,6 @@ get_options_stdin(char *ip, size_t iplen,
char *user, size_t userlen,
char *op, size_t oplen,
int *lanplus, int *verbose,int *timeout,
- int *power_wait,
int *cipher, char *method, int methodlen,
char *delay, size_t delaylen)
{
@@ -1014,10 +1009,6 @@ get_options_stdin(char *ip, size_t iplen,
if ((sscanf(val,"%d",timeout)!=1) || *timeout<1) {
*timeout=DEFAULT_TIMEOUT;
}
- } else if (!strcasecmp(name,"power-wait")) {
- if ((sscanf(val,"%d",power_wait)!=1) || *power_wait<1) {
- *power_wait=DEFAULT_POWER_WAIT;
- }
} else if (!strcasecmp(name,"cipher")) {
if ((sscanf(val,"%d",cipher)!=1) || *cipher<0) {
*cipher=-1;
@@ -1087,7 +1078,6 @@ printf(" operation=<op> Same as -o\n");
printf(" action=<op> Same as -o\n");
printf(" delay=<seconds> Same as -f\n");
printf(" timeout=<timeout> Same as -t\n");
-printf(" power-wait=<time> Same as -T\n");
printf(" cipher=<cipher> Same as -C\n");
printf(" method=<method> Same as -M\n");
printf(" verbose Same as -v\n\n");
@@ -1156,7 +1146,6 @@ main(int argc, char **argv)
char *pname = basename(argv[0]);
struct ipmi *i;
int timeout=DEFAULT_TIMEOUT;
- int down_sleep=DEFAULT_POWER_WAIT;
int cipher=-1;
int print_final_status=1;
int translated_ret = -1;
@@ -1173,7 +1162,7 @@ main(int argc, char **argv)
/*
Parse command line options if any were specified
*/
- while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:T:C:M:f:")) != EOF) {
+ while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:C:M:f:")) != EOF) {
switch(opt) {
case 'A':
/* Auth type */
@@ -1213,12 +1202,6 @@ main(int argc, char **argv)
fail_exit("Timeout option expects positive number parameter");
}
break;
- case 'T':
- /* Shutdown Sleep Time */
- if ((sscanf(optarg,"%d",&down_sleep)!=1) || down_sleep<1) {
- fail_exit("Shutdown time option expects positive number parameter");
- }
- break;
case 'C':
/* Ciphersuite */
if ((sscanf(optarg,"%d",&cipher)!=1) || cipher<0) {
@@ -1253,7 +1236,6 @@ main(int argc, char **argv)
pwd_script, sizeof(pwd_script),
user, sizeof(user),
op, sizeof(op), &lanplus, &verbose,&timeout,
- &down_sleep,
&cipher, method, sizeof(method),
delay, sizeof(delay)) != 0)
return 1;
@@ -1334,7 +1316,7 @@ main(int argc, char **argv)
}
/* Ok, set up the IPMI struct */
- i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose, timeout, down_sleep, cipher);
+ i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose, timeout, cipher);
if (!i)
fail_exit("Failed to initialize\n");
13 years, 8 months