mirror of https://github.com/vitalif/e2fsprogs
Fix read/write badblocks testing in mke2fs and e2fsck
The exlcusive device safety check that was added inadvertently broke e2fsck -cc and mke2fs -cc since e2fsck and mke2fs hold the device in exclusive access when badblocks is run. So we add a private option to badblocks, -X, which is passed by e2fsck and mke2fs to badblocks to indicate that it is OK to skip the EXT2_MF_BUSY checks. Addresses Debian Bug: #366017 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>bitmap-optimize
parent
7eef874831
commit
f63978aff7
|
@ -1,3 +1,8 @@
|
|||
2006-05-13 Theodore Tso <tytso@mit.edu>
|
||||
|
||||
* badblocks.c (read_bad_blocks_file): Pass the private option -X
|
||||
to badblocks so that e2fsck -cc will work correctly.
|
||||
|
||||
2006-05-08 Theodore Tso <tytso@mit.edu>
|
||||
|
||||
* pass5.c (check_block_bitmaps, check_inode_bitmaps): Add support
|
||||
|
|
|
@ -72,7 +72,7 @@ void read_bad_blocks_file(e2fsck_t ctx, const char *bad_blocks_file,
|
|||
goto fatal;
|
||||
}
|
||||
} else {
|
||||
sprintf(buf, "badblocks -b %d %s%s%s %d", fs->blocksize,
|
||||
sprintf(buf, "badblocks -b %d -X %s%s%s %d", fs->blocksize,
|
||||
(ctx->options & E2F_OPT_PREEN) ? "" : "-s ",
|
||||
(ctx->options & E2F_OPT_WRITECHECK) ? "-n " : "",
|
||||
fs->device_name, fs->super->s_blocks_count);
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
2006-05-13 Theodore Tso <tytso@mit.edu>
|
||||
|
||||
* mke2fs.c (test_disk): Pass the private option -X to badblocks so
|
||||
that mke2fs -cc works again. (Addresses Debian bug:
|
||||
#366017)
|
||||
|
||||
* badblocks.c (main, check_mount): Add a private option, -X, which
|
||||
is only intended for use by mke2fs and e2fsck to signal
|
||||
that it's OK to skip the EXT2_MF_BUSY test since mke2fs
|
||||
and e2fsck already have the block device opened
|
||||
exclusively (and therefore no one else does).
|
||||
|
||||
2006-05-08 Theodore Tso <tytso@mit.edu>
|
||||
|
||||
* mke2fs.c (write_inode_tables, setup_lazy_bg, main): Add support
|
||||
|
|
|
@ -57,7 +57,7 @@ extern int optind;
|
|||
#include "nls-enable.h"
|
||||
|
||||
const char * program_name = "badblocks";
|
||||
const char * done_string = N_("done \n");
|
||||
const char * done_string = N_("done \n");
|
||||
|
||||
static int v_flag = 0; /* verbose */
|
||||
static int w_flag = 0; /* do r/w test: 0=no, 1=yes,
|
||||
|
@ -68,6 +68,7 @@ static int t_flag = 0; /* number of test patterns */
|
|||
static int t_max = 0; /* allocated test patterns */
|
||||
static unsigned long *t_patts = NULL; /* test patterns */
|
||||
static int current_O_DIRECT = 0; /* Current status of O_DIRECT flag */
|
||||
static int exclusive_ok = 0;
|
||||
|
||||
#define T_INC 32
|
||||
|
||||
|
@ -792,7 +793,7 @@ static void check_mount(char *device_name)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
if (mount_flags & EXT2_MF_BUSY) {
|
||||
if ((mount_flags & EXT2_MF_BUSY) && !exclusive_ok) {
|
||||
fprintf(stderr, _("%s is apparently in use by the system; "),
|
||||
device_name);
|
||||
if (force)
|
||||
|
@ -852,7 +853,7 @@ int main (int argc, char ** argv)
|
|||
|
||||
if (argc && *argv)
|
||||
program_name = *argv;
|
||||
while ((c = getopt (argc, argv, "b:fi:o:svwnc:p:h:t:")) != EOF) {
|
||||
while ((c = getopt (argc, argv, "b:fi:o:svwnc:p:h:t:X")) != EOF) {
|
||||
switch (c) {
|
||||
case 'b':
|
||||
block_size = strtoul (optarg, &tmp, 0);
|
||||
|
@ -938,6 +939,9 @@ int main (int argc, char ** argv)
|
|||
t_patts[t_flag++] = pattern;
|
||||
}
|
||||
break;
|
||||
case 'X':
|
||||
exclusive_ok++;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ static void test_disk(ext2_filsys fs, badblocks_list *bb_list)
|
|||
errcode_t retval;
|
||||
char buf[1024];
|
||||
|
||||
sprintf(buf, "badblocks -b %d %s%s%s %d", fs->blocksize,
|
||||
sprintf(buf, "badblocks -b %d -X %s%s%s %d", fs->blocksize,
|
||||
quiet ? "" : "-s ", (cflag > 1) ? "-w " : "",
|
||||
fs->device_name, fs->super->s_blocks_count);
|
||||
if (verbose)
|
||||
|
|
Loading…
Reference in New Issue