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 236761 Details for
Bug 345501
GFS2: gfs2 utils uses non-canonicalized names
[?]
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 fix the problem--try #1
345501.canonicalize.patch (text/plain), 19.41 KB, created by
Robert Peterson
on 2007-10-24 22:51:17 UTC
(
hide
)
Description:
patch to fix the problem--try #1
Filename:
MIME Type:
Creator:
Robert Peterson
Created:
2007-10-24 22:51:17 UTC
Size:
19.41 KB
patch
obsolete
>Index: libgfs2/misc.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/libgfs2/misc.c,v >retrieving revision 1.4 >diff -w -u -p -p -u -r1.4 misc.c >--- libgfs2/misc.c 26 Jun 2007 01:43:17 -0000 1.4 >+++ libgfs2/misc.c 24 Oct 2007 22:43:09 -0000 >@@ -170,16 +170,18 @@ void > check_for_gfs2(struct gfs2_sbd *sdp) > { > FILE *fp = fopen("/proc/mounts", "r"); >- char *name = sdp->path_name; > char buffer[PATH_MAX]; > char fstype[80]; > int fsdump, fspass, ret; > char fspath[PATH_MAX]; > char fsoptions[PATH_MAX]; >+ char *realname; > >- if (name[strlen(name) - 1] == '/') >- name[strlen(name) - 1] = '\0'; >- >+ realname = realpath(sdp->path_name, NULL); >+ if (!realname) { >+ perror(sdp->path_name); >+ return; >+ } > if (fp == NULL) { > perror("open: /proc/mounts"); > exit(EXIT_FAILURE); >@@ -199,19 +201,21 @@ check_for_gfs2(struct gfs2_sbd *sdp) > continue; > > /* Check if they specified the device instead of mnt point */ >- if (strcmp(sdp->device_name, name) == 0) >+ if (strcmp(sdp->device_name, realname) == 0) > strcpy(sdp->path_name, fspath); /* fix it */ >- else if (strcmp(fspath, name) != 0) >+ else if (strcmp(fspath, realname) != 0) > continue; > > fclose(fp); > if (strncmp(sdp->device_name, "/dev/loop", 9) == 0) > die("Cannot perform this operation on a loopback GFS2 mount.\n"); > >+ free(realname); > return; > } >+ free(realname); > fclose(fp); >- die("gfs2 Filesystem %s is not mounted.\n", name); >+ die("gfs2 Filesystem %s is not mounted.\n", sdp->path_name); > } > > void >Index: tool/Makefile >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/Makefile,v >retrieving revision 1.13 >diff -w -u -p -p -u -r1.13 Makefile >--- tool/Makefile 28 Aug 2007 04:35:44 -0000 1.13 >+++ tool/Makefile 24 Oct 2007 22:43:09 -0000 >@@ -27,7 +27,7 @@ OBJS= counters.o \ > > CFLAGS += -D_FILE_OFFSET_BITS=64 > CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/ >-CFLAGS += -I../include >+CFLAGS += -I../include -I../libgfs2/ > CFLAGS += -I${incdir} > > LDFLAGS += -L../libgfs2 -lgfs2 >Index: tool/counters.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/counters.c,v >retrieving revision 1.3 >diff -w -u -p -p -u -r1.3 counters.c >--- tool/counters.c 5 May 2006 18:06:09 -0000 1.3 >+++ tool/counters.c 24 Oct 2007 22:43:09 -0000 >@@ -28,6 +28,7 @@ > #include "osi_list.h" > > #include "gfs2_tool.h" >+#include "libgfs2.h" > > #define SIZE (65536) > >@@ -132,24 +133,19 @@ void > print_counters(int argc, char **argv) > { > unsigned int i = interval; >- char *path, *fs; >- int fd; >+ char *fs; >+ struct gfs2_sbd sbd; > > interval = 1; > > if (optind < argc) >- path = argv[optind++]; >+ sbd.path_name = argv[optind++]; > else > die("Usage: gfs2_tool counters <mountpoint>\n"); > >- fd = open(path, O_RDONLY); >- if (fd < 0) >- die("can't open file %s: %s\n", path, strerror(errno)); >+ check_for_gfs2(&sbd); > >- check_for_gfs2(fd, path); >- close(fd); >- >- fs = mp2fsname(path); >+ fs = mp2fsname(sbd.path_name); > > for (;;) { > print_line(fs, "glock_count", "locks", 0); >@@ -204,6 +200,4 @@ print_counters(int argc, char **argv) > first = FALSE; > } > } >- >- close(fd); > } >Index: tool/df.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/df.c,v >retrieving revision 1.7 >diff -w -u -p -p -u -r1.7 df.c >--- tool/df.c 5 May 2006 18:06:09 -0000 1.7 >+++ tool/df.c 24 Oct 2007 22:43:09 -0000 >@@ -29,6 +29,7 @@ > #include <linux/gfs2_ondisk.h> > > #include "gfs2_tool.h" >+#include "libgfs2.h" > > #define SIZE (65536) > >@@ -42,7 +43,6 @@ > static void > do_df_one(char *path) > { >- int fd; > struct gfs2_ioctl gi; > /* char stat_gfs2[SIZE]; */ > /* unsigned int percentage; */ >@@ -53,14 +53,15 @@ do_df_one(char *path) > unsigned int flags; > char *fs, *value; > int error; >+ struct gfs2_sbd sbd; > >+ sbd.path_name = path; >+ check_for_gfs2(&sbd); > >- fd = open(path, O_RDONLY); >- if (fd < 0) >+ sbd.device_fd = open(path, O_RDONLY); >+ if (sbd.device_fd < 0) > die("can't open %s: %s\n", path, strerror(errno)); > >- check_for_gfs2(fd, path); >- > fs = mp2fsname(path); > > /* >@@ -76,7 +77,7 @@ do_df_one(char *path) > gi.gi_data = (char *)&sb; > gi.gi_size = sizeof(struct gfs2_sb); > >- error = ioctl(fd, GFS2_IOCTL_SUPER, &gi); >+ error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); > if (error != gi.gi_size) > die("error doing get_super (%d): %s\n", > error, strerror(errno)); >@@ -90,7 +91,7 @@ do_df_one(char *path) > gi.gi_data = (char *)&ji; > gi.gi_size = sizeof(struct gfs2_dinode); > >- error = ioctl(fd, GFS2_IOCTL_SUPER, &gi); >+ error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); > if (error != gi.gi_size) > die("error doing get_hfile_stat for jindex (%d): %s\n", > error, strerror(errno)); >@@ -104,13 +105,13 @@ do_df_one(char *path) > gi.gi_data = (char *)&ri; > gi.gi_size = sizeof(struct gfs2_dinode); > >- error = ioctl(fd, GFS2_IOCTL_SUPER, &gi); >+ error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); > if (error != gi.gi_size) > die("error doing get_hfile_stat for rindex (%d): %s\n", > error, strerror(errno)); > } > >- close(fd); >+ close(sbd.device_fd); > > journals = ji.di_entries - 2; > >Index: tool/gfs2_tool.h >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/gfs2_tool.h,v >retrieving revision 1.6 >diff -w -u -p -p -u -r1.6 gfs2_tool.h >--- tool/gfs2_tool.h 10 May 2007 15:47:45 -0000 1.6 >+++ tool/gfs2_tool.h 24 Oct 2007 22:43:09 -0000 >@@ -72,6 +72,7 @@ void print_stat(int argc, char **argv); > void print_sb(int argc, char **argv); > void print_args(int argc, char **argv); > void print_jindex(int argc, char **argv); >+void print_journals(int argc, char **argv); > void print_rindex(int argc, char **argv); > void print_quota(int argc, char **argv); > void print_list(void); >@@ -92,7 +93,6 @@ void set_tune(int argc, char **argv); > > /* From util.c */ > >-void check_for_gfs2(int fd, char *path); > char *get_list(void); > char **str2lines(char *str); > const char *find_debugfs_mount(void); >Index: tool/layout.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/layout.c,v >retrieving revision 1.3 >diff -w -u -p -p -u -r1.3 layout.c >--- tool/layout.c 5 May 2006 18:06:09 -0000 1.3 >+++ tool/layout.c 24 Oct 2007 22:43:09 -0000 >@@ -32,6 +32,7 @@ > #include "linux_endian.h" > > #include "gfs2_tool.h" >+#include "libgfs2.h" > > #define LAYOUT_DATA_QUANTUM (4194304) > >@@ -765,11 +766,10 @@ void > print_layout(int argc, char **argv) > { > world_t w; >- char *path; >- int fd; > int retry = TRUE; > struct gfs2_ioctl gi; > int error; >+ struct gfs2_sbd sbd; > > memset(&w, 0, sizeof(world_t)); > w.buf_size = LAYOUT_DATA_QUANTUM; >@@ -779,17 +779,17 @@ print_layout(int argc, char **argv) > if (optind == argc) > die("Usage: gfs2_tool layout <filename> [buffersize]\n"); > >- path = argv[optind++]; >+ sbd.path_name = argv[optind++]; > if (optind < argc ) { > w.buf_size = atoi(argv[3]); > retry = FALSE; > } > >- fd = open(path, O_RDONLY); >- if (fd < 0) >- die("can't open %s: %s\n", path, strerror(errno)); >+ sbd.device_fd = open(sbd.path_name, O_RDONLY); >+ if (sbd.device_fd < 0) >+ die("can't open %s: %s\n", sbd.path_name, strerror(errno)); > >- check_for_gfs2(fd, path); >+ check_for_gfs2(&sbd); > > { > char *argv[] = { "get_super" }; >@@ -799,7 +799,7 @@ print_layout(int argc, char **argv) > gi.gi_data = (char *)&w.sb; > gi.gi_size = sizeof(struct gfs2_sb); > >- error = ioctl(fd, GFS2_IOCTL_SUPER, &gi); >+ error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); > if (error != gi.gi_size) > die("error doing get_super (%d): %s\n", > error, strerror(errno)); >@@ -825,7 +825,7 @@ print_layout(int argc, char **argv) > gi.gi_data = w.buf_data; > gi.gi_size = w.buf_size; > >- w.buf_count = ioctl(fd, GFS2_IOCTL_SUPER, &gi); >+ w.buf_count = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); > if (w.buf_count >= 0) > break; > >@@ -855,7 +855,7 @@ print_layout(int argc, char **argv) > > check_for_untouched_buffers(&w); > >- close(fd); >+ close(sbd.device_fd); > } > #endif /* #if GFS2_TOOL_FEATURE_IMPLEMENTED */ > >Index: tool/misc.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/misc.c,v >retrieving revision 1.8 >diff -w -u -p -p -u -r1.8 misc.c >--- tool/misc.c 26 Oct 2006 18:42:25 -0000 1.8 >+++ tool/misc.c 24 Oct 2007 22:43:09 -0000 >@@ -30,6 +30,7 @@ > #include <linux/gfs2_ondisk.h> > #include <linux/fs.h> > >+#include "libgfs2.h" > #include "gfs2_tool.h" > > #if GFS2_TOOL_FEATURE_IMPLEMENTED >@@ -47,6 +48,7 @@ do_file_flush(int argc, char **argv) > struct gfs2_ioctl gi; > int fd; > int error; >+ struct gfs2_sbd sbd; > > if (optind == argc) > die("Usage: gfs2_tool flush <filenames>\n"); >@@ -59,7 +61,8 @@ do_file_flush(int argc, char **argv) > if (fd < 0) > die("can't open %s: %s\n", argv[optind], strerror(errno)); > >- check_for_gfs2(fd, argv[optind]); >+ sbd.path_name = argv[optind]; >+ check_for_gfs2(&sbd); > > error = ioctl(fd, GFS2_IOCTL_SUPER, &gi); > if (error) >@@ -237,32 +240,33 @@ set_flag(int argc, char **argv) > void > print_stat(int argc, char **argv) > { >- int fd; > char *gi_argv[] = { "get_file_stat" }; > struct gfs2_ioctl gi; > struct gfs2_dinode di; > int error; >+ struct gfs2_sbd sbd; > > if (optind == argc) > die("Usage: gfs2_tool stat <filename>\n"); > >- fd = open(argv[optind], O_RDONLY); >- if (fd < 0) >+ sbd.device_fd = open(argv[optind], O_RDONLY); >+ if (sbd.device_fd < 0) > die("can't open %s: %s\n", argv[optind], strerror(errno)); > >- check_for_gfs2(fd, argv[optind]); >+ sbd.path_name = argv[optind]; >+ check_for_gfs2(&sbd); > > gi.gi_argc = 1; > gi.gi_argv = gi_argv; > gi.gi_data = (char *)&di; > gi.gi_size = sizeof(struct gfs2_dinode); > >- error = ioctl(fd, GFS2_IOCTL_SUPER, &gi); >+ error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); > if (error != gi.gi_size) > die("error doing get_file_stat (%d): %s\n", > error, strerror(errno)); > >- close(fd); >+ close(sbd.device_fd); > > gfs2_dinode_print(&di); > printf("\n"); >@@ -279,32 +283,33 @@ print_stat(int argc, char **argv) > void > print_sb(int argc, char **argv) > { >- int fd; > char *gi_argv[] = { "get_super" }; > struct gfs2_ioctl gi; > struct gfs2_sb sb; > int error; >+ struct gfs2_sbd sbd; > > if (optind == argc) > die("Usage: gfs2_tool getsb <mountpoint>\n"); > >- fd = open(argv[optind], O_RDONLY); >- if (fd < 0) >+ sbd.device_fd = open(argv[optind], O_RDONLY); >+ if (sbd.device_fd < 0) > die("can't open %s: %s\n", argv[optind], strerror(errno)); > >- check_for_gfs2(fd, argv[optind]); >+ sbd.path_name = argv[optind]; >+ check_for_gfs2(&sbd); > > gi.gi_argc = 1; > gi.gi_argv = gi_argv; > gi.gi_data = (char *)&sb; > gi.gi_size = sizeof(struct gfs2_sb); > >- error = ioctl(fd, GFS2_IOCTL_SUPER, &gi); >+ error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); > if (error != gi.gi_size) > die("error doing get_super (%d): %s\n", > error, strerror(errno)); > >- close(fd); >+ close(sbd.device_fd); > > gfs2_sb_print(&sb); > } >@@ -321,22 +326,17 @@ print_sb(int argc, char **argv) > void > print_args(int argc, char **argv) > { >- int fd; > char *fs; > DIR *d; > struct dirent *de; > char path[PATH_MAX]; >+ struct gfs2_sbd sbd; > > if (optind == argc) > die("Usage: gfs2_tool getargs <mountpoint>\n"); > >- fd = open(argv[optind], O_RDONLY); >- if (fd < 0) >- die("can't open %s: %s\n", argv[optind], strerror(errno)); >- >- check_for_gfs2(fd, argv[optind]); >- >- close(fd); >+ sbd.path_name = argv[optind]; >+ check_for_gfs2(&sbd); > fs = mp2fsname(argv[optind]); > > memset(path, 0, PATH_MAX); >@@ -369,19 +369,19 @@ print_args(int argc, char **argv) > void > print_jindex(int argc, char **argv) > { >- int fd; > struct gfs2_ioctl gi; > int error; >- >+ struct gfs2_sbd sbd; > > if (optind == argc) > die("Usage: gfs2_tool jindex <mountpoint>\n"); > >- fd = open(argv[optind], O_RDONLY); >- if (fd < 0) >+ sbd.device_fd = open(argv[optind], O_RDONLY); >+ if (sbd.device_fd < 0) > die("can't open %s: %s\n", argv[optind], strerror(errno)); > >- check_for_gfs2(fd, argv[optind]); >+ sbd.path_name = argv[optind]; >+ check_for_gfs2(&sdp); > > > { >@@ -394,7 +394,7 @@ print_jindex(int argc, char **argv) > gi.gi_data = (char *)&di; > gi.gi_size = sizeof(struct gfs2_dinode); > >- error = ioctl(fd, GFS2_IOCTL_SUPER, &gi); >+ error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); > if (error != gi.gi_size) > die("error doing get_hfile_stat (%d): %s\n", > error, strerror(errno)); >@@ -404,7 +404,7 @@ print_jindex(int argc, char **argv) > } > > >- close(fd); >+ close(sbd.device_fd); > } > > /** >@@ -417,21 +417,21 @@ print_jindex(int argc, char **argv) > void > print_rindex(int argc, char **argv) > { >- int fd; > struct gfs2_ioctl gi; > uint64_t offset; > unsigned int x; > int error; >- >+ struct gfs2_sbd sbd; > > if (optind == argc) > die("Usage: gfs2_tool rindex <mountpoint>\n"); > >- fd = open(argv[optind], O_RDONLY); >- if (fd < 0) >+ sbd.device_fd = open(argv[optind], O_RDONLY); >+ if (sbd.device_fd < 0) > die("can't open %s: %s\n", argv[optind], strerror(errno)); > >- check_for_gfs2(fd, argv[optind]); >+ sbd.path_name = argv[optind]; >+ check_for_gfs2(&sdp); > > > { >@@ -444,7 +444,7 @@ print_rindex(int argc, char **argv) > gi.gi_data = (char *)&di; > gi.gi_size = sizeof(struct gfs2_dinode); > >- error = ioctl(fd, GFS2_IOCTL_SUPER, &gi); >+ error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); > if (error != gi.gi_size) > die("error doing get_hfile_stat (%d): %s\n", > error, strerror(errno)); >@@ -465,7 +465,7 @@ print_rindex(int argc, char **argv) > gi.gi_size = sizeof(struct gfs2_rindex); > gi.gi_offset = offset; > >- error = ioctl(fd, GFS2_IOCTL_SUPER, &gi); >+ error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); > if (!error) > break; > if (error != sizeof(struct gfs2_rindex)) >@@ -479,7 +479,7 @@ print_rindex(int argc, char **argv) > } > > >- close(fd); >+ close(sbd.device_fd); > } > > /** >@@ -492,21 +492,21 @@ print_rindex(int argc, char **argv) > void > print_quota(int argc, char **argv) > { >- int fd; > struct gfs2_ioctl gi; > uint64_t offset; > unsigned int x; > int error; >- >+ struct gfs2_sbd sbd; > > if (optind == argc) > die("Usage: gfs2_tool quota <mountpoint>\n"); > >- fd = open(argv[optind], O_RDONLY); >- if (fd < 0) >+ sbd.device_fd = open(argv[optind], O_RDONLY); >+ if (sbd.device_fd < 0) > die("can't open %s: %s\n", argv[optind], strerror(errno)); > >- check_for_gfs2(fd, argv[optind]); >+ sbd.path_name = argv[optind]; >+ check_for_gfs2(&sdp); > > > { >@@ -519,7 +519,7 @@ print_quota(int argc, char **argv) > gi.gi_data = (char *)&di; > gi.gi_size = sizeof(struct gfs2_dinode); > >- error = ioctl(fd, GFS2_IOCTL_SUPER, &gi); >+ error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); > if (error != gi.gi_size) > die("error doing get_hfile_stat (%d): %s\n", > error, strerror(errno)); >@@ -540,7 +540,7 @@ print_quota(int argc, char **argv) > gi.gi_size = sizeof(struct gfs2_quota); > gi.gi_offset = offset; > >- error = ioctl(fd, GFS2_IOCTL_SUPER, &gi); >+ error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi); > if (!error) > break; > if (error != sizeof(struct gfs2_quota)) >@@ -556,7 +556,7 @@ print_quota(int argc, char **argv) > } > > >- close(fd); >+ close(sbd.device_fd); > } > #endif /* #if GFS2_TOOL_FEATURE_IMPLEMENTED */ > >@@ -582,19 +582,14 @@ print_list(void) > void > do_shrink(int argc, char **argv) > { >- int fd; > char *fs; >+ struct gfs2_sbd sbd; > > if (optind == argc) > die("Usage: gfs2_tool shrink <mountpoint>\n"); > >- fd = open(argv[optind], O_RDONLY); >- if (fd < 0) >- die("can't open %s: %s\n", >- argv[optind], strerror(errno)); >- >- check_for_gfs2(fd, argv[optind]); >- close(fd); >+ sbd.path_name = argv[optind]; >+ check_for_gfs2(&sbd); > fs = mp2fsname(argv[optind]); > > set_sysfs(fs, "shrink", "1"); >@@ -611,10 +606,13 @@ void > do_withdraw(int argc, char **argv) > { > char *name; >+ struct gfs2_sbd sbd; > > if (optind == argc) > die("Usage: gfs2_tool withdraw <mountpoint>\n"); > >+ sbd.path_name = argv[optind]; >+ check_for_gfs2(&sbd); > name = mp2fsname(argv[optind]); > > set_sysfs(name, "withdraw", "1"); >Index: tool/tune.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/tune.c,v >retrieving revision 1.3 >diff -w -u -p -p -u -r1.3 tune.c >--- tool/tune.c 5 May 2006 18:06:09 -0000 1.3 >+++ tool/tune.c 24 Oct 2007 22:43:09 -0000 >@@ -29,6 +29,7 @@ > #define __user > > #include "gfs2_tool.h" >+#include "libgfs2.h" > > #define SIZE (65536) > >@@ -42,24 +43,19 @@ > void > get_tune(int argc, char **argv) > { >- int fd; > char path[PATH_MAX]; > char *fs; > DIR *d; > struct dirent *de; > double ratio; > unsigned int num, den; >+ struct gfs2_sbd sbd; > > if (optind == argc) > die("Usage: gfs2_tool gettune <mountpoint>\n"); > >- fd = open(argv[optind], O_RDONLY); >- if (fd < 0) >- die("can't open file %s: %s\n", >- argv[optind], strerror(errno)); >- >- check_for_gfs2(fd, argv[optind]); >- close(fd); >+ sbd.path_name = argv[optind]; >+ check_for_gfs2(&sbd); > fs = mp2fsname(argv[optind]); > memset(path, 0, PATH_MAX); > snprintf(path, PATH_MAX - 1, "%s/%s/tune", SYS_BASE, fs); >@@ -94,15 +90,15 @@ get_tune(int argc, char **argv) > void > set_tune(int argc, char **argv) > { >- char *mp, *param, *value; >- int fd; >+ char *param, *value; > char tune_base[SIZE] = "tune/"; > char buf[256]; > char *fs; >+ struct gfs2_sbd sbd; > > if (optind == argc) > die("Usage: gfs2_tool settune <mountpoint> <parameter> <value>\n"); >- mp = argv[optind++]; >+ sbd.path_name = argv[optind++]; > if (optind == argc) > die("Usage: gfs2_tool settune <mountpoint> <parameter> <value>\n"); > param = argv[optind++]; >@@ -110,14 +106,8 @@ set_tune(int argc, char **argv) > die("Usage: gfs2_tool settune <mountpoint> <parameter> <value>\n"); > value = argv[optind++]; > >- fd = open(mp, O_RDONLY); >- if (fd < 0) >- die("can't open file %s: %s\n", >- mp, strerror(errno)); >- >- check_for_gfs2(fd, mp); >- close(fd); >- fs = mp2fsname(mp); >+ check_for_gfs2(&sbd); >+ fs = mp2fsname(sbd.path_name); > > if (strcmp(param, "quota_scale") == 0) { > float s; >Index: tool/util.c >=================================================================== >RCS file: /cvs/cluster/cluster/gfs2/tool/util.c,v >retrieving revision 1.5 >diff -w -u -p -p -u -r1.5 util.c >--- tool/util.c 15 Jun 2006 16:40:48 -0000 1.5 >+++ tool/util.c 24 Oct 2007 22:43:09 -0000 >@@ -168,34 +168,6 @@ get_list(void) > } > > /** >- * check_for_gfs2 - Check to see if a descriptor is a file on a GFS2 filesystem >- * @fd: the file descriptor >- * @path: the path used to open the descriptor >- * >- */ >- >-/* >- * FIXME check_for_gfs2() uses an ioctl that's not supported by gfs2. >- * This function is used as a sanity check before performing certain >- * operations. >- */ >-#if 0 >-void >-check_for_gfs2(int fd, char *path) >-{ >- unsigned int magic = 0; >- int error = 0; >- error = ioctl(fd, GFS2_IOCTL_IDENTIFY, &magic); >- if (error || magic != GFS2_MAGIC) >- die("%s is not a GFS2 file/filesystem\n", >- path); >-} >-#else >-void check_for_gfs2(int fd, char *path) {} >-#endif /* #if 0 */ >- >- >-/** > * str2lines - parse a string into lines > * @list: the list > * >@@ -280,7 +252,11 @@ mp2devname(char *mp) > char line[PATH_MAX]; > static char device[PATH_MAX]; > char *name = NULL; >+ char *realname; > >+ realname = realpath(mp, NULL); >+ if (!realname) >+ die("Unable to allocate memory for name resolution.\n"); > file = fopen("/proc/mounts", "r"); > if (!file) > die("can't open /proc/mounts: %s\n", strerror(errno)); >@@ -290,7 +266,7 @@ mp2devname(char *mp) > > if (sscanf(line, "%s %s %s", device, path, type) != 3) > continue; >- if (strcmp(path, mp)) >+ if (strcmp(path, realname)) > continue; > if (strcmp(type, "gfs2")) > die("%s is not a GFS2 filesystem\n", mp); >@@ -300,6 +276,7 @@ mp2devname(char *mp) > break; > } > >+ free(realname); > fclose(file); > > return name;
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 345501
:
236761
|
237361
|
237371