Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 249781 Details for
Bug 352581
GFS2: implement gfs2_tool lockdump
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch to implement gfs2_tool lockdump
352581.lockdump.patch (text/plain), 3.72 KB, created by
Robert Peterson
on 2007-11-07 00:05:10 UTC
(
hide
)
Description:
Patch to implement gfs2_tool lockdump
Filename:
MIME Type:
Creator:
Robert Peterson
Created:
2007-11-07 00:05:10 UTC
Size:
3.72 KB
patch
obsolete
>Index: gfs2_tool.h >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/gfs2_tool.h,v >retrieving revision 1.8 >diff -w -u -p -p -u -r1.8 gfs2_tool.h >--- gfs2_tool.h 30 Oct 2007 14:06:06 -0000 1.8 >+++ gfs2_tool.h 7 Nov 2007 00:00:59 -0000 >@@ -95,7 +95,7 @@ void set_tune(int argc, char **argv); > > char *get_list(void); > char **str2lines(char *str); >-const char *find_debugfs_mount(void); >+char *find_debugfs_mount(void); > char *mp2fsname(char *mp); > char *name2value(char *str, char *name); > uint32_t name2u32(char *str, char *name); >Index: misc.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/misc.c,v >retrieving revision 1.11 >diff -w -u -p -p -u -r1.11 misc.c >--- misc.c 30 Oct 2007 14:06:06 -0000 1.11 >+++ misc.c 7 Nov 2007 00:00:59 -0000 >@@ -28,6 +28,7 @@ > > #define __user > #include <linux/gfs2_ondisk.h> >+#include <sys/mount.h> > #include <linux/fs.h> > > #include "libgfs2.h" >@@ -110,7 +111,67 @@ do_freeze(int argc, char **argv) > void > print_lockdump(int argc, char **argv) > { >- die("lockdump not implemented: use debugfs instead. \ne.g. cat /sys/kernel/debug/gfs2/clustname\\:fsname/glocks\n"); >+ char path[PATH_MAX]; >+ char *name, line[PATH_MAX]; >+ char *debugfs; >+ FILE *file; >+ int rc = -1, debug_dir_existed = 1; >+ >+ /* See if debugfs is mounted, and if not, mount it. */ >+ debugfs = find_debugfs_mount(); >+ if (!debugfs) { >+ debugfs = malloc(20); >+ if (!debugfs) >+ die("Can't allocate memory for debugfs.\n"); >+ memset(debugfs, 0, 20); >+ strcpy(debugfs, "/tmp/debugfs"); >+ >+ if (access(debugfs, F_OK)) { >+ debug_dir_existed = mkdir(debugfs, 644); >+ if (debug_dir_existed) { >+ fprintf(stderr, >+ "Can't create %s mount point.\n", >+ debugfs); >+ free(debugfs); >+ exit(-1); >+ } >+ } >+ rc = mount("none", debugfs, "debugfs", 0, NULL); >+ if (rc) { >+ fprintf(stderr, >+ "Can't mount debugfs. " >+ "Maybe your kernel doesn't support it.\n"); >+ free(debugfs); >+ exit(-1); >+ } >+ } >+ name = mp2fsname(argv[optind]); >+ if (name) { >+ sprintf(path, "%s/gfs2/%s/glocks", debugfs, name); >+ free(name); >+ file = fopen(path, "rt"); >+ if (file) { >+ while (fgets(line, PATH_MAX, file)) { >+ printf(line); >+ } >+ fclose(file); >+ } else { >+ fprintf(stderr, "Can't open %s: %s\n", path, >+ strerror(errno)); >+ } >+ } else { >+ fprintf(stderr, "Unable to locate sysfs for mount point %s.\n", >+ argv[optind]); >+ } >+ /* Check if we mounted the debugfs and if so, unmount it. */ >+ if (!rc) { >+ umount(debugfs); >+ /* Check if we created the debugfs mount point and if so, >+ delete it. */ >+ if (!debug_dir_existed) >+ rmdir(debugfs); >+ } >+ free(debugfs); > } > > /** >Index: util.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/util.c,v >retrieving revision 1.7 >diff -w -u -p -p -u -r1.7 util.c >--- util.c 6 Nov 2007 20:22:55 -0000 1.7 >+++ util.c 7 Nov 2007 00:00:59 -0000 >@@ -283,6 +283,36 @@ mp2devname(char *mp) > return name; > } > >+char * >+find_debugfs_mount(void) >+{ >+ FILE *file; >+ char line[PATH_MAX]; >+ char device[PATH_MAX], type[PATH_MAX]; >+ char *path; >+ >+ file = fopen("/proc/mounts", "rt"); >+ if (!file) >+ die("can't open /proc/mounts: %s\n", strerror(errno)); >+ >+ path = malloc(PATH_MAX); >+ if (!path) >+ die("Can't allocate memory for debugfs.\n"); >+ while (fgets(line, PATH_MAX, file)) { >+ >+ if (sscanf(line, "%s %s %s", device, path, type) != 3) >+ continue; >+ if (!strcmp(type, "debugfs")) { >+ fclose(file); >+ return path; >+ } >+ } >+ >+ free(path); >+ fclose(file); >+ return NULL; >+} >+ > /* The fsname can be substituted for the mountpoint on the command line. > This is necessary when we can't resolve a devname from /proc/mounts > to a fsname. */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 352581
: 249781