cluster: RHEL55 - fsck.gfs2 fails on root fs: Device X is busy.
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 112a4979a64dc0e8cc74e5e63ae55b5788cf334e
Parent: 406853e929125ee1a622e696295e9c7b9a08c65e
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Thu Jan 28 13:50:53 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Thu Jan 28 13:50:53 2010 -0600
fsck.gfs2 fails on root fs: Device X is busy.
In a previous commit, we added an O_EXCL when opening the
device. This was done to prevent other nodes from interacting
with the file system while it was being checked. However, this
turns out to be a problem when the root file system is GFS2.
In that case, it's proper to allow the fsck to complete normally
and if errors are found, tell vfs to flush its cache after
corrections are made.
rhbz#557128
---
gfs2/fsck/initialize.c | 69 +++++++++++++++++++++++++++++++++++++++---------
gfs2/libgfs2/libgfs2.h | 1 +
gfs2/libgfs2/misc.c | 24 ++++++++++++----
3 files changed, 75 insertions(+), 19 deletions(-)
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 10c8ecc..93fef78 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -35,6 +35,8 @@
x = NULL; \
}
+static int was_mounted_ro = 0;
+
/**
* block_mounters
*
@@ -330,26 +332,54 @@ static int fill_super_block(struct gfs2_sbd *sdp)
int initialize(struct gfs2_sbd *sbp, int force_check, int preen,
int *all_clean)
{
- int clean_journals = 0;
+ int clean_journals = 0, open_flag;
*all_clean = 0;
- if(opts.no) {
- if ((sbp->device_fd = open(opts.device, O_RDONLY)) < 0) {
+ if(opts.no)
+ open_flag = O_RDONLY;
+ else
+ open_flag = O_RDWR | O_EXCL;
+
+ sbp->device_fd = open(opts.device, open_flag);
+ if (sbp->device_fd < 0) {
+ int is_mounted, ro;
+
+ if (open_flag == O_RDONLY || errno != EBUSY) {
log_crit("Unable to open device: %s\n", opts.device);
return FSCK_USAGE;
}
- } else {
- /* read in sb from disk */
- if ((sbp->device_fd = open(opts.device, O_RDWR | O_EXCL)) < 0){
- if (errno == EBUSY)
- log_crit("Device %s is busy.\n", opts.device);
- else
- log_crit("Unable to open device: %s\n",
- opts.device);
- return FSCK_USAGE;
- }
+ /* We can't open it EXCL. It may be already open rw (in which
+ case we want to deny them access) or it may be mounted as
+ the root file system at boot time (in which case we need to
+ allow it.) We use is_pathname_mounted here even though
+ we're specifying a device name, not a path name. The
+ function checks for device as well. */
+ strncpy(sbp->device_name, opts.device,
+ sizeof(sbp->device_name));
+ sbp->path_name = sbp->device_name; /* This gets overwritten */
+ is_mounted = is_pathname_mounted(sbp, &ro);
+ /* If the device is busy, but not because it's mounted, fail.
+ This protects against cases where the file system is LVM
+ and perhaps mounted on a different node. */
+ if (!is_mounted)
+ goto mount_fail;
+ /* If the device is mounted, but not mounted RO, fail. This
+ protects them against cases where the file system is
+ mounted RW, but still allows us to check our own root
+ file system. */
+ if (!ro)
+ goto mount_fail;
+ /* The device is mounted RO, so it's likely our own root
+ file system. We can only do so much to protect the users
+ from themselves. Try opening without O_EXCL. */
+ if ((sbp->device_fd = open(opts.device, O_RDWR)) < 0)
+ goto mount_fail;
+
+ was_mounted_ro = 1;
}
+
+ /* read in sb from disk */
if (fill_super_block(sbp)) {
stack;
return FSCK_ERROR;
@@ -385,6 +415,10 @@ int initialize(struct gfs2_sbd *sbp, int force_check, int preen,
return FSCK_ERROR;
return FSCK_OK;
+
+mount_fail:
+ log_crit("Device %s is busy.\n", opts.device);
+ return FSCK_USAGE;
}
static void destroy_sbp(struct gfs2_sbd *sbp)
@@ -399,6 +433,15 @@ static void destroy_sbp(struct gfs2_sbd *sbp)
}
empty_super_block(sbp);
close(sbp->device_fd);
+ if (was_mounted_ro && errors_corrected) {
+ sbp->device_fd = open("/proc/sys/vm/drop_caches", O_WRONLY);
+ if (sbp->device_fd >= 0) {
+ write(sbp->device_fd, "2", 1);
+ close(sbp->device_fd);
+ } else
+ log_err("fsck.gfs2: Non-fatal error dropping "
+ "caches.\n");
+ }
}
void destroy(struct gfs2_sbd *sbp)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 7a505a1..9958980 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -663,6 +663,7 @@ int gfs2_query(int *setonabort, struct gfs2_options *opts,
uint32_t compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
uint32_t bsize1, int diptrs, int inptrs);
void compute_constants(struct gfs2_sbd *sdp);
+int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount);
void check_for_gfs2(struct gfs2_sbd *sdp);
void mount_gfs2_meta(struct gfs2_sbd *sdp);
void cleanup_metafs(struct gfs2_sbd *sdp);
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index 60e807a..bcccba9 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -105,8 +105,7 @@ compute_constants(struct gfs2_sbd *sdp)
sdp->sd_inptrs);
}
-void
-check_for_gfs2(struct gfs2_sbd *sdp)
+int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount)
{
FILE *fp = fopen("/proc/mounts", "r");
char buffer[PATH_MAX];
@@ -116,10 +115,11 @@ check_for_gfs2(struct gfs2_sbd *sdp)
char fsoptions[PATH_MAX];
char *realname;
+ *ro_mount = 0;
realname = realpath(sdp->path_name, NULL);
if (!realname) {
perror(sdp->path_name);
- return;
+ return 0;
}
if (fp == NULL) {
perror("open: /proc/mounts");
@@ -145,16 +145,28 @@ check_for_gfs2(struct gfs2_sbd *sdp)
else if (strcmp(fspath, realname) != 0)
continue;
+ if (strncmp(fsoptions, "ro,", 3) == 0 ||
+ strcmp(fsoptions, "ro") == 0)
+ *ro_mount = 1;
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;
+ return 1; /* mounted */
}
- free(realname);
fclose(fp);
- die("gfs2 Filesystem %s is not mounted.\n", sdp->path_name);
+ free(realname);
+ return 0; /* not mounted */
+}
+
+void
+check_for_gfs2(struct gfs2_sbd *sdp)
+{
+ int ro;
+
+ if (!is_pathname_mounted(sdp, &ro))
+ die("gfs2 Filesystem %s is not mounted.\n", sdp->path_name);
}
static void
14 years, 2 months
cluster: STABLE3 - fsck.gfs2 fails on root fs: Device X is busy.
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: a1222d2f5923cefbb70990ae89e1cd63aed7d2ca
Parent: aeaf791266b40f75fa7434064244a80db2a3aa17
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Thu Jan 28 14:58:19 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Thu Jan 28 14:58:19 2010 -0600
fsck.gfs2 fails on root fs: Device X is busy.
In a previous commit, we added an O_EXCL when opening the
device. This was done to prevent other nodes from interacting
with the file system while it was being checked. However, this
turns out to be a problem when the root file system is GFS2.
In that case, it's proper to allow the fsck to complete normally
and if errors are found, tell vfs to flush its cache after
corrections are made.
rhbz#557128
---
gfs2/fsck/initialize.c | 73 ++++++++++++++++++++++++++++++++++++++----------
gfs2/libgfs2/libgfs2.h | 1 +
gfs2/libgfs2/misc.c | 28 +++++++++++++-----
3 files changed, 79 insertions(+), 23 deletions(-)
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 00d4ed2..2910326 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -25,6 +25,8 @@
x = NULL; \
}
+static int was_mounted_ro = 0;
+
/**
* block_mounters
*
@@ -453,27 +455,55 @@ static int fill_super_block(struct gfs2_sbd *sdp)
int initialize(struct gfs2_sbd *sbp, int force_check, int preen,
int *all_clean)
{
- int clean_journals = 0;
+ int clean_journals = 0, open_flag;
*all_clean = 0;
- if(opts.no) {
- if ((sbp->device_fd = open(opts.device, O_RDONLY)) < 0) {
- log_crit( _("Unable to open device: %s\n"), opts.device);
- return FSCK_USAGE;
- }
- } else {
- /* read in sb from disk */
- if ((sbp->device_fd = open(opts.device, O_RDWR | O_EXCL)) < 0){
- if (errno == EBUSY)
- log_crit( _("Device %s is busy.\n"),
- opts.device);
- else
- log_crit( _("Unable to open device: %s\n"),
- opts.device);
+ if(opts.no)
+ open_flag = O_RDONLY;
+ else
+ open_flag = O_RDWR | O_EXCL;
+
+ sbp->device_fd = open(opts.device, open_flag);
+ if (sbp->device_fd < 0) {
+ int is_mounted, ro;
+
+ if (open_flag == O_RDONLY || errno != EBUSY) {
+ log_crit( _("Unable to open device: %s\n"),
+ opts.device);
return FSCK_USAGE;
}
+ /* We can't open it EXCL. It may be already open rw (in which
+ case we want to deny them access) or it may be mounted as
+ the root file system at boot time (in which case we need to
+ allow it.) We use is_pathname_mounted here even though
+ we're specifying a device name, not a path name. The
+ function checks for device as well. */
+ strncpy(sbp->device_name, opts.device,
+ sizeof(sbp->device_name));
+ sbp->path_name = sbp->device_name; /* This gets overwritten */
+ is_mounted = is_pathname_mounted(sbp, &ro);
+ /* If the device is busy, but not because it's mounted, fail.
+ This protects against cases where the file system is LVM
+ and perhaps mounted on a different node. */
+ if (!is_mounted)
+ goto mount_fail;
+ /* If the device is mounted, but not mounted RO, fail. This
+ protects them against cases where the file system is
+ mounted RW, but still allows us to check our own root
+ file system. */
+ if (!ro)
+ goto mount_fail;
+ /* The device is mounted RO, so it's likely our own root
+ file system. We can only do so much to protect the users
+ from themselves. Try opening without O_EXCL. */
+ if ((sbp->device_fd = open(opts.device, O_RDWR)) < 0)
+ goto mount_fail;
+
+ was_mounted_ro = 1;
}
+
+ /* read in sb from disk */
if (fill_super_block(sbp)) {
stack;
return FSCK_ERROR;
@@ -509,6 +539,10 @@ int initialize(struct gfs2_sbd *sbp, int force_check, int preen,
return FSCK_ERROR;
return FSCK_OK;
+
+mount_fail:
+ log_crit( _("Device %s is busy.\n"), opts.device);
+ return FSCK_USAGE;
}
static void destroy_sbp(struct gfs2_sbd *sbp)
@@ -523,6 +557,15 @@ static void destroy_sbp(struct gfs2_sbd *sbp)
}
empty_super_block(sbp);
close(sbp->device_fd);
+ if (was_mounted_ro && errors_corrected) {
+ sbp->device_fd = open("/proc/sys/vm/drop_caches", O_WRONLY);
+ if (sbp->device_fd >= 0) {
+ write(sbp->device_fd, "2", 1);
+ close(sbp->device_fd);
+ } else
+ log_err( _("fsck.gfs2: Non-fatal error dropping "
+ "caches.\n"));
+ }
}
void destroy(struct gfs2_sbd *sbp)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index c4675f7..d89194c 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -598,6 +598,7 @@ extern int gfs2_query(int *setonabort, struct gfs2_options *opts,
extern int compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
uint32_t *maxheight, uint32_t bsize1, int diptrs, int inptrs);
extern int compute_constants(struct gfs2_sbd *sdp);
+extern int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount);
extern int find_gfs2_meta(struct gfs2_sbd *sdp);
extern int dir_exists(const char *dir);
extern int check_for_gfs2(struct gfs2_sbd *sdp);
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index 541db02..5ccdab4 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -96,7 +96,7 @@ int compute_constants(struct gfs2_sbd *sdp)
return 0;
}
-int check_for_gfs2(struct gfs2_sbd *sdp)
+int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount)
{
FILE *fp;
char buffer[PATH_MAX];
@@ -106,14 +106,14 @@ int check_for_gfs2(struct gfs2_sbd *sdp)
char fsoptions[PATH_MAX];
char *realname;
+ *ro_mount = 0;
realname = realpath(sdp->path_name, NULL);
- if (!realname) {
- return -1;
- }
+ if (!realname)
+ return 0;
fp = fopen("/proc/mounts", "r");
if (fp == NULL) {
free(realname);
- return -1;
+ return 0;
}
while ((fgets(buffer, PATH_MAX - 1, fp)) != NULL) {
buffer[PATH_MAX - 1] = 0;
@@ -135,19 +135,31 @@ int check_for_gfs2(struct gfs2_sbd *sdp)
else if (strcmp(fspath, realname) != 0)
continue;
+ if (strncmp(fsoptions, "ro,", 3) == 0 ||
+ strcmp(fsoptions, "ro") == 0)
+ *ro_mount = 1;
fclose(fp);
free(realname);
if (strncmp(sdp->device_name, "/dev/loop", 9) == 0) {
errno = EINVAL;
- return -1;
+ return 0;
}
- return 0;
+ return 1;
}
free(realname);
fclose(fp);
errno = EINVAL;
- return -1;
+ return 0;
+}
+
+int check_for_gfs2(struct gfs2_sbd *sdp)
+{
+ int ro;
+
+ if (!is_pathname_mounted(sdp, &ro))
+ return -1;
+ return 0;
}
static int lock_for_admin(struct gfs2_sbd *sdp)
14 years, 2 months
gfs2-utils: master - fsck.gfs2 fails on root fs: Device X is busy.
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 23cdad0c9884594339cc2adb150356c48bd83ab0
Parent: 19090ba9509385c218366d01465174a27d543466
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Thu Jan 28 14:58:19 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Thu Jan 28 15:03:55 2010 -0600
fsck.gfs2 fails on root fs: Device X is busy.
In a previous commit, we added an O_EXCL when opening the
device. This was done to prevent other nodes from interacting
with the file system while it was being checked. However, this
turns out to be a problem when the root file system is GFS2.
In that case, it's proper to allow the fsck to complete normally
and if errors are found, tell vfs to flush its cache after
corrections are made.
rhbz#557128
---
gfs2/fsck/initialize.c | 73 ++++++++++++++++++++++++++++++++++++++----------
gfs2/libgfs2/libgfs2.h | 1 +
gfs2/libgfs2/misc.c | 28 +++++++++++++-----
3 files changed, 79 insertions(+), 23 deletions(-)
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 13d8f3d..622a8f1 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -27,6 +27,8 @@
x = NULL; \
}
+static int was_mounted_ro = 0;
+
/**
* block_mounters
*
@@ -455,27 +457,55 @@ static int fill_super_block(struct gfs2_sbd *sdp)
int initialize(struct gfs2_sbd *sbp, int force_check, int preen,
int *all_clean)
{
- int clean_journals = 0;
+ int clean_journals = 0, open_flag;
*all_clean = 0;
- if(opts.no) {
- if ((sbp->device_fd = open(opts.device, O_RDONLY)) < 0) {
- log_crit( _("Unable to open device: %s\n"), opts.device);
- return FSCK_USAGE;
- }
- } else {
- /* read in sb from disk */
- if ((sbp->device_fd = open(opts.device, O_RDWR | O_EXCL)) < 0){
- if (errno == EBUSY)
- log_crit( _("Device %s is busy.\n"),
- opts.device);
- else
- log_crit( _("Unable to open device: %s\n"),
- opts.device);
+ if(opts.no)
+ open_flag = O_RDONLY;
+ else
+ open_flag = O_RDWR | O_EXCL;
+
+ sbp->device_fd = open(opts.device, open_flag);
+ if (sbp->device_fd < 0) {
+ int is_mounted, ro;
+
+ if (open_flag == O_RDONLY || errno != EBUSY) {
+ log_crit( _("Unable to open device: %s\n"),
+ opts.device);
return FSCK_USAGE;
}
+ /* We can't open it EXCL. It may be already open rw (in which
+ case we want to deny them access) or it may be mounted as
+ the root file system at boot time (in which case we need to
+ allow it.) We use is_pathname_mounted here even though
+ we're specifying a device name, not a path name. The
+ function checks for device as well. */
+ strncpy(sbp->device_name, opts.device,
+ sizeof(sbp->device_name));
+ sbp->path_name = sbp->device_name; /* This gets overwritten */
+ is_mounted = is_pathname_mounted(sbp, &ro);
+ /* If the device is busy, but not because it's mounted, fail.
+ This protects against cases where the file system is LVM
+ and perhaps mounted on a different node. */
+ if (!is_mounted)
+ goto mount_fail;
+ /* If the device is mounted, but not mounted RO, fail. This
+ protects them against cases where the file system is
+ mounted RW, but still allows us to check our own root
+ file system. */
+ if (!ro)
+ goto mount_fail;
+ /* The device is mounted RO, so it's likely our own root
+ file system. We can only do so much to protect the users
+ from themselves. Try opening without O_EXCL. */
+ if ((sbp->device_fd = open(opts.device, O_RDWR)) < 0)
+ goto mount_fail;
+
+ was_mounted_ro = 1;
}
+
+ /* read in sb from disk */
if (fill_super_block(sbp)) {
stack;
return FSCK_ERROR;
@@ -511,6 +541,10 @@ int initialize(struct gfs2_sbd *sbp, int force_check, int preen,
return FSCK_ERROR;
return FSCK_OK;
+
+mount_fail:
+ log_crit( _("Device %s is busy.\n"), opts.device);
+ return FSCK_USAGE;
}
static void destroy_sbp(struct gfs2_sbd *sbp)
@@ -525,6 +559,15 @@ static void destroy_sbp(struct gfs2_sbd *sbp)
}
empty_super_block(sbp);
close(sbp->device_fd);
+ if (was_mounted_ro && errors_corrected) {
+ sbp->device_fd = open("/proc/sys/vm/drop_caches", O_WRONLY);
+ if (sbp->device_fd >= 0) {
+ write(sbp->device_fd, "2", 1);
+ close(sbp->device_fd);
+ } else
+ log_err( _("fsck.gfs2: Non-fatal error dropping "
+ "caches.\n"));
+ }
}
void destroy(struct gfs2_sbd *sbp)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index c4675f7..d89194c 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -598,6 +598,7 @@ extern int gfs2_query(int *setonabort, struct gfs2_options *opts,
extern int compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
uint32_t *maxheight, uint32_t bsize1, int diptrs, int inptrs);
extern int compute_constants(struct gfs2_sbd *sdp);
+extern int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount);
extern int find_gfs2_meta(struct gfs2_sbd *sdp);
extern int dir_exists(const char *dir);
extern int check_for_gfs2(struct gfs2_sbd *sdp);
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
index deee7b7..6a1425a 100644
--- a/gfs2/libgfs2/misc.c
+++ b/gfs2/libgfs2/misc.c
@@ -98,7 +98,7 @@ int compute_constants(struct gfs2_sbd *sdp)
return 0;
}
-int check_for_gfs2(struct gfs2_sbd *sdp)
+int is_pathname_mounted(struct gfs2_sbd *sdp, int *ro_mount)
{
FILE *fp;
char buffer[PATH_MAX];
@@ -108,14 +108,14 @@ int check_for_gfs2(struct gfs2_sbd *sdp)
char fsoptions[PATH_MAX];
char *realname;
+ *ro_mount = 0;
realname = realpath(sdp->path_name, NULL);
- if (!realname) {
- return -1;
- }
+ if (!realname)
+ return 0;
fp = fopen("/proc/mounts", "r");
if (fp == NULL) {
free(realname);
- return -1;
+ return 0;
}
while ((fgets(buffer, PATH_MAX - 1, fp)) != NULL) {
buffer[PATH_MAX - 1] = 0;
@@ -137,19 +137,31 @@ int check_for_gfs2(struct gfs2_sbd *sdp)
else if (strcmp(fspath, realname) != 0)
continue;
+ if (strncmp(fsoptions, "ro,", 3) == 0 ||
+ strcmp(fsoptions, "ro") == 0)
+ *ro_mount = 1;
fclose(fp);
free(realname);
if (strncmp(sdp->device_name, "/dev/loop", 9) == 0) {
errno = EINVAL;
- return -1;
+ return 0;
}
- return 0;
+ return 1;
}
free(realname);
fclose(fp);
errno = EINVAL;
- return -1;
+ return 0;
+}
+
+int check_for_gfs2(struct gfs2_sbd *sdp)
+{
+ int ro;
+
+ if (!is_pathname_mounted(sdp, &ro))
+ return -1;
+ return 0;
}
static int lock_for_admin(struct gfs2_sbd *sdp)
14 years, 2 months
cluster: RHEL53 - rgmanager: halvm: Check ownership before stripping tags
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: c63b38a92d10c767dad033822f8baaf430be09fb
Parent: 114f3e4edb206505b21152f2fe62474b62938369
Author: Jonathan E. Brassow <jbrassow(a)redhat.com>
AuthorDate: Mon Jan 25 17:56:41 2010 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Thu Jan 28 13:37:12 2010 -0500
rgmanager: halvm: Check ownership before stripping tags
Resolves: rhbz#557167
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/lvm_by_lv.sh | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/resources/lvm_by_lv.sh b/rgmanager/src/resources/lvm_by_lv.sh
index 6691181..1937b9f 100644
--- a/rgmanager/src/resources/lvm_by_lv.sh
+++ b/rgmanager/src/resources/lvm_by_lv.sh
@@ -218,6 +218,15 @@ lv_activate_and_tag()
ocf_log err "Unable to delete tag from $lv_path"
return $OCF_ERR_GENERIC
fi
+
+ if [ `lvs --noheadings -o lv_tags $lv_path` == $tag ]; then
+ ocf_log notice "Removing ownership tag ($tag) from $lv_path"
+ lvchange --deltag $tag $lv_path
+ if [ $? -ne 0 ]; then
+ ocf_log err "Unable to delete tag from $lv_path"
+ return $OCF_ERR_GENERIC
+ fi
+ fi
fi
return $OCF_SUCCESS
14 years, 2 months
cluster: RHEL54 - rgmanager: halvm: Check ownership before stripping tags
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: a5eb8fff0bfbb270b13538018620302e154523b9
Parent: a8d2b47fe7aca0bd061e86fde33be2d28cdef956
Author: Jonathan E. Brassow <jbrassow(a)redhat.com>
AuthorDate: Mon Jan 25 17:56:41 2010 -0500
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Thu Jan 28 13:36:06 2010 -0500
rgmanager: halvm: Check ownership before stripping tags
Resolves: rhbz#557167
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/lvm_by_lv.sh | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/resources/lvm_by_lv.sh b/rgmanager/src/resources/lvm_by_lv.sh
index 6691181..1937b9f 100644
--- a/rgmanager/src/resources/lvm_by_lv.sh
+++ b/rgmanager/src/resources/lvm_by_lv.sh
@@ -218,6 +218,15 @@ lv_activate_and_tag()
ocf_log err "Unable to delete tag from $lv_path"
return $OCF_ERR_GENERIC
fi
+
+ if [ `lvs --noheadings -o lv_tags $lv_path` == $tag ]; then
+ ocf_log notice "Removing ownership tag ($tag) from $lv_path"
+ lvchange --deltag $tag $lv_path
+ if [ $? -ne 0 ]; then
+ ocf_log err "Unable to delete tag from $lv_path"
+ return $OCF_ERR_GENERIC
+ fi
+ fi
fi
return $OCF_SUCCESS
14 years, 2 months
cluster: STABLE3 - Fix white space errors
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: aeaf791266b40f75fa7434064244a80db2a3aa17
Parent: 18858d352d3e2b68f92ff6960e5833c69e59ff13
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Tue Jan 26 14:11:52 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Tue Jan 26 14:39:33 2010 -0600
Fix white space errors
This patch cleans up some whitespace issues with the previous 57 patches.
rhbz#455300
---
gfs2/convert/gfs2_convert.c | 2 +-
gfs2/fsck/lost_n_found.c | 2 +-
gfs2/fsck/metawalk.c | 4 ++--
gfs2/fsck/pass1.c | 4 ++--
gfs2/fsck/pass1b.c | 3 +--
gfs2/fsck/pass2.c | 2 +-
gfs2/fsck/util.c | 2 +-
gfs2/include/osi_tree.h | 4 ++--
gfs2/libgfs2/gfs2_log.c | 6 +++---
9 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 5d8d9cd..a9e42cb 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -416,7 +416,7 @@ static int adjust_indirect_blocks(struct gfs2_sbd *sbp, struct gfs2_inode *ip)
int error = 0, di_height;
struct blocklist blocks, *blk, *newblk;
struct metapath gfs2mp;
- struct gfs2_buffer_head *dibh = ip->i_bh;
+ struct gfs2_buffer_head *dibh = ip->i_bh;
/* if there are no indirect blocks to check */
if (ip->i_di.di_height <= 1)
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
index c5051f9..4a3a926 100644
--- a/gfs2/fsck/lost_n_found.c
+++ b/gfs2/fsck/lost_n_found.c
@@ -173,7 +173,7 @@ int add_inode_to_lf(struct gfs2_inode *ip){
reprocess_inode(lf_dip, "lost+found");
/* This inode is linked from lost+found */
- increment_link(ip->i_di.di_num.no_addr, lf_dip->i_di.di_num.no_addr,
+ increment_link(ip->i_di.di_num.no_addr, lf_dip->i_di.di_num.no_addr,
_("from lost+found"));
/* If it's a directory, lost+found is back-linked to it via .. */
if(S_ISDIR(ip->i_di.di_mode))
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 4ab2603..0f18733 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1219,8 +1219,8 @@ fail:
* This does not include "data" blocks that are really
* hash table blocks for directories.
*
- * @ip:
- *
+ * @ip:
+ *
* returns: +ENOENT if there are too many bad pointers
* -1 if a more serious error occurred.
* 0 if no errors occurred
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 79cf8a7..a3cd7f7 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -144,7 +144,7 @@ static int check_metalist(struct gfs2_inode *ip, uint64_t block,
log_err( _("Found duplicate block %llu (0x%llx) referenced "
"as metadata in indirect block for dinode "
"%llu (0x%llx) - was marked %d (%s)\n"),
- (unsigned long long)block,
+ (unsigned long long)block,
(unsigned long long)block,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr, q,
@@ -207,7 +207,7 @@ static int undo_check_metalist(struct gfs2_inode *ip, uint64_t block,
log_err( _("Reversing duplicate status of block %llu (0x%llx) "
"referenced as metadata in indirect block for "
"dinode %llu (0x%llx)\n"),
- (unsigned long long)block,
+ (unsigned long long)block,
(unsigned long long)block,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr);
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index e8e7428..5554325 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -533,7 +533,7 @@ static int handle_dup_blk(struct gfs2_sbd *sbp, struct duptree *b)
log_inode_reference(b, tmp, 1);
osi_list_foreach(tmp, &b->ref_inode_list)
log_inode_reference(b, tmp, 0);
-
+
last_reference = clear_a_reference(sbp, b, &b->ref_invinode_list,
&dh, 1);
if (!last_reference)
@@ -590,7 +590,6 @@ static int handle_dup_blk(struct gfs2_sbd *sbp, struct duptree *b)
log_debug( _("All duplicate references were resolved.\n"));
}
return 0;
-
}
/* Pass 1b handles finding the previous inode for a duplicate block
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 9bb3e78..35acba4 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -227,7 +227,7 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
log_err( _("Bad directory entry deleted.\n"));
return 1;
}
-
+
calculated_hash = gfs2_disk_hash(tmp_name, de->de_name_len);
if (de->de_hash != calculated_hash){
log_err( _("Dir entry with bad hash or name length\n"
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index 9827300..6fe05ab 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -127,7 +127,7 @@ int fsck_query(const char *format, ...)
errors_corrected++;
ret = 1;
break;
- } else if (tolower(response) == 'n') {
+ } else if (tolower(response) == 'n') {
ret = 0;
break;
} else {
diff --git a/gfs2/include/osi_tree.h b/gfs2/include/osi_tree.h
index 4ffae94..f0d0768 100644
--- a/gfs2/include/osi_tree.h
+++ b/gfs2/include/osi_tree.h
@@ -329,7 +329,7 @@ static inline struct osi_node *osi_next(struct osi_node *node)
/* If we have a right-hand child, go down and then left as far
as we can. */
if (node->osi_right) {
- node = node->osi_right;
+ node = node->osi_right;
while (node->osi_left)
node=node->osi_left;
return node;
@@ -354,7 +354,7 @@ static inline struct osi_node *osi_prev(struct osi_node *node)
/* If we have a left-hand child, go down and then right as far
as we can. */
if (node->osi_left) {
- node = node->osi_left;
+ node = node->osi_left;
while (node->osi_right)
node=node->osi_right;
return node;
diff --git a/gfs2/libgfs2/gfs2_log.c b/gfs2/libgfs2/gfs2_log.c
index c349840..75a06a7 100644
--- a/gfs2/libgfs2/gfs2_log.c
+++ b/gfs2/libgfs2/gfs2_log.c
@@ -176,9 +176,9 @@ int gfs2_query(int *setonabort, struct gfs2_options *opts,
}
printf("Continuing.\n");
} else if(tolower(response) == 'y') {
- ret = 1;
- break;
- } else if (tolower(response) == 'n') {
+ ret = 1;
+ break;
+ } else if (tolower(response) == 'n') {
ret = 0;
break;
} else {
14 years, 2 months
cluster: STABLE3 - fsck.gfs2: If journal replay fails, give option to reinitialize journal
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 18858d352d3e2b68f92ff6960e5833c69e59ff13
Parent: 745f9cb9576a0d76023ce4509b9b3322923ed10a
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Mon Jan 25 17:07:34 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Tue Jan 26 14:39:33 2010 -0600
fsck.gfs2: If journal replay fails, give option to reinitialize journal
When fsck.gfs2 finds a dirty journal, it tries (with permission) to
replay the journal. However, if replaying the journal fails, the
user is left with no recourse. Their file system is now useless.
This patch gives them the option to reinitialize the journal that
failed, thereby allowing them the ability to mount it again.
rhbz#455300
---
gfs2/fsck/fs_recovery.c | 67 +++++++++++++++++++++++++---------------------
1 files changed, 36 insertions(+), 31 deletions(-)
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index ce3aaa5..05f41e4 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -504,42 +504,47 @@ static int gfs2_recover_journal(struct gfs2_inode *ip, int j, int preen,
error = FSCK_ERROR;
goto out;
}
- if (query( _("\nJournal #%d (\"journal%d\") is dirty. Okay to "
- "replay it? (y/n)"), j+1, j)) {
- log_info( _("jid=%u: Replaying journal...\n"), j);
-
- sd_found_jblocks = sd_replayed_jblocks = 0;
- sd_found_metablocks = sd_replayed_metablocks = 0;
- sd_found_revokes = 0;
- sd_replay_tail = head.lh_tail;
- for (pass = 0; pass < 2; pass++) {
- error = foreach_descriptor(ip, head.lh_tail,
- head.lh_blkno, pass);
- if (error)
- goto out;
- }
- log_info( _("jid=%u: Found %u revoke tags\n"), j,
- sd_found_revokes);
- gfs2_revoke_clean(sdp);
- error = clean_journal(ip, &head);
+ if (!query( _("\nJournal #%d (\"journal%d\") is dirty. Okay to "
+ "replay it? (y/n)"), j+1, j))
+ goto reinit;
+
+ log_info( _("jid=%u: Replaying journal...\n"), j);
+
+ sd_found_jblocks = sd_replayed_jblocks = 0;
+ sd_found_metablocks = sd_replayed_metablocks = 0;
+ sd_found_revokes = 0;
+ sd_replay_tail = head.lh_tail;
+ for (pass = 0; pass < 2; pass++) {
+ error = foreach_descriptor(ip, head.lh_tail,
+ head.lh_blkno, pass);
if (error)
goto out;
- log_err( _("jid=%u: Replayed %u of %u journaled data blocks\n"),
- j, sd_replayed_jblocks, sd_found_jblocks);
- log_err( _("jid=%u: Replayed %u of %u metadata blocks\n"),
- j, sd_replayed_metablocks, sd_found_metablocks);
- } else {
- if (query( _("Do you want to clear the dirty journal instead? (y/n)"))) {
- write_journal(sdp, sdp->md.journal[j], j,
- sdp->md.journal[j]->i_di.di_size /
- sdp->sd_sb.sb_bsize);
-
- } else
- log_err( _("jid=%u: Dirty journal not replayed or cleared.\n"), j);
}
+ log_info( _("jid=%u: Found %u revoke tags\n"), j, sd_found_revokes);
+ gfs2_revoke_clean(sdp);
+ error = clean_journal(ip, &head);
+ if (error)
+ goto out;
+ log_err( _("jid=%u: Replayed %u of %u journaled data blocks\n"),
+ j, sd_replayed_jblocks, sd_found_jblocks);
+ log_err( _("jid=%u: Replayed %u of %u metadata blocks\n"),
+ j, sd_replayed_metablocks, sd_found_metablocks);
+ /* Check for errors and give them the option to reinitialize the
+ journal. */
out:
- log_info( _("jid=%u: %s\n"), j, (error) ? _("Failed") : _("Done"));
+ if (!error) {
+ log_info( _("jid=%u: Done\n"), j);
+ return 0;
+ }
+ log_info( _("jid=%u: Failed\n"), j);
+reinit:
+ if (query( _("Do you want to clear the journal instead? (y/n)")))
+ error = write_journal(sdp, sdp->md.journal[j], j,
+ sdp->md.journal[j]->i_di.di_size /
+ sdp->sd_sb.sb_bsize);
+ else
+ log_err( _("jid=%u: journal not cleared.\n"), j);
return error;
}
14 years, 2 months
cluster: STABLE3 - Misc cleanups
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 745f9cb9576a0d76023ce4509b9b3322923ed10a
Parent: 28fd084202addc60b3dc0b064bd24179aac451c4
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Mon Jan 25 17:02:45 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Tue Jan 26 14:39:33 2010 -0600
Misc cleanups
This is a collection of benign cleanups.
rhbz#455300
---
gfs2/fsck/pass1.c | 8 ++++----
gfs2/fsck/pass2.c | 4 ++--
gfs2/libgfs2/block_list.c | 16 ----------------
gfs2/libgfs2/fs_ops.c | 9 ++++-----
gfs2/libgfs2/libgfs2.h | 6 ------
5 files changed, 10 insertions(+), 33 deletions(-)
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index f50c4b6..79cf8a7 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -443,7 +443,7 @@ static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
if(gfs2_check_range(sdp, indirect)) {
/*log_warn("EA indirect block #%"PRIu64" is out of range.\n",
indirect);
- gfs2_blockmap_set(bl, parent, bad_block);*/
+ fsck_blockmap_set(parent, "bad", bad_block);*/
/* Doesn't help to mark this here - this gets checked
* in pass1c */
return 1;
@@ -1014,7 +1014,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh)
if (S_ISDIR(ip->i_di.di_mode) &&
(ip->i_di.di_flags & GFS2_DIF_EXHASH)) {
if (((1 << ip->i_di.di_depth) * sizeof(uint64_t)) != ip->i_di.di_size){
- log_warn( _("Directory dinode #%llu (0x%llx"
+ log_warn( _("Directory dinode block #%llu (0x%llx"
") has bad depth. Found %u, Expected %u\n"),
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr,
@@ -1142,8 +1142,8 @@ int pass1(struct gfs2_sbd *sbp)
log_debug( _("rgrp block %lld (0x%llx) "
"is now marked as 'rgrp data'\n"),
rgd->ri.ri_addr + i, rgd->ri.ri_addr + i);
- if(gfs2_blockmap_set(bl, rgd->ri.ri_addr + i,
- gfs2_meta_rgrp)){
+ if (gfs2_blockmap_set(bl, rgd->ri.ri_addr + i,
+ gfs2_meta_rgrp)) {
stack;
return FSCK_ERROR;
}
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 08dd5a4..9bb3e78 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -284,8 +284,8 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
(unsigned long long)ip->i_di.di_num.no_addr,
(unsigned long long)ip->i_di.di_num.no_addr,
q, q == gfs2_inode_invalid ?
- _("previously marked invalid") :
- _("is not an inode"));
+ _("was previously marked invalid") :
+ _("was deleted or is not an inode"));
if(!query( _("Clear directory entry to non-inode block? "
"(y/n) "))) {
diff --git a/gfs2/libgfs2/block_list.c b/gfs2/libgfs2/block_list.c
index 2c1bfc9..faedc54 100644
--- a/gfs2/libgfs2/block_list.c
+++ b/gfs2/libgfs2/block_list.c
@@ -109,22 +109,6 @@ void gfs2_special_clear(struct special_blocks *blocklist, uint64_t block)
}
}
-/* gfs2_block_unmark clears ONE mark for the given block */
-int gfs2_block_unmark(struct gfs2_sbd *sdp, struct gfs2_bmap *bmap,
- uint64_t block, enum gfs2_mark_block mark)
-{
- static unsigned char *byte;
- static uint64_t b;
-
- if(block > bmap->size)
- return -1;
-
- byte = bmap->map + BLOCKMAP_SIZE4(block);
- b = BLOCKMAP_BYTE_OFFSET4(block);
- *byte &= ~(BLOCKMAP_MASK4 << b);
- return 0;
-}
-
int gfs2_blockmap_set(struct gfs2_bmap *bmap, uint64_t bblock,
enum gfs2_mark_block mark)
{
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 35721fa..8573dac 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -707,7 +707,7 @@ int gfs2_dirent_next(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
bh_end = bh->b_data + dip->i_sbd->bsize;
cur_rec_len = be16_to_cpu((*dent)->de_rec_len);
- if ((char *)(*dent) + cur_rec_len >= bh_end)
+ if (cur_rec_len == 0 || (char *)(*dent) + cur_rec_len >= bh_end)
return -ENOENT;
*dent = (struct gfs2_dirent *)((char *)(*dent) + cur_rec_len);
@@ -1405,7 +1405,6 @@ static int leaf_search(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
static int linked_leaf_search(struct gfs2_inode *dip, const char *filename,
int len, struct gfs2_dirent **dent_out,
- struct gfs2_dirent **dent_prev,
struct gfs2_buffer_head **bh_out)
{
struct gfs2_buffer_head *bh = NULL, *bh_next;
@@ -1432,8 +1431,8 @@ static int linked_leaf_search(struct gfs2_inode *dip, const char *filename,
brelse(bh);
bh = bh_next;
-
- error = leaf_search(dip, bh, filename, len, dent_out, dent_prev);
+
+ error = leaf_search(dip, bh, filename, len, dent_out, NULL);
switch (error){
case 0:
*bh_out = bh;
@@ -1472,7 +1471,7 @@ static int dir_e_search(struct gfs2_inode *dip, const char *filename,
struct gfs2_dirent *dent;
int error;
- error = linked_leaf_search(dip, filename, len, &dent, NULL, &bh);
+ error = linked_leaf_search(dip, filename, len, &dent, &bh);
if (error)
return error;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 0e7e1b4..c4675f7 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -351,12 +351,6 @@ extern int gfs2_blockmap_set(struct gfs2_bmap *il, uint64_t block,
enum gfs2_mark_block mark);
extern void gfs2_special_clear(struct special_blocks *blocklist,
uint64_t block);
-/* gfs2_block_unmark clears ONE mark for the given block */
-extern int gfs2_block_unmark(struct gfs2_sbd *sdp, struct gfs2_bmap *il,
- uint64_t block, enum gfs2_mark_block m);
-/* gfs2_block_clear clears all the marks for the given block */
-extern int gfs2_blockmap_clear(struct gfs2_sbd *sdp, struct gfs2_bmap *il,
- uint64_t block);
extern void *gfs2_bmap_destroy(struct gfs2_sbd *sdp, struct gfs2_bmap *il);
/* buf.c */
14 years, 2 months
cluster: STABLE3 - fsck.gfs2: Free, don't invalidate, dinodes with bad depth
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 28fd084202addc60b3dc0b064bd24179aac451c4
Parent: 8d754e9b2381229d8687f40b4ad0d81b8a0b3467
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Mon Jan 25 14:58:36 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Tue Jan 26 14:39:33 2010 -0600
fsck.gfs2: Free, don't invalidate, dinodes with bad depth
This patch makes fsck.gfs2 free up dinodes with an invalid depth
rather than marking them invalid. If we mark them invalid, the
invalid depth itself will confuse the code that later tries to free
the metadata associated with the bad dinode.
rhbz#455300
---
gfs2/fsck/pass1.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 8bb5915..f50c4b6 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -1021,7 +1021,7 @@ static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh)
ip->i_di.di_depth,
(1 >> (ip->i_di.di_size/sizeof(uint64_t))));
if(fsck_blockmap_set(ip, block, _("bad depth"),
- gfs2_meta_inval)) {
+ gfs2_block_free)) {
stack;
fsck_inode_put(&ip);
return -1;
14 years, 2 months
cluster: STABLE3 - fsck.gfs2: small parameter passing optimization
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 8d754e9b2381229d8687f40b4ad0d81b8a0b3467
Parent: 9f288bf60cc6d6b5285ba207d277a382c53f8460
Author: Bob Peterson <bob(a)ganesha.peterson>
AuthorDate: Mon Jan 25 14:54:39 2010 -0600
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Tue Jan 26 14:39:32 2010 -0600
fsck.gfs2: small parameter passing optimization
This patch is a small optimization in a very often-used function,
done for performance purposes. Function handle_di in pass1 derives
the block number from the buffer already passed in rather than
having the block number passed in as well, and wasting time
pushing it to the stack and off the stack.
rhbz#455300
---
gfs2/fsck/pass1.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index aab44a9..8bb5915 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -865,13 +865,13 @@ struct metawalk_fxns rangecheck_fxns = {
.check_eattr_leaf = rangecheck_eattr_leaf,
};
-static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
- uint64_t block)
+static int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh)
{
uint8_t q;
struct gfs2_inode *ip;
int error;
struct block_count bc = {0};
+ uint64_t block = bh->b_blocknr;
long bad_pointers;
q = block_type(block);
@@ -1190,7 +1190,7 @@ int pass1(struct gfs2_sbd *sbp)
}
check_n_fix_bitmap(sbp, block,
gfs2_block_free);
- } else if (handle_di(sbp, bh, block) < 0) {
+ } else if (handle_di(sbp, bh) < 0) {
stack;
brelse(bh);
return FSCK_ERROR;
14 years, 2 months