[Cluster-devel] [PATCH 5/5] GFS2: Check for glock already held in gfs2_getxattr
Since the introduction of atomic_open, gfs2_getxattr can be called with the glock already held, so we need to allow for this. Signed-off-by: Steven Whitehouse swhit...@redhat.com Reported-by: David Teigland teigl...@redhat.com Tested-by: David Teigland teigl...@redhat.com diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index a01b8fd..64915ee 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -1750,6 +1750,10 @@ static ssize_t gfs2_getxattr(struct dentry *dentry, const char *name, struct gfs2_holder gh; int ret; + /* For selinux during lookup */ + if (gfs2_glock_is_locked_by_me(ip-i_gl)) + return generic_getxattr(dentry, name, data, size); + gfs2_holder_init(ip-i_gl, LM_ST_SHARED, LM_FLAG_ANY, gh); ret = gfs2_glock_nq(gh); if (ret == 0) { -- 1.7.4
[Cluster-devel] GFS2: Pre-pull patch posting (fixes)
Hi, Out of these fives patches, the one for ensuring that the number of revokes is not exceeded, and the one for checking the glock is not already held in gfs2_getxattr are the two most important. The latter can be triggered by selinux. The other three patches are very small and fix mostly fairly trivial issues, Steve.
[Cluster-devel] [PATCH 2/5] GFS2: WQ_NON_REENTRANT is meaningless and going away
From: Tejun Heo t...@kernel.org dbf2576e37 (workqueue: make all workqueues non-reentrant) made WQ_NON_REENTRANT no-op and the flag is going away. Remove its usages. This patch doesn't introduce any behavior changes. Signed-off-by: Tejun Heo t...@kernel.org Signed-off-by: Steven Whitehouse swhit...@redhat.com Cc: cluster-devel@redhat.com diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index e04d0e0..7b0f504 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c @@ -155,7 +155,7 @@ static int __init init_gfs2_fs(void) goto fail_wq; gfs2_control_wq = alloc_workqueue(gfs2_control, - WQ_NON_REENTRANT | WQ_UNBOUND | WQ_FREEZABLE, 0); + WQ_UNBOUND | WQ_FREEZABLE, 0); if (!gfs2_control_wq) goto fail_recovery; -- 1.7.4
[Cluster-devel] [PATCH 4/5] GFS2: alloc_workqueue() doesn't return an ERR_PTR
From: Dan Carpenter dan.carpen...@oracle.com alloc_workqueue() returns a NULL on error, it doesn't return an ERR_PTR. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com Signed-off-by: Steven Whitehouse swhit...@redhat.com diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 9435384..544a809 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -1838,14 +1838,14 @@ int __init gfs2_glock_init(void) glock_workqueue = alloc_workqueue(glock_workqueue, WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_FREEZABLE, 0); - if (IS_ERR(glock_workqueue)) - return PTR_ERR(glock_workqueue); + if (!glock_workqueue) + return -ENOMEM; gfs2_delete_workqueue = alloc_workqueue(delete_workqueue, WQ_MEM_RECLAIM | WQ_FREEZABLE, 0); - if (IS_ERR(gfs2_delete_workqueue)) { + if (!gfs2_delete_workqueue) { destroy_workqueue(glock_workqueue); - return PTR_ERR(gfs2_delete_workqueue); + return -ENOMEM; } register_shrinker(glock_shrinker); -- 1.7.4
[Cluster-devel] [PATCH 3/5] GFS2: don't overrun reserved revokes
From: Benjamin Marzinski bmarz...@redhat.com When run during fsync, a gfs2_log_flush could happen between the time when gfs2_ail_flush checked the number of blocks to revoke, and when it actually started the transaction to do those revokes. This occassionally caused it to need more revokes than it reserved, causing gfs2 to crash. Instead of just reserving enough revokes to handle the blocks that currently need them, this patch makes gfs2_ail_flush reserve the maximum number of revokes it can, without increasing the total number of reserved log blocks. This patch also passes the number of reserved revokes to __gfs2_ail_flush() so that it doesn't go over its limit and cause a crash like we're seeing. Non-fsync calls to __gfs2_ail_flush will still cause a BUG() necessary revokes are skipped. Signed-off-by: Benjamin Marzinski bmarz...@redhat.com Signed-off-by: Steven Whitehouse swhit...@redhat.com diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 5f2e522..e2e0a90 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -47,7 +47,8 @@ static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh) * None of the buffers should be dirty, locked, or pinned. */ -static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) +static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync, +unsigned int nr_revokes) { struct gfs2_sbd *sdp = gl-gl_sbd; struct list_head *head = gl-gl_ail_list; @@ -57,7 +58,9 @@ static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) gfs2_log_lock(sdp); spin_lock(sdp-sd_ail_lock); - list_for_each_entry_safe(bd, tmp, head, bd_ail_gl_list) { + list_for_each_entry_safe_reverse(bd, tmp, head, bd_ail_gl_list) { + if (nr_revokes == 0) + break; bh = bd-bd_bh; if (bh-b_state b_state) { if (fsync) @@ -65,6 +68,7 @@ static void __gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) gfs2_ail_error(gl, bh); } gfs2_trans_add_revoke(sdp, bd); + nr_revokes--; } GLOCK_BUG_ON(gl, !fsync atomic_read(gl-gl_ail_count)); spin_unlock(sdp-sd_ail_lock); @@ -91,7 +95,7 @@ static void gfs2_ail_empty_gl(struct gfs2_glock *gl) WARN_ON_ONCE(current-journal_info); current-journal_info = tr; - __gfs2_ail_flush(gl, 0); + __gfs2_ail_flush(gl, 0, tr.tr_revokes); gfs2_trans_end(sdp); gfs2_log_flush(sdp, NULL); @@ -101,15 +105,19 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync) { struct gfs2_sbd *sdp = gl-gl_sbd; unsigned int revokes = atomic_read(gl-gl_ail_count); + unsigned int max_revokes = (sdp-sd_sb.sb_bsize - sizeof(struct gfs2_log_descriptor)) / sizeof(u64); int ret; if (!revokes) return; - ret = gfs2_trans_begin(sdp, 0, revokes); + while (revokes max_revokes) + max_revokes += (sdp-sd_sb.sb_bsize - sizeof(struct gfs2_meta_header)) / sizeof(u64); + + ret = gfs2_trans_begin(sdp, 0, max_revokes); if (ret) return; - __gfs2_ail_flush(gl, fsync); + __gfs2_ail_flush(gl, fsync, max_revokes); gfs2_trans_end(sdp); gfs2_log_flush(sdp, NULL); } -- 1.7.4
[Cluster-devel] GFS2: Pull request (fixes)
Hi, Please consider pulling the following changes, Steve. - Out of these five patches, the one for ensuring that the number of revokes is not exceeded, and the one for checking the glock is not already held in gfs2_getxattr are the two most important. The latter can be triggered by selinux. The other three patches are very small and fix mostly fairly trivial issues. -- The following changes since commit 47188d39b5deeebf41f87a02af1b3935866364cf: Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 (2013-07-14 21:47:51 -0700) are available in the git repository at: https://git.kernel.org/cgit/linux/kernel/git/steve/gfs2-3.0-fixes.git master Benjamin Marzinski (1): GFS2: don't overrun reserved revokes Dan Carpenter (1): GFS2: alloc_workqueue() doesn't return an ERR_PTR Steven Whitehouse (2): GFS2: Fix typo in gfs2_create_inode() GFS2: Check for glock already held in gfs2_getxattr Tejun Heo (1): GFS2: WQ_NON_REENTRANT is meaningless and going away fs/gfs2/glock.c |8 fs/gfs2/glops.c | 18 +- fs/gfs2/inode.c |6 +- fs/gfs2/main.c |2 +- 4 files changed, 23 insertions(+), 11 deletions(-)
[Cluster-devel] GFS2: Pull request (fixes)
Oops, forgot to sign this when I sent it first, so here is a signed copy of it. Hi, Please consider pulling the following changes, Steve. - Out of these five patches, the one for ensuring that the number of revokes is not exceeded, and the one for checking the glock is not already held in gfs2_getxattr are the two most important. The latter can be triggered by selinux. The other three patches are very small and fix mostly fairly trivial issues. -- The following changes since commit 47188d39b5deeebf41f87a02af1b3935866364cf: Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 (2013-07-14 21:47:51 -0700) are available in the git repository at: https://git.kernel.org/cgit/linux/kernel/git/steve/gfs2-3.0-fixes.git master Benjamin Marzinski (1): GFS2: don't overrun reserved revokes Dan Carpenter (1): GFS2: alloc_workqueue() doesn't return an ERR_PTR Steven Whitehouse (2): GFS2: Fix typo in gfs2_create_inode() GFS2: Check for glock already held in gfs2_getxattr Tejun Heo (1): GFS2: WQ_NON_REENTRANT is meaningless and going away fs/gfs2/glock.c |8 fs/gfs2/glops.c | 18 +- fs/gfs2/inode.c |6 +- fs/gfs2/main.c |2 +- 4 files changed, 23 insertions(+), 11 deletions(-) signature.asc Description: This is a digitally signed message part
[Cluster-devel] [Patch net-next v3 7/9] fs: use generic union inet_addr and helper functions
From: Cong Wang amw...@redhat.com nfs and cifs define some helper functions for sockaddr, they can use the generic functions for union inet_addr/struct sockaddr too. Since some dlm code needs to compare -sin_port, introduce a generic function inet_addr_equal_strict() for it. Cc: Steve French sfre...@samba.org Cc: Christine Caulfield ccaul...@redhat.com Cc: David Teigland teigl...@redhat.com Cc: Trond Myklebust trond.mykleb...@netapp.com Cc: linux-c...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: cluster-devel@redhat.com Cc: linux-...@vger.kernel.org Signed-off-by: Cong Wang amw...@redhat.com --- fs/cifs/connect.c | 54 +--- fs/dlm/lowcomms.c | 24 ++--- fs/nfs/client.c| 113 +--- fs/nfs/nfs4client.c|2 +- fs/nfs/nfs4filelayoutdev.c | 37 ++- fs/nfs/super.c | 31 +--- include/net/inet_addr.h|8 +++ net/core/utils.c | 23 + 8 files changed, 60 insertions(+), 232 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index d67c550..081cb6c 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -40,6 +40,7 @@ #include linux/module.h #include keys/user-type.h #include net/ipv6.h +#include net/inet_addr.h #include linux/parser.h #include cifspdu.h @@ -1900,17 +1901,9 @@ srcip_matches(struct sockaddr *srcaddr, struct sockaddr *rhs) { switch (srcaddr-sa_family) { case AF_UNSPEC: - return (rhs-sa_family == AF_UNSPEC); - case AF_INET: { - struct sockaddr_in *saddr4 = (struct sockaddr_in *)srcaddr; - struct sockaddr_in *vaddr4 = (struct sockaddr_in *)rhs; - return (saddr4-sin_addr.s_addr == vaddr4-sin_addr.s_addr); - } - case AF_INET6: { - struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)srcaddr; - struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)rhs; - return ipv6_addr_equal(saddr6-sin6_addr, vaddr6-sin6_addr); - } + case AF_INET: + case AF_INET6: + return sockaddr_equal(srcaddr, rhs); default: WARN_ON(1); return false; /* don't expect to be here */ @@ -1925,16 +1918,13 @@ srcip_matches(struct sockaddr *srcaddr, struct sockaddr *rhs) static bool match_port(struct TCP_Server_Info *server, struct sockaddr *addr) { - __be16 port, *sport; + unsigned short port, sport; switch (addr-sa_family) { case AF_INET: - sport = ((struct sockaddr_in *) server-dstaddr)-sin_port; - port = ((struct sockaddr_in *) addr)-sin_port; - break; case AF_INET6: - sport = ((struct sockaddr_in6 *) server-dstaddr)-sin6_port; - port = ((struct sockaddr_in6 *) addr)-sin6_port; + sport = sockaddr_get_port((struct sockaddr *)server-dstaddr); + port = sockaddr_get_port(addr); break; default: WARN_ON(1); @@ -1942,14 +1932,14 @@ match_port(struct TCP_Server_Info *server, struct sockaddr *addr) } if (!port) { - port = htons(CIFS_PORT); - if (port == *sport) + port = CIFS_PORT; + if (port == sport) return true; - port = htons(RFC1001_PORT); + port = RFC1001_PORT; } - return port == *sport; + return port == sport; } static bool @@ -1957,27 +1947,11 @@ match_address(struct TCP_Server_Info *server, struct sockaddr *addr, struct sockaddr *srcaddr) { switch (addr-sa_family) { - case AF_INET: { - struct sockaddr_in *addr4 = (struct sockaddr_in *)addr; - struct sockaddr_in *srv_addr4 = - (struct sockaddr_in *)server-dstaddr; - - if (addr4-sin_addr.s_addr != srv_addr4-sin_addr.s_addr) - return false; - break; - } - case AF_INET6: { - struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr; - struct sockaddr_in6 *srv_addr6 = - (struct sockaddr_in6 *)server-dstaddr; - - if (!ipv6_addr_equal(addr6-sin6_addr, -srv_addr6-sin6_addr)) - return false; - if (addr6-sin6_scope_id != srv_addr6-sin6_scope_id) + case AF_INET: + case AF_INET6: + if (!sockaddr_equal(addr, (struct sockaddr *)server-dstaddr)) return false; break; - } default: WARN_ON(1); return false; /* don't expect to be here */ diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index d90909e..c051237 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@
[Cluster-devel] [PATCH] gfs2-utils tests: Switch to autotest
Replaces the custom tool_tests.sh test harness with the Autotest framework provided by Autoconf. See doc/README.tests for details. This is just a straight rework of the existing tests as Autotest test groups. Signed-off-by: Andrew Price anpr...@redhat.com --- .gitignore | 8 - configure.ac| 2 ++ doc/README.tests| 42 tests/Makefile.am | 71 +--- tests/atlocal.in| 7 tests/libgfs2.at| 5 +++ tests/mkfs.at | 64 tests/testsuite.at | 16 + tests/tool_tests.sh | 94 - 9 files changed, 203 insertions(+), 106 deletions(-) create mode 100644 doc/README.tests create mode 100644 tests/atlocal.in create mode 100644 tests/libgfs2.at create mode 100644 tests/mkfs.at create mode 100644 tests/testsuite.at delete mode 100755 tests/tool_tests.sh diff --git a/.gitignore b/.gitignore index 26d89d0..ae72f2b 100644 --- a/.gitignore +++ b/.gitignore @@ -44,7 +44,13 @@ gfs2/tune/tunegfs2 test-driver tests/check_libgfs2 tests/testvol -tests/tests.log +tests/testsuite.log +tests/testsuite.dir +tests/testsuite.trs +tests/atconfig +tests/atlocal +tests/package.m4 +tests/testsuite ABOUT-NLS po/Makevars.template po/POTFILES diff --git a/configure.ac b/configure.ac index 911dd88..628d85e 100644 --- a/configure.ac +++ b/configure.ac @@ -203,6 +203,7 @@ CPPFLAGS=-I\$(top_builddir)/make -I\$(top_srcdir)/make \ -I. $ENV_CPPFLAGS LDFLAGS=$ENV_LDFLAGS +AC_CONFIG_TESTDIR([tests], [gfs2/libgfs2:gfs2/mkfs:gfs2/fsck:gfs2/edit:gfs2/convert:gfs2/tune:tests]) AC_CONFIG_FILES([Makefile gfs2/Makefile gfs2/include/Makefile @@ -216,6 +217,7 @@ AC_CONFIG_FILES([Makefile gfs2/scripts/Makefile doc/Makefile tests/Makefile +tests/atlocal po/Makefile.in ]) diff --git a/doc/README.tests b/doc/README.tests new file mode 100644 index 000..fa35803 --- /dev/null +++ b/doc/README.tests @@ -0,0 +1,42 @@ +Working with the gfs2-utils test suite +-- + +The test suite in the tests directory of the gfs2-utils source tree is based on +the Autotest framework provided by Autoconf. The basic idea is that the +testsuite.at file is the main source file for the tests, written in m4 and +generating a bourne shell script called testsuite. + +When run, either using 'make check' or directly from within the tests +directory, the testsuite script sources atconfig and atlocal for configuration +and then runs the whole testsuite or a specified set of tests (see ./testsuite +-h for help). + +A number of GFS2-specific convenience macros have been defined in testsuite.at +to make defining new tests quick and easy. Also, some variables have been +defined in atlocal.in so that full paths to programs do not have to be included +in each test. Configuration should be specified in atlocal.in as atconfig is +generated by the configure script and atlocal is generated from atlocal.in at +build time. + +To keep the test suite organised, the testsuite.at file sources the actual +tests from other files, e.g. mkfs.at. + +A single test, specified as a test group in Autotest terms, follows the form + +AT_SETUP([Test title]) +...test goes here... +AT_CLEANUP + +so, when adding tests, this is generally all that is required unless the tests +do not fit into an existing category, in which case AT_BANNER can be used to +group them, and they can be organised into a new .at file and sourced from +testsuite.at. + +Since the tests can be run individually (e.g. ./testsuite 15) any new tests +which require the dummy volume $GFS_TGT to be present should call GFS_TGT_REGEN +before attempting to use it. + +Documentation for Autotest, including the AT_* macros used to define tests, can +be found in the autoconf manual at: + +http://www.gnu.org/software/autoconf/manual/index.html diff --git a/tests/Makefile.am b/tests/Makefile.am index af01c49..3336304 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,15 +1,64 @@ -TESTS_ENVIRONMENT = TOPBUILDDIR=$(top_builddir) -EXTRA_DIST = tool_tests.sh -CLEANFILES = tests.log +EXTRA_DIST = $(TESTSUITE_AT) package.m4 $(TESTSUITE) atlocal atconfig +DISTCLEANFILES = atlocal atconfig +CLEANFILES = testvol if BUILD_TESTS -check_PROGRAMS = check_libgfs2 -check_libgfs2_SOURCES = check_meta.c \ - $(top_srcdir)/gfs2/libgfs2/libgfs2.h -check_libgfs2_CFLAGS = -I$(top_srcdir)/gfs2/libgfs2 \ - -I$(top_srcdir)/gfs2/include \ - @check_CFLAGS@ -check_libgfs2_LDADD= $(top_builddir)/gfs2/libgfs2/libgfs2.la @check_LIBS@ +check_PROGRAMS = check_libgfs2 + +check_libgfs2_SOURCES = \ + check_meta.c \ +
[Cluster-devel] [PATCH] gfs2_lockcapture: Fixed rhbz#987019, modified option -o, added private option -R, removed lsof data capture.
From: Shane Bradley sbrad...@redhat.com Fix the header to use absolute path for rhbz#987019. The -o has been modified so that it takes a path that will be used to create the root directory of where the data will be written and will be location of the tarball that is created. Added undocumented(private) -R option that will only capture required data. Removed the data capture of the command lsof cause it might cause hangs when capturing lockdumps cause of symlink lookup. Signed-off-by: Shane Bradley sbrad...@redhat.com --- gfs2/scripts/gfs2_lockcapture | 181 +++-- 1 files changed, 101 insertions(+), 80 deletions(-) diff --git a/gfs2/scripts/gfs2_lockcapture b/gfs2/scripts/gfs2_lockcapture index 81a0aeb..f8ace76 100644 --- a/gfs2/scripts/gfs2_lockcapture +++ b/gfs2/scripts/gfs2_lockcapture @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python The script gfs2_lockcapture will capture locking information from GFS2 file systems and DLM. @@ -13,7 +13,7 @@ import os import os.path import logging import logging.handlers -from optparse import OptionParser, Option +from optparse import OptionParser, Option, SUPPRESS_HELP import time import platform import shutil @@ -34,7 +34,7 @@ import tarfile sure only 1 instance of this script is running at any time. @type PATH_TO_PID_FILENAME: String -VERSION_NUMBER = 0.9-7 +VERSION_NUMBER = 0.9-8 MAIN_LOGGER_NAME = %s %(os.path.basename(sys.argv[0])) PATH_TO_DEBUG_DIR=/sys/kernel/debug PATH_TO_PID_FILENAME = /var/run/%s.pid %(os.path.basename(sys.argv[0])) @@ -190,12 +190,11 @@ def runCommand(command, listOfCommandOptions, standardOut=subprocess.PIPE, stand commandOptionString = for option in listOfCommandOptions: commandOptionString += %s %(option) -message = An error occurred running the command: $ %s %s\n %(command, commandOptionString) -if (len(stdout) 0): -message += stdout -message += \n -if (len(stderr) 0): -message += stderr +message = An error occurred running the command: $ %s %s %(command, commandOptionString) +if (len(stdout.rstrip()) 0): +message += \n%s %(stdout.rstrip()) +if (len(stderr.rstrip()) 0): +message += \n%s %(stderr.rstrip()) logging.getLogger(MAIN_LOGGER_NAME).error(message) return False @@ -232,12 +231,11 @@ def runCommandOutput(command, listOfCommandOptions, standardOut=subprocess.PIPE, commandOptionString = for option in listOfCommandOptions: commandOptionString += %s %(option) -message = An error occurred running the command: $ %s %s\n %(command, commandOptionString) -if (len(stdout) 0): -message += stdout -message += \n -if (len(stderr) 0): -message += stderr +message = An error occurred running the command: $ %s %s %(command, commandOptionString) +if (len(stdout.rstrip()) 0): +message += \n%s %(stdout.rstrip()) +if (len(stderr.rstrip()) 0): +message += \n%s %(stderr.rstrip()) logging.getLogger(MAIN_LOGGER_NAME).error(message) return None return stdout.strip().rstrip() @@ -790,12 +788,11 @@ def getLabelMapForMountedFilesystems(clusterName, listOfMountedFilesystems): # # # Gather output from command functions # # -def gatherGeneralInformation(pathToDSTDir): +def gatherHostData(pathToDSTDir): This function will gather general information about the cluster and write the results to a file. The following data will be captured: hostname, date, -uname -a, uptime, contents of /proc/mounts, and ps h -AL -o tid,s,cmd. - +uname -a, uptime. @param pathToDSTDir: This is the path to directory where the files will be written to. @@ -811,19 +808,16 @@ def gatherGeneralInformation(pathToDSTDir): systemString += UPTIME=%s %(stdout) writeToFile(os.path.join(pathToDSTDir, hostinformation.txt), systemString, createFile=True) -# Copy misc files -pathToSrcFile = /proc/mounts -copyFile(pathToSrcFile, os.path.join(pathToDSTDir, pathToSrcFile.strip(/))) -pathToSrcFile = /proc/slabinfo -copyFile(pathToSrcFile, os.path.join(pathToDSTDir, pathToSrcFile.strip(/))) +def gatherDiagnosticData(pathToDSTDir): + +This function will gather general information about the cluster and write (or +copy) the results to a file. -# Copy the DLM hash table sizes: -pathToHashTableFiles = [/sys/kernel/config/dlm/cluster/lkbtbl_size, /sys/kernel/config/dlm/cluster/dirtbl_size, -/sys/kernel/config/dlm/cluster/rsbtbl_size] -for pathToSrcFile in pathToHashTableFiles: -if (os.path.exists(pathToSrcFile)): -copyFile(pathToSrcFile,
Re: [Cluster-devel] [Patch net-next v3 7/9] fs: use generic union inet_addr and helper functions
@@ -1900,17 +1901,9 @@ srcip_matches(struct sockaddr *srcaddr, struct sockaddr *rhs) { I think your new sockaddr_equal should be equivalent to to this srcip_matches, that is it should warn about and return false for unknown address families.
Re: [Cluster-devel] [PATCH] gfs2_lockcapture: Fixed rhbz#987019, modified option -o, added private option -R, removed lsof data capture.
Hi Shane, The shortlog is far too long and references a bz#. Good shortlogs and commit logs are discussed in doc/README.contributing so please read that. On 19/08/13 15:10, sbrad...@redhat.com wrote: From: Shane Bradley sbrad...@redhat.com Fix the header to use absolute path for rhbz#987019. The -o has been modified so that it takes a path that will be used to create the root directory of where the data will be written and will be location of the tarball that is created. Added undocumented(private) -R option that will only capture required The patch seems to make the -P option undocumented too. Why do they have to be undocumented/private? Also, you've referenced -R in several places but the patch only adds an -m option...? Andy data. Removed the data capture of the command lsof cause it might cause hangs when capturing lockdumps cause of symlink lookup. Signed-off-by: Shane Bradley sbrad...@redhat.com --- gfs2/scripts/gfs2_lockcapture | 181 +++-- 1 files changed, 101 insertions(+), 80 deletions(-) diff --git a/gfs2/scripts/gfs2_lockcapture b/gfs2/scripts/gfs2_lockcapture index 81a0aeb..f8ace76 100644 --- a/gfs2/scripts/gfs2_lockcapture +++ b/gfs2/scripts/gfs2_lockcapture @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/python The script gfs2_lockcapture will capture locking information from GFS2 file systems and DLM. @@ -13,7 +13,7 @@ import os import os.path import logging import logging.handlers -from optparse import OptionParser, Option +from optparse import OptionParser, Option, SUPPRESS_HELP import time import platform import shutil @@ -34,7 +34,7 @@ import tarfile sure only 1 instance of this script is running at any time. @type PATH_TO_PID_FILENAME: String -VERSION_NUMBER = 0.9-7 +VERSION_NUMBER = 0.9-8 MAIN_LOGGER_NAME = %s %(os.path.basename(sys.argv[0])) PATH_TO_DEBUG_DIR=/sys/kernel/debug PATH_TO_PID_FILENAME = /var/run/%s.pid %(os.path.basename(sys.argv[0])) @@ -190,12 +190,11 @@ def runCommand(command, listOfCommandOptions, standardOut=subprocess.PIPE, stand commandOptionString = for option in listOfCommandOptions: commandOptionString += %s %(option) -message = An error occurred running the command: $ %s %s\n %(command, commandOptionString) -if (len(stdout) 0): -message += stdout -message += \n -if (len(stderr) 0): -message += stderr +message = An error occurred running the command: $ %s %s %(command, commandOptionString) +if (len(stdout.rstrip()) 0): +message += \n%s %(stdout.rstrip()) +if (len(stderr.rstrip()) 0): +message += \n%s %(stderr.rstrip()) logging.getLogger(MAIN_LOGGER_NAME).error(message) return False @@ -232,12 +231,11 @@ def runCommandOutput(command, listOfCommandOptions, standardOut=subprocess.PIPE, commandOptionString = for option in listOfCommandOptions: commandOptionString += %s %(option) -message = An error occurred running the command: $ %s %s\n %(command, commandOptionString) -if (len(stdout) 0): -message += stdout -message += \n -if (len(stderr) 0): -message += stderr +message = An error occurred running the command: $ %s %s %(command, commandOptionString) +if (len(stdout.rstrip()) 0): +message += \n%s %(stdout.rstrip()) +if (len(stderr.rstrip()) 0): +message += \n%s %(stderr.rstrip()) logging.getLogger(MAIN_LOGGER_NAME).error(message) return None return stdout.strip().rstrip() @@ -790,12 +788,11 @@ def getLabelMapForMountedFilesystems(clusterName, listOfMountedFilesystems): # # # Gather output from command functions # # -def gatherGeneralInformation(pathToDSTDir): +def gatherHostData(pathToDSTDir): This function will gather general information about the cluster and write the results to a file. The following data will be captured: hostname, date, -uname -a, uptime, contents of /proc/mounts, and ps h -AL -o tid,s,cmd. - +uname -a, uptime. @param pathToDSTDir: This is the path to directory where the files will be written to. @@ -811,19 +808,16 @@ def gatherGeneralInformation(pathToDSTDir): systemString += UPTIME=%s %(stdout) writeToFile(os.path.join(pathToDSTDir, hostinformation.txt), systemString, createFile=True) -# Copy misc files -pathToSrcFile = /proc/mounts -copyFile(pathToSrcFile, os.path.join(pathToDSTDir, pathToSrcFile.strip(/))) -pathToSrcFile = /proc/slabinfo -copyFile(pathToSrcFile, os.path.join(pathToDSTDir, pathToSrcFile.strip(/))) +def gatherDiagnosticData(pathToDSTDir): + +This function will gather general
[Cluster-devel] [PATCH] fsck.gfs2: Allocate enough space for the block map
Building with gcc 4.8's address sanitizer and running the test suite throws up an issue where the block map allocated in fsck.gfs2 is not large enough when the required size is an odd number. For example, when the number of blocks is 3, the mapsize (number of chars to allocate memory for) would be (3 1) which is too small as each block requires 4 bits. This patch adds 1 to the mapsize, as suggested in an existing comment, to ensure we have enough space in these situations. Note that this has (probably) never made fsck.gfs2 misbehave as it only ever accessed 4 bits past the end of the block map and by chance that memory was never being modified by anything else in the rare cases in which it was used. Resolves: bz#947384 Signed-off-by: Andrew Price anpr...@redhat.com --- gfs2/fsck/util.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c index 408d89a..3e3050f 100644 --- a/gfs2/fsck/util.c +++ b/gfs2/fsck/util.c @@ -534,15 +534,10 @@ static int gfs2_blockmap_create(struct gfs2_bmap *bmap, uint64_t size) /* Have to add 1 to BLOCKMAP_SIZE since it's 0-based and mallocs * must be 1-based */ - bmap-mapsize = BLOCKMAP_SIZE4(size); + bmap-mapsize = BLOCKMAP_SIZE4(size) + 1; - if (!(bmap-map = malloc(sizeof(char) * bmap-mapsize))) + if (!(bmap-map = calloc(bmap-mapsize, sizeof(char return -ENOMEM; - if (!memset(bmap-map, 0, sizeof(char) * bmap-mapsize)) { - free(bmap-map); - bmap-map = NULL; - return -ENOMEM; - } return 0; } -- 1.8.3.1
[Cluster-devel] [PATCH] libgfs2: Move the BLOCKMAP_* macros into fsck.gfs2
These macros were only being used by fsck.gfs2 so they can safely be moved into gfs2/fsck/util.h Signed-off-by: Andrew Price anpr...@redhat.com --- gfs2/fsck/util.h | 4 gfs2/libgfs2/libgfs2.h | 4 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h index 580acd8..276c726 100644 --- a/gfs2/fsck/util.h +++ b/gfs2/fsck/util.h @@ -23,6 +23,10 @@ extern void dup_listent_delete(struct duptree *dt, struct inode_with_dups *id); extern const char *reftypes[ref_types + 1]; +#define BLOCKMAP_SIZE4(size) ((size) 1) +#define BLOCKMAP_BYTE_OFFSET4(x) (((x) 0x0001) 2) +#define BLOCKMAP_MASK4 (0xf) + static inline uint8_t block_type(uint64_t bblock) { static unsigned char *byte; diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h index dd7420b..1548cf3 100644 --- a/gfs2/libgfs2/libgfs2.h +++ b/gfs2/libgfs2/libgfs2.h @@ -68,10 +68,6 @@ __BEGIN_DECLS #endif /* __BYTE_ORDER == __LITTLE_ENDIAN */ -#define BLOCKMAP_SIZE4(size) (size 1) -#define BLOCKMAP_BYTE_OFFSET4(x) ((x 0x0001) 2) -#define BLOCKMAP_MASK4 (0xf) - enum lgfs2_meta_type { LGFS2_MT_GFS2_SB = 0, LGFS2_MT_GFS_SB = 1, -- 1.8.3.1
Re: [Cluster-devel] GFS2: Pull request (fixes)
On Mon, Aug 19, 2013 at 2:26 AM, Steven Whitehouse swhit...@redhat.com wrote: Oops, forgot to sign this when I sent it first, so here is a signed copy of it. Please sign the git tag instead of the email. There are no sane tools to check email signatures etc, but git signed tags not only check your pgp key signature, they also allow you to just write the message into the tag. Also, please don't do crap like this: are available in the git repository at: https://git.kernel.org/cgit/linux/kernel/git/steve/gfs2-3.0-fixes.git master Yeah, no. The proper address is git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes not that cgit web page. Linus