Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=11…
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
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=a1…
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)
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdif…
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)
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=28…
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;
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=8d…
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;