* Tue Oct 23 2007 Eric Sandeen <esandeen@redhat.com> 1.40.2-11
- Add arm to multilib header wrapper
This commit is contained in:
parent
5ec361ecc1
commit
8718d2dc3a
@ -19,6 +19,8 @@
|
|||||||
#include "blkid_types-x86_64.h"
|
#include "blkid_types-x86_64.h"
|
||||||
#elif defined(__alpha__)
|
#elif defined(__alpha__)
|
||||||
#include "blkid_types-alpha.h"
|
#include "blkid_types-alpha.h"
|
||||||
|
#elif defined(__arm__)
|
||||||
|
#include "blkid_types-arm.h"
|
||||||
#else
|
#else
|
||||||
#error "This e2fsprogs-devel package does not work your architecture?"
|
#error "This e2fsprogs-devel package does not work your architecture?"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,168 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date Tue Sep 12 14:56:17 2006 -0400
|
|
||||||
# Node ID 7e1e8751d2be27716166e88453b52273b7096039
|
|
||||||
# parent: 1aa8aca8acebca38b38ee003c17a045bc5fde185
|
|
||||||
Add checks to make sure inode counts don't overflow a 32-bit value
|
|
||||||
|
|
||||||
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
@@ -6,6 +6,10 @@
|
|
||||||
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * unix.c (show_stats): use ext2_ino_t for inode containers.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* e2fsck.h (e2fsck): Use unsigned types for filesystem counters.
|
|
||||||
* emptydir.c (add_empty_dirblock):
|
|
||||||
* iscan.c (main):
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/unix.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/unix.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/unix.c
|
|
||||||
@@ -98,7 +98,7 @@ static void usage(e2fsck_t ctx)
|
|
||||||
static void show_stats(e2fsck_t ctx)
|
|
||||||
{
|
|
||||||
ext2_filsys fs = ctx->fs;
|
|
||||||
- __u32 inodes, inodes_used;
|
|
||||||
+ ext2_ino_t inodes, inodes_used;
|
|
||||||
blk_t blocks, blocks_used;
|
|
||||||
int dir_links;
|
|
||||||
int num_files, num_links;
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
@@ -8,6 +8,11 @@
|
|
||||||
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * initialize.c (ext2fs_initialize): Make sure inode count does
|
|
||||||
+ not overflow 32 bits.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* bmove.c (process_block):
|
|
||||||
* getsize.c (main):
|
|
||||||
* icount.c (ext2fs_create_icount2, insert_icount_el):
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/initialize.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/initialize.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/initialize.c
|
|
||||||
@@ -246,9 +246,8 @@ retry:
|
|
||||||
if (ipg > (unsigned) EXT2_MAX_INODES_PER_GROUP(super))
|
|
||||||
ipg = EXT2_MAX_INODES_PER_GROUP(super);
|
|
||||||
|
|
||||||
+ipg_retry:
|
|
||||||
super->s_inodes_per_group = ipg;
|
|
||||||
- if (super->s_inodes_count > ipg * fs->group_desc_count)
|
|
||||||
- super->s_inodes_count = ipg * fs->group_desc_count;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Make sure the number of inodes per group completely fills
|
|
||||||
@@ -276,6 +275,10 @@ retry:
|
|
||||||
/*
|
|
||||||
* adjust inode count to reflect the adjusted inodes_per_group
|
|
||||||
*/
|
|
||||||
+ if ((__u64)super->s_inodes_per_group * fs->group_desc_count > ~0U) {
|
|
||||||
+ ipg--;
|
|
||||||
+ goto ipg_retry;
|
|
||||||
+ }
|
|
||||||
super->s_inodes_count = super->s_inodes_per_group *
|
|
||||||
fs->group_desc_count;
|
|
||||||
super->s_free_inodes_count = super->s_inodes_count;
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
@@ -5,6 +5,10 @@
|
|
||||||
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * mke2fs.c (PRS): Disallow > 2^32 inodes at mkfs time.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* dumpe2fs.c (list_bad_blocks):
|
|
||||||
* e2image.c (output_meta_data_blocks, write_raw_image_file):
|
|
||||||
* mke2fs.c (test_disk, handle_bad_blocks): Fix printf formats.
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/mke2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c
|
|
||||||
@@ -895,7 +895,7 @@ static void PRS(int argc, char *argv[])
|
|
||||||
double reserved_ratio = 5.0;
|
|
||||||
int sector_size = 0;
|
|
||||||
int show_version_only = 0;
|
|
||||||
- ext2_ino_t num_inodes = 0;
|
|
||||||
+ __u64 num_inodes = 0; /* u64 to catch too-large input */
|
|
||||||
errcode_t retval;
|
|
||||||
char * oldpath = getenv("PATH");
|
|
||||||
char * extended_opts = 0;
|
|
||||||
@@ -1430,6 +1430,21 @@ static void PRS(int argc, char *argv[])
|
|
||||||
fs_param.s_inode_size = inode_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ /* Make sure number of inodes specified will fit in 32 bits */
|
|
||||||
+ if (num_inodes == 0) {
|
|
||||||
+ __u64 n;
|
|
||||||
+ n = (__u64) fs_param.s_blocks_count * blocksize / inode_ratio;
|
|
||||||
+ if (n > ~0U) {
|
|
||||||
+ com_err(program_name, 0,
|
|
||||||
+ _("too many inodes (%llu), raise inode ratio?"), n);
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+ } else if (num_inodes > ~0U) {
|
|
||||||
+ com_err(program_name, 0,
|
|
||||||
+ _("too many inodes (%llu), specify < 2^32 inodes"),
|
|
||||||
+ (__u64)num_inodes);
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
/*
|
|
||||||
* Calculate number of inodes based on the inode ratio
|
|
||||||
*/
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
@@ -1,5 +1,9 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * resize2fs.c (adjust_fs_info): Disallow > 2^32 indoes at resize time.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* online.c (online_resize_fs): Fix printf formats.
|
|
||||||
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/resize2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c
|
|
||||||
@@ -186,6 +186,7 @@ errcode_t adjust_fs_info(ext2_filsys fs,
|
|
||||||
unsigned long i, j, old_desc_blocks, max_group;
|
|
||||||
unsigned int meta_bg, meta_bg_size;
|
|
||||||
int has_super;
|
|
||||||
+ __u64 new_inodes; /* u64 to check for overflow */
|
|
||||||
|
|
||||||
fs->super->s_blocks_count = new_size;
|
|
||||||
|
|
||||||
@@ -226,6 +227,12 @@ retry:
|
|
||||||
/*
|
|
||||||
* Adjust the number of inodes
|
|
||||||
*/
|
|
||||||
+ new_inodes =(__u64)fs->super->s_inodes_per_group * fs->group_desc_count;
|
|
||||||
+ if (new_inodes > ~0U) {
|
|
||||||
+ fprintf(stderr, _("inodes (%llu) must be less than %u"),
|
|
||||||
+ new_inodes, ~0U);
|
|
||||||
+ return EXT2_ET_TOO_MANY_INODES;
|
|
||||||
+ }
|
|
||||||
fs->super->s_inodes_count = fs->super->s_inodes_per_group *
|
|
||||||
fs->group_desc_count;
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
|||||||
Theodore Tso schrieb:
|
|
||||||
> > On Mon, Jun 11, 2007 at 01:51:24PM +0200, Karsten Hopp wrote:
|
|
||||||
>> >> +static int probe_luks(struct blkid_probe *probe,
|
|
||||||
>> >> + struct blkid_magic *id __BLKID_ATTR((unused)),
|
|
||||||
>> >> + unsigned char *buf)
|
|
||||||
>> >> +{
|
|
||||||
>> >> + unsigned char *p_buf = buf;
|
|
||||||
>> >> + unsigned char uuid[40];
|
|
||||||
>> >> + /* 168 is the offset to the 40 character uuid:
|
|
||||||
>> >> + * http://luks.endorphin.org/LUKS-on-disk-format.pdf */
|
|
||||||
>> >> + p_buf += 168;
|
|
||||||
>> >> + strncpy(uuid, p_buf, 40);
|
|
||||||
> >
|
|
||||||
> > Why bother with p_buf? It would actually be shorter and sweeter to
|
|
||||||
> > do:
|
|
||||||
> >
|
|
||||||
> > strncpy(uuid, buf+168, 40);
|
|
||||||
> >
|
|
||||||
> > And remove the lines dealing with p_buf above.
|
|
||||||
> >
|
|
||||||
>> >> + { "crypt_LUKS",0, 0, 6, "LUKS\xba\xbe", probe_luks },
|
|
||||||
> >
|
|
||||||
> > Any particular reason to use "crypt_LUKS" instead of just "LUKS"? In
|
|
||||||
> > your documentation you generally just refer to it as LUKS.
|
|
||||||
> >
|
|
||||||
> > - Ted
|
|
||||||
|
|
||||||
I've used 'luks' in my first patch, but changed it to 'crypt_LUKS' when
|
|
||||||
Karel Zak pointed out that libvolume_id from udev already uses 'crypt_LUKS'
|
|
||||||
for this.
|
|
||||||
My first patch also did some other (unnecessary) stuff with p_buf and I just
|
|
||||||
didn't bother to remove it.
|
|
||||||
I'll attach a new patch without p_buf.
|
|
||||||
|
|
||||||
Karsten
|
|
||||||
|
|
||||||
--
|
|
||||||
Karsten Hopp | Mail: karsten@redhat.de
|
|
||||||
Red Hat Deutschland | Tel: +49-711-96437-0
|
|
||||||
Hauptstaetterstr.58 | Fax: +49-711-613590
|
|
||||||
D-70178 Stuttgart | http://www.redhat.de
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
e2fsprogs-1.39-luks.patch
|
|
||||||
Problem: libblkid doesn't detect/report UUIDs of cryptsetup-luks partitio
|
|
||||||
ns
|
|
||||||
Solution: Add probe for luks UUID
|
|
||||||
Signed-off-by: Karsten Hopp <karsten@redhat.com>
|
|
||||||
|
|
||||||
--- e2fsprogs-1.39/lib/blkid/ChangeLog.luksuuid 2007-06-11 13:40:14.000000000 +0200
|
|
||||||
+++ e2fsprogs-1.39/lib/blkid/ChangeLog 2007-06-11 13:40:14.000000000 +0200
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+2007-05-22 Karsten Hopp <karsten@redhat.com>
|
|
||||||
+
|
|
||||||
+ * probe.c (probe_luks): Add support for cryptsetup-luks partitions
|
|
||||||
+
|
|
||||||
--- e2fsprogs-1.39/lib/blkid/probe.c.luksuuid 2007-06-11 13:40:14.000000000 +0200
|
|
||||||
+++ e2fsprogs-1.39/lib/blkid/probe.c 2007-06-13 12:50:27.000000000 +0200
|
|
||||||
@@ -468,6 +468,18 @@ static int probe_jfs(struct blkid_probe
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int probe_luks(struct blkid_probe *probe,
|
|
||||||
+ struct blkid_magic *id __BLKID_ATTR((unused)),
|
|
||||||
+ unsigned char *buf)
|
|
||||||
+{
|
|
||||||
+ unsigned char uuid[40];
|
|
||||||
+ /* 168 is the offset to the 40 character uuid:
|
|
||||||
+ * http://luks.endorphin.org/LUKS-on-disk-format.pdf */
|
|
||||||
+ strncpy(uuid, buf+168, 40);
|
|
||||||
+ blkid_set_tag(probe->dev, "UUID", uuid, sizeof(uuid));
|
|
||||||
+ return 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static int probe_romfs(struct blkid_probe *probe,
|
|
||||||
struct blkid_magic *id __BLKID_ATTR((unused)),
|
|
||||||
unsigned char *buf)
|
|
||||||
@@ -775,6 +787,7 @@ static struct blkid_magic type_array[] =
|
|
||||||
{ "ocfs2", 2, 0, 6, "OCFSV2", probe_ocfs2 },
|
|
||||||
{ "ocfs2", 4, 0, 6, "OCFSV2", probe_ocfs2 },
|
|
||||||
{ "ocfs2", 8, 0, 6, "OCFSV2", probe_ocfs2 },
|
|
||||||
+ { "crypt_LUKS",0, 0, 6, "LUKS\xba\xbe", probe_luks },
|
|
||||||
{ NULL, 0, 0, 0, NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
--- e2fsprogs-1.39/lib/blkid/devname.c.foo 2006-07-20 16:48:07.000000000 -0400
|
|
||||||
+++ e2fsprogs-1.39/lib/blkid/devname.c 2006-07-20 16:48:18.000000000 -0400
|
|
||||||
@@ -291,7 +291,7 @@
|
|
||||||
|
|
||||||
names = (void *)names + next;
|
|
||||||
|
|
||||||
- rc = asprintf(&device, "/dev/mapper/%s", names->name);
|
|
||||||
+ rc = asprintf(&device, "mapper/%s", names->name);
|
|
||||||
if (rc < 0)
|
|
||||||
goto try_next;
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
--- e2fsprogs-1.39/lib/blkid/probe.c.fatlabel 2006-09-17 15:45:54.000000000 +0200
|
|
||||||
+++ e2fsprogs-1.39/lib/blkid/probe.c 2006-09-17 15:46:32.000000000 +0200
|
|
||||||
@@ -348,8 +348,8 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vol_label && memcmp(vol_label, no_name, 11)) {
|
|
||||||
- label = vol_label;
|
|
||||||
- label_len = figure_label_len(vol_label, 11);
|
|
||||||
+ if ((label_len = figure_label_len(vol_label, 11)))
|
|
||||||
+ label = vol_label;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* We can't just print them as %04X, because they are unaligned */
|
|
||||||
--- e2fsprogs-1.39/lib/blkid/ChangeLog.fatlabel 2006-09-17 15:51:05.000000000 +0200
|
|
||||||
+++ e2fsprogs-1.39/lib/blkid/ChangeLog 2006-09-17 15:52:37.000000000 +0200
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+2006-09-17 Karel Zak <kzak@redhat.com>
|
|
||||||
+
|
|
||||||
+ * probe.c (probe_fat): Fix problem with empty FAT label.
|
|
||||||
+
|
|
@ -1,126 +0,0 @@
|
|||||||
--- e2fsprogs-1.39/lib/blkid/probe.c.gfs 2006-05-14 23:24:09.000000000 +0200
|
|
||||||
+++ e2fsprogs-1.39/lib/blkid/probe.c 2006-07-10 08:15:11.000000000 +0200
|
|
||||||
@@ -646,6 +646,50 @@
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static int probe_gfs(struct blkid_probe *probe,
|
|
||||||
+ struct blkid_magic *id __BLKID_ATTR((unused)),
|
|
||||||
+ unsigned char *buf)
|
|
||||||
+{
|
|
||||||
+ struct gfs2_sb *sbd;
|
|
||||||
+ const char *label = 0;
|
|
||||||
+
|
|
||||||
+ sbd = (struct gfs2_sb *)buf;
|
|
||||||
+
|
|
||||||
+ if (blkid_be32(sbd->sb_fs_format) == GFS_FORMAT_FS &&
|
|
||||||
+ blkid_be32(sbd->sb_multihost_format) == GFS_FORMAT_MULTI)
|
|
||||||
+ {
|
|
||||||
+ blkid_set_tag(probe->dev, "UUID", 0, 0);
|
|
||||||
+
|
|
||||||
+ if (strlen(sbd->sb_locktable))
|
|
||||||
+ label = sbd->sb_locktable;
|
|
||||||
+ blkid_set_tag(probe->dev, "LABEL", label, sizeof(sbd->sb_locktable));
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ return 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static int probe_gfs2(struct blkid_probe *probe,
|
|
||||||
+ struct blkid_magic *id __BLKID_ATTR((unused)),
|
|
||||||
+ unsigned char *buf)
|
|
||||||
+{
|
|
||||||
+ struct gfs2_sb *sbd;
|
|
||||||
+ const char *label = 0;
|
|
||||||
+
|
|
||||||
+ sbd = (struct gfs2_sb *)buf;
|
|
||||||
+
|
|
||||||
+ if (blkid_be32(sbd->sb_fs_format) == GFS2_FORMAT_FS &&
|
|
||||||
+ blkid_be32(sbd->sb_multihost_format) == GFS2_FORMAT_MULTI)
|
|
||||||
+ {
|
|
||||||
+ blkid_set_tag(probe->dev, "UUID", 0, 0);
|
|
||||||
+
|
|
||||||
+ if (strlen(sbd->sb_locktable))
|
|
||||||
+ label = sbd->sb_locktable;
|
|
||||||
+ blkid_set_tag(probe->dev, "LABEL", label, sizeof(sbd->sb_locktable));
|
|
||||||
+ return 0;
|
|
||||||
+ }
|
|
||||||
+ return 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* BLKID_BLK_OFFS is at least as large as the highest bim_kboff defined
|
|
||||||
* in the type_array table below + bim_kbalign.
|
|
||||||
@@ -673,6 +717,8 @@
|
|
||||||
{ "reiserfs", 64, 0x34, 8, "ReIsErFs", probe_reiserfs },
|
|
||||||
{ "reiserfs", 8, 20, 8, "ReIsErFs", probe_reiserfs },
|
|
||||||
{ "reiser4", 64, 0, 7, "ReIsEr4", probe_reiserfs4 },
|
|
||||||
+ { "gfs2", 64, 0, 4, "\x01\x16\x19\x70", probe_gfs2 },
|
|
||||||
+ { "gfs", 64, 0, 4, "\x01\x16\x19\x70", probe_gfs },
|
|
||||||
{ "vfat", 0, 0x52, 5, "MSWIN", probe_fat },
|
|
||||||
{ "vfat", 0, 0x52, 8, "FAT32 ", probe_fat },
|
|
||||||
{ "vfat", 0, 0x36, 5, "MSDOS", probe_fat },
|
|
||||||
--- e2fsprogs-1.39/lib/blkid/probe.h.gfs 2006-03-10 21:43:35.000000000 +0100
|
|
||||||
+++ e2fsprogs-1.39/lib/blkid/probe.h 2006-07-07 13:45:43.000000000 +0200
|
|
||||||
@@ -345,6 +345,54 @@
|
|
||||||
unsigned char escape_sequences[8];
|
|
||||||
};
|
|
||||||
|
|
||||||
+/* Common gfs/gfs2 constants: */
|
|
||||||
+#define GFS_MAGIC 0x01161970
|
|
||||||
+#define GFS_DEFAULT_BSIZE 4096
|
|
||||||
+#define GFS_SUPERBLOCK_OFFSET (0x10 * GFS_DEFAULT_BSIZE)
|
|
||||||
+#define GFS_METATYPE_SB 1
|
|
||||||
+#define GFS_FORMAT_SB 100
|
|
||||||
+#define GFS_LOCKNAME_LEN 64
|
|
||||||
+
|
|
||||||
+/* gfs1 constants: */
|
|
||||||
+#define GFS_FORMAT_FS 1309
|
|
||||||
+#define GFS_FORMAT_MULTI 1401
|
|
||||||
+/* gfs2 constants: */
|
|
||||||
+#define GFS2_FORMAT_FS 1801
|
|
||||||
+#define GFS2_FORMAT_MULTI 1900
|
|
||||||
+
|
|
||||||
+struct gfs2_meta_header {
|
|
||||||
+ __u32 mh_magic;
|
|
||||||
+ __u32 mh_type;
|
|
||||||
+ __u64 __pad0; /* Was generation number in gfs1 */
|
|
||||||
+ __u32 mh_format;
|
|
||||||
+ __u32 __pad1; /* Was incarnation number in gfs1 */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+struct gfs2_inum {
|
|
||||||
+ __u64 no_formal_ino;
|
|
||||||
+ __u64 no_addr;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+struct gfs2_sb {
|
|
||||||
+ struct gfs2_meta_header sb_header;
|
|
||||||
+
|
|
||||||
+ __u32 sb_fs_format;
|
|
||||||
+ __u32 sb_multihost_format;
|
|
||||||
+ __u32 __pad0; /* Was superblock flags in gfs1 */
|
|
||||||
+
|
|
||||||
+ __u32 sb_bsize;
|
|
||||||
+ __u32 sb_bsize_shift;
|
|
||||||
+ __u32 __pad1; /* Was journal segment size in gfs1 */
|
|
||||||
+
|
|
||||||
+ struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */
|
|
||||||
+ struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */
|
|
||||||
+ struct gfs2_inum sb_root_dir;
|
|
||||||
+
|
|
||||||
+ char sb_lockproto[GFS_LOCKNAME_LEN];
|
|
||||||
+ char sb_locktable[GFS_LOCKNAME_LEN];
|
|
||||||
+ /* In gfs1, quota and license dinodes followed */
|
|
||||||
+} PACKED;
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* Byte swap functions
|
|
||||||
*/
|
|
||||||
--- e2fsprogs-1.39/lib/blkid/ChangeLog.gfs 2006-05-14 23:25:12.000000000 +0200
|
|
||||||
+++ e2fsprogs-1.39/lib/blkid/ChangeLog 2006-07-10 08:16:22.000000000 +0200
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+2006-07-10 Karel Zak <kzak@redhat.com>
|
|
||||||
+
|
|
||||||
+ * probe.c (probe_gfs, _gfs2), probe.h: Add support for GFS/GFS2
|
|
||||||
+
|
|
@ -1,28 +0,0 @@
|
|||||||
--- e2fsprogs-1.39/lib/ext2fs/getsize.c.close-on-error 2005-09-06 11:40:14.000000000 +0200
|
|
||||||
+++ e2fsprogs-1.39/lib/ext2fs/getsize.c 2006-06-22 14:46:27.000000000 +0200
|
|
||||||
@@ -169,8 +169,10 @@
|
|
||||||
#ifdef DKIOCGETBLOCKCOUNT /* For Apple Darwin */
|
|
||||||
if (ioctl(fd, DKIOCGETBLOCKCOUNT, &size64) >= 0) {
|
|
||||||
if ((sizeof(*retblocks) < sizeof(unsigned long long))
|
|
||||||
- && ((size64 / (blocksize / 512)) > 0xFFFFFFFF))
|
|
||||||
- return EFBIG;
|
|
||||||
+ && ((size64 / (blocksize / 512)) > 0xFFFFFFFF)) {
|
|
||||||
+ rc = EFBIG;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
*retblocks = size64 / (blocksize / 512);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
@@ -275,8 +277,10 @@
|
|
||||||
valid_offset (fd, 0);
|
|
||||||
size64 = low + 1;
|
|
||||||
if ((sizeof(*retblocks) < sizeof(unsigned long long))
|
|
||||||
- && ((size64 / blocksize) > 0xFFFFFFFF))
|
|
||||||
- return EFBIG;
|
|
||||||
+ && ((size64 / blocksize) > 0xFFFFFFFF)) {
|
|
||||||
+ rc = EFBIG;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
*retblocks = size64 / blocksize;
|
|
||||||
out:
|
|
||||||
close(fd);
|
|
File diff suppressed because it is too large
Load Diff
@ -1,51 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date 1170006028 18000
|
|
||||||
# Node ID 1619c81226d196f7e943e96b1ecc80c477dc7806
|
|
||||||
# Parent 61145b06a34c8a476827e02fd0a8c7c95a2ad912
|
|
||||||
Fix dump_usued segault in debugfs if used without open filesystem
|
|
||||||
|
|
||||||
The dump_unused command in debugfs segfaults if used without an open
|
|
||||||
filesystem:
|
|
||||||
|
|
||||||
sor:~ # debugfs
|
|
||||||
debugfs 1.39 (29-May-2006)
|
|
||||||
debugfs: dump_unused
|
|
||||||
Segmentation fault
|
|
||||||
|
|
||||||
Patch (from IBM) below.
|
|
||||||
|
|
||||||
Signed-off-by: Matthias Koenig <mkoenig@suse.de>
|
|
||||||
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/debugfs/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/debugfs/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/debugfs/ChangeLog
|
|
||||||
@@ -24,6 +24,11 @@
|
|
||||||
to avoid the possibility of an array overrun if the
|
|
||||||
filename is exactly EXT2_NAME_LEN in size.
|
|
||||||
|
|
||||||
+2007-01-28 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * unused.c: Fix bug so that the dump_unused command segfault if
|
|
||||||
+ used without an open filesystem
|
|
||||||
+
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
* htree.c (htree_dump_int_node): Fix printf formats.
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/debugfs/unused.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/debugfs/unused.c
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/debugfs/unused.c
|
|
||||||
@@ -31,6 +31,10 @@ void do_dump_unused(int argc EXT2FS_ATTR
|
|
||||||
unsigned int i;
|
|
||||||
errcode_t retval;
|
|
||||||
|
|
||||||
+ if (common_args_process(argc, argv, 1, 1,
|
|
||||||
+ "dump_unused", "", 0))
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
for (blk=current_fs->super->s_first_data_block;
|
|
||||||
blk < current_fs->super->s_blocks_count; blk++) {
|
|
||||||
if (ext2fs_test_block_bitmap(current_fs->block_map,blk))
|
|
@ -1,216 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date Wed Aug 30 03:08:13 2006 -0400
|
|
||||||
# Node ID 4a2b0d6c55fc3bea9e5bed4faa82845676f3be2b
|
|
||||||
# parent: 14e45223b10be14cc318f10b804a3fd535a86ad5
|
|
||||||
Fix potential 2**32-1 overflow by using e2p_percent()
|
|
||||||
|
|
||||||
Add a new functiom, e2p_percent(), which correct calculates the percentage
|
|
||||||
of a number based on a given percentage, without worrying about overflow
|
|
||||||
issues. This is used where we calculate the number of reserved blocks using
|
|
||||||
a percentage of the total number of blocks in a filesystem.
|
|
||||||
|
|
||||||
Based on patches from Eric Sandeen, but generalized to use this new function.
|
|
||||||
|
|
||||||
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
|
|
||||||
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/e2p/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/e2p/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/e2p/ChangeLog
|
|
||||||
@@ -1,3 +1,9 @@
|
|
||||||
+2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * percent.c (e2p_percent): Add a new function which accurate and
|
|
||||||
+ without risk of overflow calculates a percentage of a base
|
|
||||||
+ number.
|
|
||||||
+
|
|
||||||
2006-05-08 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* feature.c: Add support for EXT2_FEATURE_COMPAT_LAZY_BG feature.
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/e2p/Makefile.in
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/e2p/Makefile.in
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/e2p/Makefile.in
|
|
||||||
@@ -19,7 +19,7 @@ all:: e2p.pc
|
|
||||||
OBJS= feature.o fgetflags.o fsetflags.o fgetversion.o fsetversion.o \
|
|
||||||
getflags.o getversion.o hashstr.o iod.o ls.o mntopts.o \
|
|
||||||
parse_num.o pe.o pf.o ps.o setflags.o setversion.o uuid.o \
|
|
||||||
- ostype.o
|
|
||||||
+ ostype.o percent.o
|
|
||||||
|
|
||||||
SRCS= $(srcdir)/feature.c $(srcdir)/fgetflags.c \
|
|
||||||
$(srcdir)/fsetflags.c $(srcdir)/fgetversion.c \
|
|
||||||
@@ -28,7 +28,7 @@ SRCS= $(srcdir)/feature.c $(srcdir)/fge
|
|
||||||
$(srcdir)/ls.c $(srcdir)/mntopts.c $(srcdir)/parse_num.c \
|
|
||||||
$(srcdir)/pe.c $(srcdir)/pf.c $(srcdir)/ps.c \
|
|
||||||
$(srcdir)/setflags.c $(srcdir)/setversion.c $(srcdir)/uuid.c \
|
|
||||||
- $(srcdir)/ostype.c
|
|
||||||
+ $(srcdir)/ostype.c $(srcdir)/percent.o
|
|
||||||
HFILES= e2p.h
|
|
||||||
|
|
||||||
LIBRARY= libe2p
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/e2p/e2p.h
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/e2p/e2p.h
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/e2p/e2p.h
|
|
||||||
@@ -50,3 +50,5 @@ unsigned long parse_num_blocks(const cha
|
|
||||||
|
|
||||||
char *e2p_os2string(int os_type);
|
|
||||||
int e2p_string2os(char *str);
|
|
||||||
+
|
|
||||||
+unsigned int e2p_percent(int percent, unsigned int base);
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
@@ -1,5 +1,9 @@
|
|
||||||
2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
+ * tune2fs.c (main), mke2fs.c (PRS): Use e2p_percent to properly
|
|
||||||
+ calculate the number of reserved blocks without worrying
|
|
||||||
+ about overflow.
|
|
||||||
+
|
|
||||||
* mke2fs.c (parse_extended_opts): Use ext2fs_div_ceil() instead of
|
|
||||||
a using an open-coded expression which was subject to
|
|
||||||
overflows.
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/mke2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c
|
|
||||||
@@ -1440,8 +1440,8 @@ static void PRS(int argc, char *argv[])
|
|
||||||
/*
|
|
||||||
* Calculate number of blocks to reserve
|
|
||||||
*/
|
|
||||||
- fs_param.s_r_blocks_count = (fs_param.s_blocks_count * reserved_ratio)
|
|
||||||
- / 100;
|
|
||||||
+ fs_param.s_r_blocks_count = e2p_percent(reserved_ratio,
|
|
||||||
+ fs_param.s_blocks_count);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/tune2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/tune2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/tune2fs.c
|
|
||||||
@@ -823,7 +823,8 @@ int main (int argc, char ** argv)
|
|
||||||
printf (_("Setting interval between checks to %lu seconds\n"), interval);
|
|
||||||
}
|
|
||||||
if (m_flag) {
|
|
||||||
- sb->s_r_blocks_count = sb->s_blocks_count * reserved_ratio /100;
|
|
||||||
+ sb->s_r_blocks_count = e2p_percent(reserved_ratio,
|
|
||||||
+ sb->s_blocks_count);
|
|
||||||
ext2fs_mark_super_dirty(fs);
|
|
||||||
printf (_("Setting reserved blocks percentage to %g%% (%u blocks)\n"),
|
|
||||||
reserved_ratio, sb->s_r_blocks_count);
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
@@ -1,5 +1,9 @@
|
|
||||||
2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
+ * resize2fs.c (adjust_fs_info), online.c (online_resize_fs): Use
|
|
||||||
+ e2p_percent to properly calculate the number of reserved
|
|
||||||
+ blocks without worrying about overflow.
|
|
||||||
+
|
|
||||||
* resize2fs.c (ext2fs_calculate_summary_stats): Fix potential
|
|
||||||
overflow problems when the number of blocks is close to
|
|
||||||
2**31.
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/online.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/online.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/online.c
|
|
||||||
@@ -107,7 +107,8 @@ errcode_t online_resize_fs(ext2_filsys f
|
|
||||||
sb->s_first_data_block -
|
|
||||||
(i * sb->s_blocks_per_group);
|
|
||||||
}
|
|
||||||
- input.reserved_blocks = input.blocks_count * r_frac / 100;
|
|
||||||
+ input.reserved_blocks = e2p_percent(r_frac,
|
|
||||||
+ input.blocks_count);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
printf("new block bitmap is at 0x%04x\n", input.block_bitmap);
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/resize2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c
|
|
||||||
@@ -245,8 +245,8 @@ retry:
|
|
||||||
*/
|
|
||||||
blk = old_fs->super->s_r_blocks_count * 100 /
|
|
||||||
old_fs->super->s_blocks_count;
|
|
||||||
- fs->super->s_r_blocks_count = ((fs->super->s_blocks_count * blk)
|
|
||||||
- / 100);
|
|
||||||
+ fs->super->s_r_blocks_count = e2p_percent(blk,
|
|
||||||
+ fs->super->s_blocks_count);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Adjust the bitmaps for size
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/e2p/percent.c
|
|
||||||
===================================================================
|
|
||||||
--- /dev/null
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/e2p/percent.c
|
|
||||||
@@ -0,0 +1,62 @@
|
|
||||||
+/*
|
|
||||||
+ * percent.c - Take percentage of a number
|
|
||||||
+ *
|
|
||||||
+ * Copyright (C) 2006 Theodore Ts'o <tytso@mit.edu>
|
|
||||||
+ *
|
|
||||||
+ * This file can be redistributed under the terms of the GNU Library General
|
|
||||||
+ * Public License
|
|
||||||
+ */
|
|
||||||
+
|
|
||||||
+#include "e2p.h"
|
|
||||||
+
|
|
||||||
+#include <stdlib.h>
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * We work really hard to calculate this accurately, while avoiding
|
|
||||||
+ * an overflow. "Is there a hyphen in anal-retentive?" :-)
|
|
||||||
+ */
|
|
||||||
+unsigned int e2p_percent(int percent, unsigned int base)
|
|
||||||
+{
|
|
||||||
+ unsigned int mask = ~((1 << (sizeof(unsigned int) - 1) * 8) - 1);
|
|
||||||
+
|
|
||||||
+ if (100 % percent == 0)
|
|
||||||
+ return base / (100 / percent);
|
|
||||||
+ if (mask & base)
|
|
||||||
+ return (base / 100) * percent;
|
|
||||||
+ return base * percent / 100;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#ifdef DEBUG
|
|
||||||
+#include <unistd.h>
|
|
||||||
+#include <stdio.h>
|
|
||||||
+
|
|
||||||
+main(int argc, char **argv)
|
|
||||||
+{
|
|
||||||
+ unsigned int base;
|
|
||||||
+ int percent;
|
|
||||||
+ char *p;
|
|
||||||
+ int log_block_size = 0;
|
|
||||||
+
|
|
||||||
+ if (argc != 3) {
|
|
||||||
+ fprintf(stderr, "Usage: %s percent base\n", argv[0]);
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ percent = strtoul(argv[1], &p, 0);
|
|
||||||
+ if (p[0] && p[1]) {
|
|
||||||
+ fprintf(stderr, "Bad percent: %s\n", argv[1]);
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ base = strtoul(argv[2], &p, 0);
|
|
||||||
+ if (p[0] && p[1]) {
|
|
||||||
+ fprintf(stderr, "Bad base: %s\n", argv[2]);
|
|
||||||
+ exit(1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ printf("%d percent of %u is %u.\n", percent, base,
|
|
||||||
+ e2p_percent(percent, base));
|
|
||||||
+
|
|
||||||
+ exit(0);
|
|
||||||
+}
|
|
||||||
+#endif
|
|
@ -1,132 +0,0 @@
|
|||||||
Return-Path: <linux-ext4-owner@vger.kernel.org>
|
|
||||||
Received: from pobox-2.corp.redhat.com ([unix socket])
|
|
||||||
by pobox-2.corp.redhat.com (Cyrus v2.2.12-Invoca-RPM-2.2.12-3.RHEL4.1) with LMTPA;
|
|
||||||
Wed, 20 Sep 2006 05:01:05 -0400
|
|
||||||
X-Sieve: CMU Sieve 2.2
|
|
||||||
Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254])
|
|
||||||
by pobox-2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id k8K915WI028994
|
|
||||||
for <esandeen@pobox-2.corp.redhat.com>; Wed, 20 Sep 2006 05:01:05 -0400
|
|
||||||
Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32])
|
|
||||||
by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k8K913p5009001;
|
|
||||||
Wed, 20 Sep 2006 05:01:03 -0400
|
|
||||||
Received: from vger.kernel.org (vger.kernel.org [209.132.176.167])
|
|
||||||
by mx3.redhat.com (8.13.1/8.13.1) with ESMTP id k8K8q7e4029305;
|
|
||||||
Wed, 20 Sep 2006 05:00:57 -0400
|
|
||||||
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
|
|
||||||
id S1750745AbWITI4c (ORCPT <rfc822;twoerner@redhat.com> + 3 others);
|
|
||||||
Wed, 20 Sep 2006 04:56:32 -0400
|
|
||||||
Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750747AbWITI4c
|
|
||||||
(ORCPT <rfc822;linux-ext4-outgoing>);
|
|
||||||
Wed, 20 Sep 2006 04:56:32 -0400
|
|
||||||
Received: from ecfrec.frec.bull.fr ([129.183.4.8]:62635 "EHLO
|
|
||||||
ecfrec.frec.bull.fr") by vger.kernel.org with ESMTP
|
|
||||||
id S1750745AbWITI4a (ORCPT <rfc822;linux-ext4@vger.kernel.org>);
|
|
||||||
Wed, 20 Sep 2006 04:56:30 -0400
|
|
||||||
Received: from localhost (localhost [127.0.0.1])
|
|
||||||
by ecfrec.frec.bull.fr (Postfix) with ESMTP id 8B9F219D943
|
|
||||||
for <linux-ext4@vger.kernel.org>; Wed, 20 Sep 2006 10:56:28 +0200 (CEST)
|
|
||||||
Received: from ecfrec.frec.bull.fr ([127.0.0.1])
|
|
||||||
by localhost (ecfrec.frec.bull.fr [127.0.0.1]) (amavisd-new, port 10024)
|
|
||||||
with ESMTP id 22796-03 for <linux-ext4@vger.kernel.org>;
|
|
||||||
Wed, 20 Sep 2006 10:56:25 +0200 (CEST)
|
|
||||||
Received: from ecn002.frec.bull.fr (ecn002.frec.bull.fr [129.183.4.6])
|
|
||||||
by ecfrec.frec.bull.fr (Postfix) with ESMTP id 8D8AB19D94C
|
|
||||||
for <linux-ext4@vger.kernel.org>; Wed, 20 Sep 2006 10:56:09 +0200 (CEST)
|
|
||||||
Received: from openx1.frec.bull.fr ([129.183.10.3])
|
|
||||||
by ecn002.frec.bull.fr (Lotus Domino Release 5.0.12)
|
|
||||||
with ESMTP id 2006092011020109:122246 ;
|
|
||||||
Wed, 20 Sep 2006 11:02:01 +0200
|
|
||||||
Received: by openx1.frec.bull.fr (Postfix, from userid 15348)
|
|
||||||
id 7751E139B4; Wed, 20 Sep 2006 10:56:08 +0200 (CEST)
|
|
||||||
Date: Wed, 20 Sep 2006 10:56:08 +0200
|
|
||||||
From: Alexandre Ratchov <alexandre.ratchov@bull.net>
|
|
||||||
To: linux-ext4@vger.kernel.org
|
|
||||||
Cc: Jean-Pierre Dion <jean-pierre.dion@bull.net>
|
|
||||||
Subject: [patch] small fix for e2p_percent()
|
|
||||||
Message-ID: <20060920085608.GA18351@openx1.frec.bull.fr>
|
|
||||||
Mime-Version: 1.0
|
|
||||||
User-Agent: Mutt/1.4.1i
|
|
||||||
X-MIMETrack: Itemize by SMTP Server on ECN002/FR/BULL(Release 5.0.12 |February 13, 2003) at
|
|
||||||
20/09/2006 11:02:01,
|
|
||||||
Serialize by Router on ECN002/FR/BULL(Release 5.0.12 |February 13, 2003) at
|
|
||||||
20/09/2006 11:02:02,
|
|
||||||
Serialize complete at 20/09/2006 11:02:02
|
|
||||||
Content-Type: text/plain; charset=us-ascii
|
|
||||||
Content-Disposition: inline
|
|
||||||
X-Virus-Scanned: by amavisd-new at frec.bull.fr
|
|
||||||
Sender: linux-ext4-owner@vger.kernel.org
|
|
||||||
Precedence: bulk
|
|
||||||
X-Mailing-List: linux-ext4@vger.kernel.org
|
|
||||||
X-RedHat-Spam-Score: 0
|
|
||||||
|
|
||||||
hello,
|
|
||||||
|
|
||||||
e2p_percent() doesn't work for zero percent (``mke2fs -m0'' gets killed with
|
|
||||||
SIGFPE).
|
|
||||||
|
|
||||||
is there a reason for not simply using 64 bit arithmetic? perhaps to avoid
|
|
||||||
overflows for 7e+9TB file-systems :-), or just for correctness...
|
|
||||||
|
|
||||||
So, here is the patch that fixes this. In order to avoid integer overflows,
|
|
||||||
we pick 16 more bits to store ``base'' and do the exact division on 48 bits.
|
|
||||||
Since ``100 * base'' always fits in 48 bits, there's never overflow. This
|
|
||||||
still work if we remplace 'unsigned int' by 'unsigned long long'.
|
|
||||||
|
|
||||||
cheers,
|
|
||||||
|
|
||||||
-- Alexandre
|
|
||||||
|
|
||||||
Signed-off-by: Alexandre Ratchov <alexandre.ratchov@bull.net>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/e2p/percent.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/e2p/percent.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/e2p/percent.c
|
|
||||||
@@ -14,18 +14,41 @@
|
|
||||||
/*
|
|
||||||
* We work really hard to calculate this accurately, while avoiding
|
|
||||||
* an overflow. "Is there a hyphen in anal-retentive?" :-)
|
|
||||||
+ *
|
|
||||||
+ * -- "Yes there is, as in hair-splitting and nit-picking"
|
|
||||||
*/
|
|
||||||
unsigned int e2p_percent(int percent, unsigned int base)
|
|
||||||
{
|
|
||||||
- unsigned int mask = ~((1 << (sizeof(unsigned int) - 1) * 8) - 1);
|
|
||||||
+ unsigned hi, lo, q, r;
|
|
||||||
|
|
||||||
- if (100 % percent == 0)
|
|
||||||
- return base / (100 / percent);
|
|
||||||
- if (mask & base)
|
|
||||||
- return (base / 100) * percent;
|
|
||||||
- return base * percent / 100;
|
|
||||||
+ /*
|
|
||||||
+ * in order to avoid overflow we write 'base' as:
|
|
||||||
+ *
|
|
||||||
+ * base = hi * 2^16 + lo
|
|
||||||
+ *
|
|
||||||
+ * then we do all computations separately on 'hi' and 'lo'.
|
|
||||||
+ * By using the definition of division:
|
|
||||||
+ *
|
|
||||||
+ * precent * base = result * 100 + reminder
|
|
||||||
+ *
|
|
||||||
+ * (reminder < 100), we obtain the exact value of 'result'
|
|
||||||
+ * as follows:
|
|
||||||
+ */
|
|
||||||
+#define BITS 16
|
|
||||||
+#define MASK ((1 << BITS) - 1)
|
|
||||||
+
|
|
||||||
+ hi = percent * (base >> BITS);
|
|
||||||
+ lo = percent * (base & MASK);
|
|
||||||
+
|
|
||||||
+ q = ((hi / 100) << BITS) + lo / 100;
|
|
||||||
+ r = ((hi % 100) << BITS) + lo % 100;
|
|
||||||
+
|
|
||||||
+ return q + r / 100;
|
|
||||||
+#undef BITS
|
|
||||||
+#undef MASK
|
|
||||||
}
|
|
||||||
|
|
||||||
+
|
|
||||||
#ifdef DEBUG
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
@ -1,282 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date Wed Aug 30 01:57:00 2006 -0400
|
|
||||||
# Node ID 59f8a8974d914231642239f176284d92dce0678d
|
|
||||||
# parent: c76ddbe4519a571de3868c2888d8bb99a559046f
|
|
||||||
Fix potential 2**32-1 overflow problems by ext2fs_div_ceil()
|
|
||||||
|
|
||||||
Add a new function, ext2fs_div_ceil(), which correctly calculates a division
|
|
||||||
of two unsigned integer where the result is always rounded up the next
|
|
||||||
largest integer. This is used everywhere where we might have
|
|
||||||
previously caused an overflow when the number of blocks
|
|
||||||
or inodes is too close to 2**32-1.
|
|
||||||
|
|
||||||
Based on patches from Eric Sandeen, but generalized to use this new function
|
|
||||||
|
|
||||||
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
|
|
||||||
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/ext2ed/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/ext2ed/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/ext2ed/ChangeLog
|
|
||||||
@@ -1,3 +1,8 @@
|
|
||||||
+2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * init.c (div_ceil, set_file_system_info): Fix potential overflow
|
|
||||||
+ for really big filesystems.
|
|
||||||
+
|
|
||||||
2006-06-30 Theodore Ts'o <tytso@mit.edu>
|
|
||||||
|
|
||||||
* Release of E2fsprogs 1.38
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/ext2ed/init.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/ext2ed/init.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/ext2ed/init.c
|
|
||||||
@@ -370,6 +370,13 @@ void add_user_command (struct struct_com
|
|
||||||
ptr->callback [num]=callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
+static unsigned int div_ceil(unsigned int a, unsigned int b)
|
|
||||||
+{
|
|
||||||
+ if (!a)
|
|
||||||
+ return 0;
|
|
||||||
+ return ((a - 1) / b) + 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
int set_file_system_info (void)
|
|
||||||
|
|
||||||
{
|
|
||||||
@@ -415,8 +422,8 @@ int set_file_system_info (void)
|
|
||||||
file_system_info.first_group_desc_offset=2*EXT2_MIN_BLOCK_SIZE;
|
|
||||||
else
|
|
||||||
file_system_info.first_group_desc_offset=file_system_info.block_size;
|
|
||||||
- file_system_info.groups_count=( sb->s_blocks_count-sb->s_first_data_block+sb->s_blocks_per_group-1) /
|
|
||||||
- sb->s_blocks_per_group;
|
|
||||||
+ file_system_info.groups_count = div_ceil(sb->s_blocks_count,
|
|
||||||
+ sb->s_blocks_per_group);
|
|
||||||
|
|
||||||
file_system_info.inodes_per_block=file_system_info.block_size/sizeof (struct ext2_inode);
|
|
||||||
file_system_info.blocks_per_group=sb->s_inodes_per_group/file_system_info.inodes_per_block;
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
@@ -1,3 +1,14 @@
|
|
||||||
+2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * ext2fs.h (ext2fs_div_ceil): Add new function which safely
|
|
||||||
+ calculates an integer division where the result is always
|
|
||||||
+ rounded up while avoiding overflow errors.
|
|
||||||
+
|
|
||||||
+ * initialize.c (calc_reserved_gdt_blocks, ext2fs_initialize):
|
|
||||||
+ * openfs.c (ext2fs_open2): Use ext2fs_div_ceil() instead of a
|
|
||||||
+ using an open-coded expression which was subject to
|
|
||||||
+ overflows.
|
|
||||||
+
|
|
||||||
2006-05-21 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* openfs.c (ext2fs_open2): Fix type warning problem with sizeof()
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ext2fs.h
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ext2fs.h
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ext2fs.h
|
|
||||||
@@ -969,6 +969,7 @@ extern int ext2fs_group_of_blk(ext2_fils
|
|
||||||
extern int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino);
|
|
||||||
extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
|
|
||||||
struct ext2_inode *inode);
|
|
||||||
+extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The actual inlined functions definitions themselves...
|
|
||||||
@@ -1136,6 +1137,16 @@ _INLINE_ blk_t ext2fs_inode_data_blocks(
|
|
||||||
return inode->i_blocks -
|
|
||||||
(inode->i_file_acl ? fs->blocksize >> 9 : 0);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * This is an efficient, overflow safe way of calculating ceil((1.0 * a) / b)
|
|
||||||
+ */
|
|
||||||
+_INLINE_ unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b)
|
|
||||||
+{
|
|
||||||
+ if (!a)
|
|
||||||
+ return 0;
|
|
||||||
+ return ((a - 1) / b) + 1;
|
|
||||||
+}
|
|
||||||
#undef _INLINE_
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/initialize.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/initialize.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/initialize.c
|
|
||||||
@@ -77,8 +77,8 @@ static unsigned int calc_reserved_gdt_bl
|
|
||||||
*/
|
|
||||||
if (sb->s_blocks_count < max_blocks / 1024)
|
|
||||||
max_blocks = sb->s_blocks_count * 1024;
|
|
||||||
- rsv_groups = (max_blocks - sb->s_first_data_block + bpg - 1) / bpg;
|
|
||||||
- rsv_gdb = (rsv_groups + gdpb - 1) / gdpb - fs->desc_blocks;
|
|
||||||
+ rsv_groups = ext2fs_div_ceil(max_blocks - sb->s_first_data_block, bpg);
|
|
||||||
+ rsv_gdb = ext2fs_div_ceil(rsv_groups, gdpb) - fs->desc_blocks;
|
|
||||||
if (rsv_gdb > EXT2_ADDR_PER_BLOCK(sb))
|
|
||||||
rsv_gdb = EXT2_ADDR_PER_BLOCK(sb);
|
|
||||||
#ifdef RES_GDT_DEBUG
|
|
||||||
@@ -205,17 +205,15 @@ errcode_t ext2fs_initialize(const char *
|
|
||||||
}
|
|
||||||
|
|
||||||
retry:
|
|
||||||
- fs->group_desc_count = (super->s_blocks_count -
|
|
||||||
- super->s_first_data_block +
|
|
||||||
- EXT2_BLOCKS_PER_GROUP(super) - 1)
|
|
||||||
- / EXT2_BLOCKS_PER_GROUP(super);
|
|
||||||
+ fs->group_desc_count = ext2fs_div_ceil(super->s_blocks_count -
|
|
||||||
+ super->s_first_data_block,
|
|
||||||
+ EXT2_BLOCKS_PER_GROUP(super));
|
|
||||||
if (fs->group_desc_count == 0) {
|
|
||||||
retval = EXT2_ET_TOOSMALL;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
- fs->desc_blocks = (fs->group_desc_count +
|
|
||||||
- EXT2_DESC_PER_BLOCK(super) - 1)
|
|
||||||
- / EXT2_DESC_PER_BLOCK(super);
|
|
||||||
+ fs->desc_blocks = ext2fs_div_ceil(fs->group_desc_count,
|
|
||||||
+ EXT2_DESC_PER_BLOCK(super));
|
|
||||||
|
|
||||||
i = fs->blocksize >= 4096 ? 1 : 4096 / fs->blocksize;
|
|
||||||
set_field(s_inodes_count, super->s_blocks_count / i);
|
|
||||||
@@ -233,8 +231,7 @@ retry:
|
|
||||||
* should be. But make sure that we don't allocate more than
|
|
||||||
* one bitmap's worth of inodes each group.
|
|
||||||
*/
|
|
||||||
- ipg = (super->s_inodes_count + fs->group_desc_count - 1) /
|
|
||||||
- fs->group_desc_count;
|
|
||||||
+ ipg = ext2fs_div_ceil(super->s_inodes_count, fs->group_desc_count);
|
|
||||||
if (ipg > fs->blocksize * 8) {
|
|
||||||
if (super->s_blocks_per_group >= 256) {
|
|
||||||
/* Try again with slightly different parameters */
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/openfs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/openfs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/openfs.c
|
|
||||||
@@ -258,12 +258,11 @@ errcode_t ext2fs_open2(const char *name,
|
|
||||||
retval = EXT2_ET_CORRUPT_SUPERBLOCK;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
- fs->group_desc_count = (fs->super->s_blocks_count -
|
|
||||||
- fs->super->s_first_data_block +
|
|
||||||
- blocks_per_group - 1) / blocks_per_group;
|
|
||||||
- fs->desc_blocks = (fs->group_desc_count +
|
|
||||||
- EXT2_DESC_PER_BLOCK(fs->super) - 1)
|
|
||||||
- / EXT2_DESC_PER_BLOCK(fs->super);
|
|
||||||
+ fs->group_desc_count = ext2fs_div_ceil(fs->super->s_blocks_count -
|
|
||||||
+ fs->super->s_first_data_block,
|
|
||||||
+ blocks_per_group);
|
|
||||||
+ fs->desc_blocks = ext2fs_div_ceil(fs->group_desc_count,
|
|
||||||
+ EXT2_DESC_PER_BLOCK(fs->super));
|
|
||||||
retval = ext2fs_get_mem(fs->desc_blocks * fs->blocksize,
|
|
||||||
&fs->group_desc);
|
|
||||||
if (retval)
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
@@ -1,3 +1,12 @@
|
|
||||||
+2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * mke2fs.c (parse_extended_opts): Use ext2fs_div_ceil() instead of
|
|
||||||
+ a using an open-coded expression which was subject to
|
|
||||||
+ overflows.
|
|
||||||
+
|
|
||||||
+ * filefrag.c (div_ceil, frag_report): Fix potential overflow for
|
|
||||||
+ really big filesystems.
|
|
||||||
+
|
|
||||||
2006-05-29 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* filefrag.c: Add support for ancient Linux systems that do not
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/filefrag.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/filefrag.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/filefrag.c
|
|
||||||
@@ -47,6 +47,13 @@ int verbose = 0;
|
|
||||||
#define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */
|
|
||||||
#define EXT3_IOC_GETFLAGS _IOR('f', 1, long)
|
|
||||||
|
|
||||||
+static unsigned int div_ceil(unsigned int a, unsigned int b)
|
|
||||||
+{
|
|
||||||
+ if (!a)
|
|
||||||
+ return 0;
|
|
||||||
+ return ((a - 1) / b) + 1;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
static unsigned long get_bmap(int fd, unsigned long block)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
@@ -105,7 +112,7 @@ static void frag_report(const char *file
|
|
||||||
if (verbose) {
|
|
||||||
printf("Filesystem type is: %x\n", fsinfo.f_type);
|
|
||||||
}
|
|
||||||
- cylgroups = (fsinfo.f_blocks + fsinfo.f_bsize*8-1) / fsinfo.f_bsize*8;
|
|
||||||
+ cylgroups = div_ceil(fsinfo.f_blocks, fsinfo.f_bsize*8);
|
|
||||||
if (verbose) {
|
|
||||||
printf("Filesystem cylinder groups is approximately %ld\n",
|
|
||||||
cylgroups);
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/mke2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c
|
|
||||||
@@ -819,12 +819,12 @@ static void parse_extended_opts(struct e
|
|
||||||
if (!bpg)
|
|
||||||
bpg = blocksize * 8;
|
|
||||||
gdpb = blocksize / sizeof(struct ext2_group_desc);
|
|
||||||
- group_desc_count = (param->s_blocks_count +
|
|
||||||
- bpg - 1) / bpg;
|
|
||||||
+ group_desc_count =
|
|
||||||
+ ext2fs_div_ceil(param->s_blocks_count, bpg);
|
|
||||||
desc_blocks = (group_desc_count +
|
|
||||||
gdpb - 1) / gdpb;
|
|
||||||
- rsv_groups = (resize + bpg - 1) / bpg;
|
|
||||||
- rsv_gdb = (rsv_groups + gdpb - 1) / gdpb -
|
|
||||||
+ rsv_groups = ext2fs_div_ceil(resize, bpg);
|
|
||||||
+ rsv_gdb = ext2fs_div_ceil(rsv_groups, gdpb) -
|
|
||||||
desc_blocks;
|
|
||||||
if (rsv_gdb > (int) EXT2_ADDR_PER_BLOCK(param))
|
|
||||||
rsv_gdb = EXT2_ADDR_PER_BLOCK(param);
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
@@ -1,3 +1,9 @@
|
|
||||||
+2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * resize2fs.c (adjust_fs_info): Use ext2fs_div_ceil() instead of a
|
|
||||||
+ using an open-coded expression which was subject to
|
|
||||||
+ overflows.
|
|
||||||
+
|
|
||||||
2006-05-22 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* resize2fs.8.in: Fixed spelling mistake (Addresses Debian Bug:
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/resize2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c
|
|
||||||
@@ -190,15 +190,13 @@ errcode_t adjust_fs_info(ext2_filsys fs,
|
|
||||||
fs->super->s_blocks_count = new_size;
|
|
||||||
|
|
||||||
retry:
|
|
||||||
- fs->group_desc_count = (fs->super->s_blocks_count -
|
|
||||||
- fs->super->s_first_data_block +
|
|
||||||
- EXT2_BLOCKS_PER_GROUP(fs->super) - 1)
|
|
||||||
- / EXT2_BLOCKS_PER_GROUP(fs->super);
|
|
||||||
+ fs->group_desc_count = ext2fs_div_ceil(fs->super->s_blocks_count -
|
|
||||||
+ fs->super->s_first_data_block,
|
|
||||||
+ EXT2_BLOCKS_PER_GROUP(fs->super));
|
|
||||||
if (fs->group_desc_count == 0)
|
|
||||||
return EXT2_ET_TOOSMALL;
|
|
||||||
- fs->desc_blocks = (fs->group_desc_count +
|
|
||||||
- EXT2_DESC_PER_BLOCK(fs->super) - 1)
|
|
||||||
- / EXT2_DESC_PER_BLOCK(fs->super);
|
|
||||||
+ fs->desc_blocks = ext2fs_div_ceil(fs->group_desc_count,
|
|
||||||
+ EXT2_DESC_PER_BLOCK(fs->super));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Overhead is the number of bookkeeping blocks per group. It
|
|
@ -1,151 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date Wed Aug 30 02:16:55 2006 -0400
|
|
||||||
# Node ID 14e45223b10be14cc318f10b804a3fd535a86ad5
|
|
||||||
# parent: d609388faa895de79ff143e53f8ed04557048c42
|
|
||||||
Detect overflows in loop counters
|
|
||||||
|
|
||||||
For loops such as:
|
|
||||||
|
|
||||||
for (i=1; i <= fs->super->s_blocks_count; i++) {
|
|
||||||
<do_stuff>
|
|
||||||
}
|
|
||||||
|
|
||||||
if i is an int and s_blocks_count is (2^32-1), the condition is never false.
|
|
||||||
Change these loops to:
|
|
||||||
|
|
||||||
for (i=1; i <= fs->super->s_blocks_count && i > 0; i++) {
|
|
||||||
<do_stuff>
|
|
||||||
}
|
|
||||||
|
|
||||||
to stop the loop when we overflow i
|
|
||||||
|
|
||||||
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
|
|
||||||
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
@@ -1,3 +1,9 @@
|
|
||||||
+2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * pass5.c (check_inode_bitmaps, check_inode_end, check_block_end):
|
|
||||||
+ * pass4.c (e2fsck_pass4): Fix potential overflow problems when the
|
|
||||||
+ number of blocks is close to 2**31.
|
|
||||||
+
|
|
||||||
2006-05-29 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* pass1b.c: Add missing semicolon when HAVE_INTPTR_T is not defined
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass4.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/pass4.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass4.c
|
|
||||||
@@ -110,8 +110,9 @@ void e2fsck_pass4(e2fsck_t ctx)
|
|
||||||
if (ctx->progress)
|
|
||||||
if ((ctx->progress)(ctx, 4, 0, maxgroup))
|
|
||||||
return;
|
|
||||||
-
|
|
||||||
- for (i=1; i <= fs->super->s_inodes_count; i++) {
|
|
||||||
+
|
|
||||||
+ /* Protect loop from wrap-around if s_inodes_count maxed */
|
|
||||||
+ for (i=1; i <= fs->super->s_inodes_count && i > 0; i++) {
|
|
||||||
if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
|
|
||||||
return;
|
|
||||||
if ((i % fs->super->s_inodes_per_group) == 0) {
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass5.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/pass5.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass5.c
|
|
||||||
@@ -370,7 +370,8 @@ redo_counts:
|
|
||||||
EXT2_BG_INODE_UNINIT))
|
|
||||||
skip_group++;
|
|
||||||
|
|
||||||
- for (i = 1; i <= fs->super->s_inodes_count; i++) {
|
|
||||||
+ /* Protect loop from wrap-around if inodes_count is maxed */
|
|
||||||
+ for (i = 1; i <= fs->super->s_inodes_count && i > 0; i++) {
|
|
||||||
actual = ext2fs_fast_test_inode_bitmap(ctx->inode_used_map, i);
|
|
||||||
if (skip_group)
|
|
||||||
bitmap = 0;
|
|
||||||
@@ -528,8 +529,9 @@ static void check_inode_end(e2fsck_t ctx
|
|
||||||
}
|
|
||||||
if (save_inodes_count == end)
|
|
||||||
return;
|
|
||||||
-
|
|
||||||
- for (i = save_inodes_count + 1; i <= end; i++) {
|
|
||||||
+
|
|
||||||
+ /* protect loop from wrap-around if end is maxed */
|
|
||||||
+ for (i = save_inodes_count + 1; i <= end && i > save_inodes_count; i++) {
|
|
||||||
if (!ext2fs_test_inode_bitmap(fs->inode_map, i)) {
|
|
||||||
if (fix_problem(ctx, PR_5_INODE_BMAP_PADDING, &pctx)) {
|
|
||||||
for (i = save_inodes_count + 1; i <= end; i++)
|
|
||||||
@@ -572,8 +574,9 @@ static void check_block_end(e2fsck_t ctx
|
|
||||||
}
|
|
||||||
if (save_blocks_count == end)
|
|
||||||
return;
|
|
||||||
-
|
|
||||||
- for (i = save_blocks_count + 1; i <= end; i++) {
|
|
||||||
+
|
|
||||||
+ /* Protect loop from wrap-around if end is maxed */
|
|
||||||
+ for (i = save_blocks_count + 1; i <= end && i > save_blocks_count; i++) {
|
|
||||||
if (!ext2fs_test_block_bitmap(fs->block_map, i)) {
|
|
||||||
if (fix_problem(ctx, PR_5_BLOCK_BMAP_PADDING, &pctx)) {
|
|
||||||
for (i = save_blocks_count + 1; i <= end; i++)
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
@@ -1,5 +1,8 @@
|
|
||||||
2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
+ * bitmaps.c (ext2fs_set_bitmap_padding): Fix potential overflow
|
|
||||||
+ problems when the number of blocks is close to 2**31.
|
|
||||||
+
|
|
||||||
* ext2fs.h (ext2fs_div_ceil): Add new function which safely
|
|
||||||
calculates an integer division where the result is always
|
|
||||||
rounded up while avoiding overflow errors.
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/bitmaps.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/bitmaps.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/bitmaps.c
|
|
||||||
@@ -102,7 +102,10 @@ void ext2fs_set_bitmap_padding(ext2fs_ge
|
|
||||||
{
|
|
||||||
__u32 i, j;
|
|
||||||
|
|
||||||
- for (i=map->end+1, j = i - map->start; i <= map->real_end; i++, j++)
|
|
||||||
+ /* Protect loop from wrap-around if map->real_end is maxed */
|
|
||||||
+ for (i=map->end+1, j = i - map->start;
|
|
||||||
+ i <= map->real_end && i > map->end;
|
|
||||||
+ i++, j++)
|
|
||||||
ext2fs_set_bit(j, map->bitmap);
|
|
||||||
|
|
||||||
return;
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
@@ -1,5 +1,9 @@
|
|
||||||
2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
+ * resize2fs.c (ext2fs_calculate_summary_stats): Fix potential
|
|
||||||
+ overflow problems when the number of blocks is close to
|
|
||||||
+ 2**31.
|
|
||||||
+
|
|
||||||
* resize2fs.c (adjust_fs_info): Use ext2fs_div_ceil() instead of a
|
|
||||||
using an open-coded expression which was subject to
|
|
||||||
overflows.
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/resize2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c
|
|
||||||
@@ -1582,7 +1582,9 @@ static errcode_t ext2fs_calculate_summar
|
|
||||||
total_free = 0;
|
|
||||||
count = 0;
|
|
||||||
group = 0;
|
|
||||||
- for (ino = 1; ino <= fs->super->s_inodes_count; ino++) {
|
|
||||||
+
|
|
||||||
+ /* Protect loop from wrap-around if s_inodes_count maxed */
|
|
||||||
+ for (ino = 1; ino <= fs->super->s_inodes_count && ino > 0; ino++) {
|
|
||||||
if (!ext2fs_fast_test_inode_bitmap(fs->inode_map, ino)) {
|
|
||||||
group_free++;
|
|
||||||
total_free++;
|
|
@ -1,552 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date Tue Sep 12 14:56:15 2006 -0400
|
|
||||||
# Node ID 4b504bc7413f5ef17f8b62f4b3479da6bfa83efb
|
|
||||||
# parent: 59bf36fb8344bb7a3971af7df22d41f8d8b14610
|
|
||||||
Fix signed vs unsigned printf format strings for block and inode numbers
|
|
||||||
|
|
||||||
There were still some %d's lurking when we print blocks & inodes; also
|
|
||||||
many of the counters in the e2fsck_struct were signed, and probably
|
|
||||||
need to be unsigned to avoid overflows.
|
|
||||||
|
|
||||||
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/debugfs/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/debugfs/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/debugfs/ChangeLog
|
|
||||||
@@ -1,3 +1,7 @@
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
+ * htree.c (htree_dump_int_node): Fix printf formats.
|
|
||||||
+
|
|
||||||
2006-05-29 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* util.c (reset_getopt): In order to support ancient Linux header
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/debugfs/htree.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/debugfs/htree.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/debugfs/htree.c
|
|
||||||
@@ -114,7 +114,7 @@ static void htree_dump_int_node(ext2_fil
|
|
||||||
|
|
||||||
for (i=0; i < limit.count; i++) {
|
|
||||||
hash = i ? ext2fs_le32_to_cpu(ent[i].hash) : 0;
|
|
||||||
- fprintf(pager, "Entry #%d: Hash 0x%08x%s, block %d\n", i,
|
|
||||||
+ fprintf(pager, "Entry #%d: Hash 0x%08x%s, block %u\n", i,
|
|
||||||
hash, (hash & 1) ? " (**)" : "",
|
|
||||||
ext2fs_le32_to_cpu(ent[i].block));
|
|
||||||
}
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
@@ -1,5 +1,12 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * e2fsck.h (e2fsck): Use unsigned types for filesystem counters.
|
|
||||||
+ * emptydir.c (add_empty_dirblock):
|
|
||||||
+ * iscan.c (main):
|
|
||||||
+ * unix.c (show_stats, check_if_skip): Fix printf formats.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* pass1.c (handle_fs_bad_blocks): Remove unused variables.
|
|
||||||
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/e2fsck.h
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/e2fsck.h
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/e2fsck.h
|
|
||||||
@@ -306,24 +306,24 @@ struct e2fsck_struct {
|
|
||||||
char start_meta[2], stop_meta[2];
|
|
||||||
|
|
||||||
/* File counts */
|
|
||||||
- int fs_directory_count;
|
|
||||||
- int fs_regular_count;
|
|
||||||
- int fs_blockdev_count;
|
|
||||||
- int fs_chardev_count;
|
|
||||||
- int fs_links_count;
|
|
||||||
- int fs_symlinks_count;
|
|
||||||
- int fs_fast_symlinks_count;
|
|
||||||
- int fs_fifo_count;
|
|
||||||
- int fs_total_count;
|
|
||||||
- int fs_badblocks_count;
|
|
||||||
- int fs_sockets_count;
|
|
||||||
- int fs_ind_count;
|
|
||||||
- int fs_dind_count;
|
|
||||||
- int fs_tind_count;
|
|
||||||
- int fs_fragmented;
|
|
||||||
- int large_files;
|
|
||||||
- int fs_ext_attr_inodes;
|
|
||||||
- int fs_ext_attr_blocks;
|
|
||||||
+ __u32 fs_directory_count;
|
|
||||||
+ __u32 fs_regular_count;
|
|
||||||
+ __u32 fs_blockdev_count;
|
|
||||||
+ __u32 fs_chardev_count;
|
|
||||||
+ __u32 fs_links_count;
|
|
||||||
+ __u32 fs_symlinks_count;
|
|
||||||
+ __u32 fs_fast_symlinks_count;
|
|
||||||
+ __u32 fs_fifo_count;
|
|
||||||
+ __u32 fs_total_count;
|
|
||||||
+ __u32 fs_badblocks_count;
|
|
||||||
+ __u32 fs_sockets_count;
|
|
||||||
+ __u32 fs_ind_count;
|
|
||||||
+ __u32 fs_dind_count;
|
|
||||||
+ __u32 fs_tind_count;
|
|
||||||
+ __u32 fs_fragmented;
|
|
||||||
+ __u32 large_files;
|
|
||||||
+ __u32 fs_ext_attr_inodes;
|
|
||||||
+ __u32 fs_ext_attr_blocks;
|
|
||||||
|
|
||||||
time_t now;
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/emptydir.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/emptydir.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/emptydir.c
|
|
||||||
@@ -94,7 +94,7 @@ void add_empty_dirblock(empty_dir_info e
|
|
||||||
if (db->ino == 11)
|
|
||||||
return; /* Inode number 11 is usually lost+found */
|
|
||||||
|
|
||||||
- printf(_("Empty directory block %u (#%d) in inode %d\n"),
|
|
||||||
+ printf(_("Empty directory block %u (#%d) in inode %u\n"),
|
|
||||||
db->blk, db->blockcnt, db->ino);
|
|
||||||
|
|
||||||
ext2fs_mark_block_bitmap(edi->empty_dir_blocks, db->blk);
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/iscan.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/iscan.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/iscan.c
|
|
||||||
@@ -98,7 +98,7 @@ int main (int argc, char *argv[])
|
|
||||||
int exit_value = FSCK_OK;
|
|
||||||
ext2_filsys fs;
|
|
||||||
ext2_ino_t ino;
|
|
||||||
- int num_inodes = 0;
|
|
||||||
+ __u32 num_inodes = 0;
|
|
||||||
struct ext2_inode inode;
|
|
||||||
ext2_inode_scan scan;
|
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ int main (int argc, char *argv[])
|
|
||||||
}
|
|
||||||
|
|
||||||
print_resource_track(NULL, &global_rtrack);
|
|
||||||
- printf(_("%d inodes scanned.\n"), num_inodes);
|
|
||||||
+ printf(_("%u inodes scanned.\n"), num_inodes);
|
|
||||||
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/unix.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/unix.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/unix.c
|
|
||||||
@@ -98,7 +98,7 @@ static void usage(e2fsck_t ctx)
|
|
||||||
static void show_stats(e2fsck_t ctx)
|
|
||||||
{
|
|
||||||
ext2_filsys fs = ctx->fs;
|
|
||||||
- int inodes, inodes_used;
|
|
||||||
+ __u32 inodes, inodes_used;
|
|
||||||
blk_t blocks, blocks_used;
|
|
||||||
int dir_links;
|
|
||||||
int num_files, num_links;
|
|
||||||
@@ -118,49 +118,48 @@ static void show_stats(e2fsck_t ctx)
|
|
||||||
frag_percent = (frag_percent + 5) / 10;
|
|
||||||
|
|
||||||
if (!verbose) {
|
|
||||||
- printf(_("%s: %d/%d files (%0d.%d%% non-contiguous), %u/%u blocks\n"),
|
|
||||||
+ printf(_("%s: %u/%u files (%0d.%d%% non-contiguous), %u/%u blocks\n"),
|
|
||||||
ctx->device_name, inodes_used, inodes,
|
|
||||||
frag_percent / 10, frag_percent % 10,
|
|
||||||
blocks_used, blocks);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
- printf (P_("\n%8d inode used (%d%%)\n", "\n%8d inodes used (%d%%)\n",
|
|
||||||
- inodes_used), inodes_used, 100 * inodes_used / inodes);
|
|
||||||
- printf (P_("%8d non-contiguous inode (%0d.%d%%)\n",
|
|
||||||
- "%8d non-contiguous inodes (%0d.%d%%)\n",
|
|
||||||
+ printf (P_("\n%8u inode used (%2.2f%%)\n", "\n%8u inodes used (%2.2f%%)\n",
|
|
||||||
+ inodes_used), inodes_used, 100.0 * inodes_used / inodes);
|
|
||||||
+ printf (P_("%8u non-contiguous inode (%0d.%d%%)\n",
|
|
||||||
+ "%8u non-contiguous inodes (%0d.%d%%)\n",
|
|
||||||
ctx->fs_fragmented),
|
|
||||||
ctx->fs_fragmented, frag_percent / 10, frag_percent % 10);
|
|
||||||
- printf (_(" # of inodes with ind/dind/tind blocks: %d/%d/%d\n"),
|
|
||||||
+ printf (_(" # of inodes with ind/dind/tind blocks: %u/%u/%u\n"),
|
|
||||||
ctx->fs_ind_count, ctx->fs_dind_count, ctx->fs_tind_count);
|
|
||||||
- printf (P_("%8u block used (%d%%)\n", "%8u blocks used (%d%%)\n",
|
|
||||||
- blocks_used),
|
|
||||||
- blocks_used, (int) ((long long) 100 * blocks_used / blocks));
|
|
||||||
- printf (P_("%8d bad block\n", "%8d bad blocks\n",
|
|
||||||
+ printf (P_("%8u block used (%2.2f%%)\n", "%8u blocks used (%2.2f%%)\n",
|
|
||||||
+ blocks_used), blocks_used, 100.0 * blocks_used / blocks);
|
|
||||||
+ printf (P_("%8u bad block\n", "%8u bad blocks\n",
|
|
||||||
ctx->fs_badblocks_count), ctx->fs_badblocks_count);
|
|
||||||
- printf (P_("%8d large file\n", "%8d large files\n",
|
|
||||||
+ printf (P_("%8u large file\n", "%8u large files\n",
|
|
||||||
ctx->large_files), ctx->large_files);
|
|
||||||
- printf (P_("\n%8d regular file\n", "\n%8d regular files\n",
|
|
||||||
+ printf (P_("\n%8u regular file\n", "\n%8u regular files\n",
|
|
||||||
ctx->fs_regular_count), ctx->fs_regular_count);
|
|
||||||
- printf (P_("%8d directory\n", "%8d directories\n",
|
|
||||||
+ printf (P_("%8u directory\n", "%8u directories\n",
|
|
||||||
ctx->fs_directory_count), ctx->fs_directory_count);
|
|
||||||
- printf (P_("%8d character device file\n",
|
|
||||||
- "%8d character device files\n", ctx->fs_chardev_count),
|
|
||||||
+ printf (P_("%8u character device file\n",
|
|
||||||
+ "%8u character device files\n", ctx->fs_chardev_count),
|
|
||||||
ctx->fs_chardev_count);
|
|
||||||
- printf (P_("%8d block device file\n", "%8d block device files\n",
|
|
||||||
+ printf (P_("%8u block device file\n", "%8u block device files\n",
|
|
||||||
ctx->fs_blockdev_count), ctx->fs_blockdev_count);
|
|
||||||
- printf (P_("%8d fifo\n", "%8d fifos\n", ctx->fs_fifo_count),
|
|
||||||
+ printf (P_("%8u fifo\n", "%8u fifos\n", ctx->fs_fifo_count),
|
|
||||||
ctx->fs_fifo_count);
|
|
||||||
- printf (P_("%8d link\n", "%8d links\n",
|
|
||||||
+ printf (P_("%8u link\n", "%8u links\n",
|
|
||||||
ctx->fs_links_count - dir_links),
|
|
||||||
ctx->fs_links_count - dir_links);
|
|
||||||
- printf (P_("%8d symbolic link", "%8d symbolic links",
|
|
||||||
+ printf (P_("%8u symbolic link", "%8u symbolic links",
|
|
||||||
ctx->fs_symlinks_count), ctx->fs_symlinks_count);
|
|
||||||
- printf (P_(" (%d fast symbolic link)\n", " (%d fast symbolic links)\n",
|
|
||||||
+ printf (P_(" (%u fast symbolic link)\n", " (%u fast symbolic links)\n",
|
|
||||||
ctx->fs_fast_symlinks_count), ctx->fs_fast_symlinks_count);
|
|
||||||
- printf (P_("%8d socket\n", "%8d sockets\n", ctx->fs_sockets_count),
|
|
||||||
+ printf (P_("%8u socket\n", "%8u sockets\n", ctx->fs_sockets_count),
|
|
||||||
ctx->fs_sockets_count);
|
|
||||||
printf ("--------\n");
|
|
||||||
- printf (P_("%8d file\n", "%8d files\n",
|
|
||||||
+ printf (P_("%8u file\n", "%8u files\n",
|
|
||||||
ctx->fs_total_count - dir_links),
|
|
||||||
ctx->fs_total_count - dir_links);
|
|
||||||
}
|
|
||||||
@@ -300,7 +299,7 @@ static void check_if_skip(e2fsck_t ctx)
|
|
||||||
fputs(_(", check forced.\n"), stdout);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
- printf(_("%s: clean, %d/%d files, %u/%u blocks"), ctx->device_name,
|
|
||||||
+ printf(_("%s: clean, %u/%u files, %u/%u blocks"), ctx->device_name,
|
|
||||||
fs->super->s_inodes_count - fs->super->s_free_inodes_count,
|
|
||||||
fs->super->s_inodes_count,
|
|
||||||
fs->super->s_blocks_count - fs->super->s_free_blocks_count,
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
@@ -1,5 +1,17 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * bmove.c (process_block):
|
|
||||||
+ * getsize.c (main):
|
|
||||||
+ * icount.c (ext2fs_create_icount2, insert_icount_el):
|
|
||||||
+ * tst_badblocks.c (print_list, validate_test_seq, do_test_seq):
|
|
||||||
+ * tst_badblocks.c (invalid_proc):
|
|
||||||
+ * tst_getsize.c (main):
|
|
||||||
+ * tst_iscan.c (check_map):
|
|
||||||
+ * unix_io.c (raw_read_blk, unix_read_blk):
|
|
||||||
+ * write_bb_file.c (ext2fs_write_bb_FILE): Fix printf formats.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* closefs.c (write_backup_super):
|
|
||||||
* initialize.c (ext2fs_initialize): Remove unused variables.
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/bmove.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/bmove.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/bmove.c
|
|
||||||
@@ -73,7 +73,7 @@ static int process_block(ext2_filsys fs,
|
|
||||||
ext2fs_mark_block_bitmap(pb->alloc_map, block);
|
|
||||||
ret = BLOCK_CHANGED;
|
|
||||||
if (pb->flags & EXT2_BMOVE_DEBUG)
|
|
||||||
- printf("ino=%ld, blockcnt=%lld, %d->%d\n", pb->ino,
|
|
||||||
+ printf("ino=%ld, blockcnt=%lld, %u->%u\n", pb->ino,
|
|
||||||
blockcnt, orig, block);
|
|
||||||
}
|
|
||||||
if (pb->add_dir) {
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/getsize.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/getsize.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/getsize.c
|
|
||||||
@@ -302,7 +302,7 @@ int main(int argc, char **argv)
|
|
||||||
"while calling ext2fs_get_device_size");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
- printf("Device %s has %d 1k blocks.\n", argv[1], blocks);
|
|
||||||
+ printf("Device %s has %u 1k blocks.\n", argv[1], blocks);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/icount.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/icount.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/icount.c
|
|
||||||
@@ -116,7 +116,7 @@ errcode_t ext2fs_create_icount2(ext2_fil
|
|
||||||
|
|
||||||
bytes = (size_t) (icount->size * sizeof(struct ext2_icount_el));
|
|
||||||
#if 0
|
|
||||||
- printf("Icount allocated %d entries, %d bytes.\n",
|
|
||||||
+ printf("Icount allocated %u entries, %d bytes.\n",
|
|
||||||
icount->size, bytes);
|
|
||||||
#endif
|
|
||||||
retval = ext2fs_get_mem(bytes, &icount->list);
|
|
||||||
@@ -176,7 +176,7 @@ static struct ext2_icount_el *insert_ico
|
|
||||||
if (new_size < (icount->size + 100))
|
|
||||||
new_size = icount->size + 100;
|
|
||||||
#if 0
|
|
||||||
- printf("Reallocating icount %d entries...\n", new_size);
|
|
||||||
+ printf("Reallocating icount %u entries...\n", new_size);
|
|
||||||
#endif
|
|
||||||
retval = ext2fs_resize_mem((size_t) icount->size *
|
|
||||||
sizeof(struct ext2_icount_el),
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/tst_badblocks.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/tst_badblocks.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/tst_badblocks.c
|
|
||||||
@@ -103,7 +103,7 @@ static void print_list(badblocks_list bb
|
|
||||||
}
|
|
||||||
ok = i = 1;
|
|
||||||
while (ext2fs_badblocks_list_iterate(iter, &blk)) {
|
|
||||||
- printf("%d ", blk);
|
|
||||||
+ printf("%u ", blk);
|
|
||||||
if (i++ != blk)
|
|
||||||
ok = 0;
|
|
||||||
}
|
|
||||||
@@ -130,7 +130,7 @@ static void validate_test_seq(badblocks_
|
|
||||||
ok = 0;
|
|
||||||
test_fail++;
|
|
||||||
}
|
|
||||||
- printf("\tblock %d is %s --- %s\n", vec[i],
|
|
||||||
+ printf("\tblock %u is %s --- %s\n", vec[i],
|
|
||||||
match ? "present" : "absent",
|
|
||||||
ok ? "OK" : "NOT OK");
|
|
||||||
}
|
|
||||||
@@ -145,7 +145,7 @@ static void do_test_seq(badblocks_list b
|
|
||||||
case ADD_BLK:
|
|
||||||
ext2fs_badblocks_list_add(bb, vec[i]);
|
|
||||||
match = ext2fs_badblocks_list_test(bb, vec[i]);
|
|
||||||
- printf("Adding block %d --- now %s\n", vec[i],
|
|
||||||
+ printf("Adding block %u --- now %s\n", vec[i],
|
|
||||||
match ? "present" : "absent");
|
|
||||||
if (!match) {
|
|
||||||
printf("FAILURE!\n");
|
|
||||||
@@ -155,7 +155,7 @@ static void do_test_seq(badblocks_list b
|
|
||||||
case DEL_BLK:
|
|
||||||
ext2fs_badblocks_list_del(bb, vec[i]);
|
|
||||||
match = ext2fs_badblocks_list_test(bb, vec[i]);
|
|
||||||
- printf("Removing block %d --- now %s\n", vec[i],
|
|
||||||
+ printf("Removing block %u --- now %s\n", vec[i],
|
|
||||||
ext2fs_badblocks_list_test(bb, vec[i]) ?
|
|
||||||
"present" : "absent");
|
|
||||||
if (match) {
|
|
||||||
@@ -209,7 +209,7 @@ static void invalid_proc(ext2_filsys fs,
|
|
||||||
printf("Expected invalid block\n");
|
|
||||||
test_expected_fail++;
|
|
||||||
} else {
|
|
||||||
- printf("Invalid block #: %d\n", blk);
|
|
||||||
+ printf("Invalid block #: %u\n", blk);
|
|
||||||
test_fail++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/tst_getsize.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/tst_getsize.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/tst_getsize.c
|
|
||||||
@@ -39,6 +39,6 @@ int main(int argc, const char *argv[])
|
|
||||||
com_err(argv[0], retval, "while getting device size");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
- printf("%s is device has %d blocks.\n", argv[1], blocks);
|
|
||||||
+ printf("%s is device has %u blocks.\n", argv[1], blocks);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/tst_iscan.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/tst_iscan.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/tst_iscan.c
|
|
||||||
@@ -175,7 +175,7 @@ static void check_map(void)
|
|
||||||
|
|
||||||
for (i=0; test_vec[i]; i++) {
|
|
||||||
if (ext2fs_test_block_bitmap(touched_map, test_vec[i])) {
|
|
||||||
- printf("Bad block was touched --- %d\n", test_vec[i]);
|
|
||||||
+ printf("Bad block was touched --- %u\n", test_vec[i]);
|
|
||||||
failed++;
|
|
||||||
first_no_comma = 1;
|
|
||||||
}
|
|
||||||
@@ -199,7 +199,7 @@ static void check_map(void)
|
|
||||||
first = 0;
|
|
||||||
else
|
|
||||||
printf(", ");
|
|
||||||
- printf("%d", i);
|
|
||||||
+ printf("%u", i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/unix_io.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/unix_io.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/unix_io.c
|
|
||||||
@@ -170,8 +170,8 @@ static errcode_t raw_read_blk(io_channel
|
|
||||||
size = (count < 0) ? -count : count * channel->block_size;
|
|
||||||
location = ((ext2_loff_t) block * channel->block_size) + data->offset;
|
|
||||||
#ifdef DEBUG
|
|
||||||
- printf("count=%d, size=%d, block=%d, blk_size=%d, location=%lx\n",
|
|
||||||
- count, size, block, channel->block_size, location);
|
|
||||||
+ printf("count=%d, size=%d, block=%lu, blk_size=%d, location=%llx\n",
|
|
||||||
+ count, size, block, channel->block_size, (long long)location);
|
|
||||||
#endif
|
|
||||||
if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) {
|
|
||||||
retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
|
|
||||||
@@ -553,7 +553,7 @@ static errcode_t unix_read_blk(io_channe
|
|
||||||
/* If it's in the cache, use it! */
|
|
||||||
if ((cache = find_cached_block(data, block, &reuse[0]))) {
|
|
||||||
#ifdef DEBUG
|
|
||||||
- printf("Using cached block %d\n", block);
|
|
||||||
+ printf("Using cached block %lu\n", block);
|
|
||||||
#endif
|
|
||||||
memcpy(cp, cache->buf, channel->block_size);
|
|
||||||
count--;
|
|
||||||
@@ -569,7 +569,7 @@ static errcode_t unix_read_blk(io_channe
|
|
||||||
if (find_cached_block(data, block+i, &reuse[i]))
|
|
||||||
break;
|
|
||||||
#ifdef DEBUG
|
|
||||||
- printf("Reading %d blocks starting at %d\n", i, block);
|
|
||||||
+ printf("Reading %d blocks starting at %lu\n", i, block);
|
|
||||||
#endif
|
|
||||||
if ((retval = raw_read_blk(channel, data, block, i, cp)))
|
|
||||||
return retval;
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/write_bb_file.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/write_bb_file.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/write_bb_file.c
|
|
||||||
@@ -27,7 +27,7 @@ errcode_t ext2fs_write_bb_FILE(ext2_badb
|
|
||||||
return retval;
|
|
||||||
|
|
||||||
while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) {
|
|
||||||
- fprintf(f, "%d\n", blk);
|
|
||||||
+ fprintf(f, "%u\n", blk);
|
|
||||||
}
|
|
||||||
ext2fs_badblocks_list_iterate_end(bb_iter);
|
|
||||||
return 0;
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
@@ -1,5 +1,11 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * dumpe2fs.c (list_bad_blocks):
|
|
||||||
+ * e2image.c (output_meta_data_blocks, write_raw_image_file):
|
|
||||||
+ * mke2fs.c (test_disk, handle_bad_blocks): Fix printf formats.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* e2image.c (mark_table_blocks): Remove unused first_block
|
|
||||||
incrementing from loop.
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/dumpe2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/dumpe2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/dumpe2fs.c
|
|
||||||
@@ -250,10 +250,10 @@ static void list_bad_blocks(ext2_filsys
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (dump) {
|
|
||||||
- header = fmt = "%d\n";
|
|
||||||
+ header = fmt = "%u\n";
|
|
||||||
} else {
|
|
||||||
- header = _("Bad blocks: %d");
|
|
||||||
- fmt = ", %d";
|
|
||||||
+ header = _("Bad blocks: %u");
|
|
||||||
+ fmt = ", %u";
|
|
||||||
}
|
|
||||||
while (ext2fs_badblocks_list_iterate(bb_iter, &blk)) {
|
|
||||||
printf(header ? header : fmt, blk);
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/e2image.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/e2image.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/e2image.c
|
|
||||||
@@ -417,7 +417,7 @@ static void output_meta_data_blocks(ext2
|
|
||||||
retval = io_channel_read_blk(fs->io, blk, 1, buf);
|
|
||||||
if (retval) {
|
|
||||||
com_err(program_name, retval,
|
|
||||||
- "error reading block %d", blk);
|
|
||||||
+ "error reading block %u", blk);
|
|
||||||
}
|
|
||||||
if (scramble_block_map &&
|
|
||||||
ext2fs_test_block_bitmap(scramble_block_map, blk))
|
|
||||||
@@ -516,7 +516,7 @@ static void write_raw_image_file(ext2_fi
|
|
||||||
block_buf, process_dir_block, &pb);
|
|
||||||
if (retval) {
|
|
||||||
com_err(program_name, retval,
|
|
||||||
- "while iterating over inode %d",
|
|
||||||
+ "while iterating over inode %u",
|
|
||||||
ino);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
@@ -529,7 +529,7 @@ static void write_raw_image_file(ext2_fi
|
|
||||||
process_file_block, &pb);
|
|
||||||
if (retval) {
|
|
||||||
com_err(program_name, retval,
|
|
||||||
- "while iterating over %d", ino);
|
|
||||||
+ "while iterating over inode %u", ino);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/mke2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c
|
|
||||||
@@ -188,7 +188,7 @@ static void test_disk(ext2_filsys fs, ba
|
|
||||||
errcode_t retval;
|
|
||||||
char buf[1024];
|
|
||||||
|
|
||||||
- sprintf(buf, "badblocks -b %d -X %s%s%s %d", fs->blocksize,
|
|
||||||
+ sprintf(buf, "badblocks -b %d -X %s%s%s %u", fs->blocksize,
|
|
||||||
quiet ? "" : "-s ", (cflag > 1) ? "-w " : "",
|
|
||||||
fs->device_name, fs->super->s_blocks_count);
|
|
||||||
if (verbose)
|
|
||||||
@@ -232,7 +232,7 @@ static void handle_bad_blocks(ext2_filsy
|
|
||||||
if (ext2fs_badblocks_list_test(bb_list, i)) {
|
|
||||||
fprintf(stderr, _("Block %d in primary "
|
|
||||||
"superblock/group descriptor area bad.\n"), i);
|
|
||||||
- fprintf(stderr, _("Blocks %u through %d must be good "
|
|
||||||
+ fprintf(stderr, _("Blocks %u through %u must be good "
|
|
||||||
"in order to build a filesystem.\n"),
|
|
||||||
fs->super->s_first_data_block, must_be_good);
|
|
||||||
fputs(_("Aborting....\n"), stderr);
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
@@ -1,5 +1,9 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * online.c (online_resize_fs): Fix printf formats.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* resize2fs.c (mark_table_blocks): Remove unused variable.
|
|
||||||
|
|
||||||
2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/online.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/online.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/online.c
|
|
||||||
@@ -74,7 +74,7 @@ errcode_t online_resize_fs(ext2_filsys f
|
|
||||||
if (retval)
|
|
||||||
return retval;
|
|
||||||
|
|
||||||
- printf(_("Performing an on-line resize of %s to %d (%dk) blocks.\n"),
|
|
||||||
+ printf(_("Performing an on-line resize of %s to %u (%dk) blocks.\n"),
|
|
||||||
fs->device_name, *new_size, fs->blocksize / 1024);
|
|
||||||
|
|
||||||
size = fs->group_desc_count * sb->s_blocks_per_group +
|
|
||||||
@@ -116,7 +116,7 @@ errcode_t online_resize_fs(ext2_filsys f
|
|
||||||
printf("new inode table is at 0x%04x-0x%04x\n",
|
|
||||||
input.inode_table,
|
|
||||||
input.inode_table + new_fs->inode_blocks_per_group-1);
|
|
||||||
- printf("new group has %d blocks\n", input.blocks_count);
|
|
||||||
+ printf("new group has %u blocks\n", input.blocks_count);
|
|
||||||
printf("new group will reserve %d blocks\n",
|
|
||||||
input.reserved_blocks);
|
|
||||||
printf("new group has %d free blocks\n",
|
|
@ -1,288 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date Tue Sep 12 14:56:16 2006 -0400
|
|
||||||
# Node ID 1aa8aca8acebca38b38ee003c17a045bc5fde185
|
|
||||||
# parent: 4b504bc7413f5ef17f8b62f4b3479da6bfa83efb
|
|
||||||
Create new ext2fs library inlines: ext2fs_group_{first,last}_block()
|
|
||||||
|
|
||||||
Create new ext2fs library inline functions in order to calculate
|
|
||||||
the starting and ending blocks in a block group.
|
|
||||||
|
|
||||||
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
@@ -1,5 +1,11 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * pass1.c (new_table_block, handle_fs_bad_blocks):
|
|
||||||
+ * super.c (check_super_block):
|
|
||||||
+ Use new inlines to calculate group first & last blocks.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* e2fsck.h (e2fsck): Use unsigned types for filesystem counters.
|
|
||||||
* emptydir.c (add_empty_dirblock):
|
|
||||||
* iscan.c (main):
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/pass1.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1.c
|
|
||||||
@@ -1890,6 +1890,7 @@ static void new_table_block(e2fsck_t ctx
|
|
||||||
{
|
|
||||||
ext2_filsys fs = ctx->fs;
|
|
||||||
blk_t old_block = *new_block;
|
|
||||||
+ blk_t last_block;
|
|
||||||
int i;
|
|
||||||
char *buf;
|
|
||||||
struct problem_context pctx;
|
|
||||||
@@ -1900,8 +1901,8 @@ static void new_table_block(e2fsck_t ctx
|
|
||||||
pctx.blk = old_block;
|
|
||||||
pctx.str = name;
|
|
||||||
|
|
||||||
- pctx.errcode = ext2fs_get_free_blocks(fs, first_block,
|
|
||||||
- first_block + fs->super->s_blocks_per_group,
|
|
||||||
+ last_block = ext2fs_group_last_block(fs, group);
|
|
||||||
+ pctx.errcode = ext2fs_get_free_blocks(fs, first_block, last_block,
|
|
||||||
num, ctx->block_found_map, new_block);
|
|
||||||
if (pctx.errcode) {
|
|
||||||
pctx.num = num;
|
|
||||||
@@ -1952,9 +1953,11 @@ static void handle_fs_bad_blocks(e2fsck_
|
|
||||||
{
|
|
||||||
ext2_filsys fs = ctx->fs;
|
|
||||||
dgrp_t i;
|
|
||||||
- int first_block = fs->super->s_first_data_block;
|
|
||||||
+ int first_block;
|
|
||||||
|
|
||||||
for (i = 0; i < fs->group_desc_count; i++) {
|
|
||||||
+ first_block = ext2fs_group_first_block(fs, i);
|
|
||||||
+
|
|
||||||
if (ctx->invalid_block_bitmap_flag[i]) {
|
|
||||||
new_table_block(ctx, first_block, i, _("block bitmap"),
|
|
||||||
1, &fs->group_desc[i].bg_block_bitmap);
|
|
||||||
@@ -1969,7 +1972,6 @@ static void handle_fs_bad_blocks(e2fsck_
|
|
||||||
&fs->group_desc[i].bg_inode_table);
|
|
||||||
ctx->flags |= E2F_FLAG_RESTART;
|
|
||||||
}
|
|
||||||
- first_block += fs->super->s_blocks_per_group;
|
|
||||||
}
|
|
||||||
ctx->invalid_bitmaps = 0;
|
|
||||||
}
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/super.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/super.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/super.c
|
|
||||||
@@ -569,11 +569,9 @@ void check_super_block(e2fsck_t ctx)
|
|
||||||
|
|
||||||
for (i = 0, gd=fs->group_desc; i < fs->group_desc_count; i++, gd++) {
|
|
||||||
pctx.group = i;
|
|
||||||
-
|
|
||||||
- if (i == fs->group_desc_count - 1)
|
|
||||||
- last_block = sb->s_blocks_count - 1;
|
|
||||||
- else
|
|
||||||
- last_block = first_block + blocks_per_group - 1;
|
|
||||||
+
|
|
||||||
+ first_block = ext2fs_group_first_block(fs, i);
|
|
||||||
+ last_block = ext2fs_group_last_block(fs, i);
|
|
||||||
|
|
||||||
if ((gd->bg_block_bitmap < first_block) ||
|
|
||||||
(gd->bg_block_bitmap > last_block)) {
|
|
||||||
@@ -608,7 +606,6 @@ void check_super_block(e2fsck_t ctx)
|
|
||||||
}
|
|
||||||
free_blocks += gd->bg_free_blocks_count;
|
|
||||||
free_inodes += gd->bg_free_inodes_count;
|
|
||||||
- first_block += sb->s_blocks_per_group;
|
|
||||||
|
|
||||||
if ((gd->bg_free_blocks_count > sb->s_blocks_per_group) ||
|
|
||||||
(gd->bg_free_inodes_count > sb->s_inodes_per_group) ||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
@@ -1,5 +1,13 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * alloc_tables.c (ext2fs_allocate_group_table):
|
|
||||||
+ * check_desc.c (ext2fs_check_desc):
|
|
||||||
+ Use new inlines to calculate group first & last blocks.
|
|
||||||
+ * ext2fs.h:
|
|
||||||
+ Create new inlines to calculate first/last group blocks.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* bmove.c (process_block):
|
|
||||||
* getsize.c (main):
|
|
||||||
* icount.c (ext2fs_create_icount2, insert_icount_el):
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/alloc_tables.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/alloc_tables.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/alloc_tables.c
|
|
||||||
@@ -34,12 +34,8 @@ errcode_t ext2fs_allocate_group_table(ex
|
|
||||||
blk_t group_blk, start_blk, last_blk, new_blk, blk;
|
|
||||||
int j;
|
|
||||||
|
|
||||||
- group_blk = fs->super->s_first_data_block +
|
|
||||||
- (group * fs->super->s_blocks_per_group);
|
|
||||||
-
|
|
||||||
- last_blk = group_blk + fs->super->s_blocks_per_group;
|
|
||||||
- if (last_blk >= fs->super->s_blocks_count)
|
|
||||||
- last_blk = fs->super->s_blocks_count - 1;
|
|
||||||
+ group_blk = ext2fs_group_first_block(fs, group);
|
|
||||||
+ last_blk = ext2fs_group_last_block(fs, group);
|
|
||||||
|
|
||||||
if (!bmap)
|
|
||||||
bmap = fs->block_map;
|
|
||||||
@@ -54,8 +50,8 @@ errcode_t ext2fs_allocate_group_table(ex
|
|
||||||
return retval;
|
|
||||||
start_blk += fs->inode_blocks_per_group;
|
|
||||||
start_blk += ((fs->stride * group) %
|
|
||||||
- (last_blk - start_blk));
|
|
||||||
- if (start_blk > last_blk)
|
|
||||||
+ (last_blk - start_blk + 1));
|
|
||||||
+ if (start_blk >= last_blk)
|
|
||||||
start_blk = group_blk;
|
|
||||||
} else
|
|
||||||
start_blk = group_blk;
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/check_desc.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/check_desc.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/check_desc.c
|
|
||||||
@@ -38,11 +38,9 @@ errcode_t ext2fs_check_desc(ext2_filsys
|
|
||||||
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
|
|
||||||
|
|
||||||
for (i = 0; i < fs->group_desc_count; i++) {
|
|
||||||
- if (i == fs->group_desc_count - 1)
|
|
||||||
- last_block = fs->super->s_blocks_count - 1;
|
|
||||||
- else
|
|
||||||
- last_block = first_block +
|
|
||||||
- fs->super->s_blocks_per_group - 1;
|
|
||||||
+ first_block = ext2fs_group_first_block(fs, i);
|
|
||||||
+ last_block = ext2fs_group_last_block(fs, i);
|
|
||||||
+
|
|
||||||
/*
|
|
||||||
* Check to make sure block bitmap for group is
|
|
||||||
* located within the group.
|
|
||||||
@@ -65,8 +63,6 @@ errcode_t ext2fs_check_desc(ext2_filsys
|
|
||||||
((fs->group_desc[i].bg_inode_table +
|
|
||||||
fs->inode_blocks_per_group) > last_block))
|
|
||||||
return EXT2_ET_GDESC_BAD_INODE_TABLE;
|
|
||||||
-
|
|
||||||
- first_block += fs->super->s_blocks_per_group;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ext2fs.h
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ext2fs.h
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ext2fs.h
|
|
||||||
@@ -967,6 +967,8 @@ extern int ext2fs_test_ib_dirty(ext2_fil
|
|
||||||
extern int ext2fs_test_bb_dirty(ext2_filsys fs);
|
|
||||||
extern int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk);
|
|
||||||
extern int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino);
|
|
||||||
+extern blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group);
|
|
||||||
+extern blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group);
|
|
||||||
extern blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
|
|
||||||
struct ext2_inode *inode);
|
|
||||||
extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b);
|
|
||||||
@@ -1131,6 +1133,26 @@ _INLINE_ int ext2fs_group_of_ino(ext2_fi
|
|
||||||
return (ino - 1) / fs->super->s_inodes_per_group;
|
|
||||||
}
|
|
||||||
|
|
||||||
+/*
|
|
||||||
+ * Return the first block (inclusive) in a group
|
|
||||||
+ */
|
|
||||||
+_INLINE_ blk_t ext2fs_group_first_block(ext2_filsys fs, dgrp_t group)
|
|
||||||
+{
|
|
||||||
+ return fs->super->s_first_data_block +
|
|
||||||
+ (group * fs->super->s_blocks_per_group);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+ * Return the last block (inclusive) in a group
|
|
||||||
+ */
|
|
||||||
+_INLINE_ blk_t ext2fs_group_last_block(ext2_filsys fs, dgrp_t group)
|
|
||||||
+{
|
|
||||||
+ return (group == fs->group_desc_count - 1 ?
|
|
||||||
+ fs->super->s_blocks_count - 1 :
|
|
||||||
+ ext2fs_group_first_block(fs, group) +
|
|
||||||
+ (fs->super->s_blocks_per_group - 1));
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
_INLINE_ blk_t ext2fs_inode_data_blocks(ext2_filsys fs,
|
|
||||||
struct ext2_inode *inode)
|
|
||||||
{
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
@@ -1,5 +1,10 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * dumpe2fs.c (list_desc): Use new inlines to calculate group
|
|
||||||
+ first & last blocks.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* dumpe2fs.c (list_bad_blocks):
|
|
||||||
* e2image.c (output_meta_data_blocks, write_raw_image_file):
|
|
||||||
* mke2fs.c (test_disk, handle_bad_blocks): Fix printf formats.
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/dumpe2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/dumpe2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/dumpe2fs.c
|
|
||||||
@@ -153,13 +153,11 @@ static void list_desc (ext2_filsys fs)
|
|
||||||
else
|
|
||||||
old_desc_blocks = fs->desc_blocks;
|
|
||||||
for (i = 0; i < fs->group_desc_count; i++) {
|
|
||||||
+ first_block = ext2fs_group_first_block(fs, i);
|
|
||||||
+ last_block = ext2fs_group_last_block(fs, i);
|
|
||||||
+
|
|
||||||
ext2fs_super_and_bgd_loc(fs, i, &super_blk,
|
|
||||||
&old_desc_blk, &new_desc_blk, 0);
|
|
||||||
- if (i == fs->group_desc_count - 1)
|
|
||||||
- last_block = fs->super->s_blocks_count - 1;
|
|
||||||
- else
|
|
||||||
- last_block = first_block +
|
|
||||||
- fs->super->s_blocks_per_group - 1;
|
|
||||||
|
|
||||||
printf (_("Group %lu: (Blocks "), i);
|
|
||||||
print_range(first_block, last_block);
|
|
||||||
@@ -226,7 +224,6 @@ static void list_desc (ext2_filsys fs)
|
|
||||||
fputc('\n', stdout);
|
|
||||||
inode_bitmap += fs->super->s_inodes_per_group / 8;
|
|
||||||
}
|
|
||||||
- first_block += fs->super->s_blocks_per_group;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/tests/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/tests/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/tests/ChangeLog
|
|
||||||
@@ -1,3 +1,9 @@
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
+ * m_raid_opt/expect.1:
|
|
||||||
+ Change expected values for last group due to correctly
|
|
||||||
+ calculated last block when using strides.
|
|
||||||
+
|
|
||||||
2006-05-28 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* test_config: Unset all locale-related environment variables
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/tests/m_raid_opt/expect.1
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/tests/m_raid_opt/expect.1
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/tests/m_raid_opt/expect.1
|
|
||||||
@@ -944,8 +944,8 @@ Group 126: (Blocks 129025-130048)
|
|
||||||
Free inodes: 32257-32512
|
|
||||||
Group 127: (Blocks 130049-131071)
|
|
||||||
Group descriptor at 130049
|
|
||||||
- Block bitmap at 130744 (+695), Inode bitmap at 130745 (+696)
|
|
||||||
+ Block bitmap at 130743 (+694), Inode bitmap at 130744 (+695)
|
|
||||||
Inode table at 130050-130081 (+1)
|
|
||||||
988 free blocks, 256 free inodes, 0 directories
|
|
||||||
- Free blocks: 130082-130743, 130746-131071
|
|
||||||
+ Free blocks: 130082-130742, 130745-131071
|
|
||||||
Free inodes: 32513-32768
|
|
@ -1,319 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date Tue Sep 12 14:55:22 2006 -0400
|
|
||||||
# Node ID 90cd01f7fcd6293846f0b3ca6ce2b007e3dd7d51
|
|
||||||
# parent: cb841a8195a7aa87e8d0c95686291e8fb53358df
|
|
||||||
Fix loops over group descriptors to prevent 2**32-1 block number overflows
|
|
||||||
|
|
||||||
For loops iterating over all group descriptors, consistently define
|
|
||||||
first_block and last_block in a way that they are inclusive of the
|
|
||||||
range, and do not overflow.
|
|
||||||
|
|
||||||
Previously on the last block group we did a test of <= first +
|
|
||||||
dec_blocks; this would actually wrap back to 0 for a total block count
|
|
||||||
of 2^32-1
|
|
||||||
|
|
||||||
Also add handling of last block group which may be smaller.
|
|
||||||
|
|
||||||
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
@@ -1,3 +1,11 @@
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
+ * pass1b.c (check_if_fs_block): Change block group loop to use
|
|
||||||
+ a common pattern of first_block/last_block, etc.
|
|
||||||
+
|
|
||||||
+ * super.c (check_super_block): Avoid overflows when iterating over
|
|
||||||
+ group descriptors on very large filesystems
|
|
||||||
+
|
|
||||||
2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* pass5.c (check_inode_bitmaps, check_inode_end, check_block_end):
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1b.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/pass1b.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1b.c
|
|
||||||
@@ -779,16 +779,16 @@ errout:
|
|
||||||
static int check_if_fs_block(e2fsck_t ctx, blk_t test_block)
|
|
||||||
{
|
|
||||||
ext2_filsys fs = ctx->fs;
|
|
||||||
- blk_t block;
|
|
||||||
+ blk_t first_block;
|
|
||||||
dgrp_t i;
|
|
||||||
|
|
||||||
- block = fs->super->s_first_data_block;
|
|
||||||
+ first_block = fs->super->s_first_data_block;
|
|
||||||
for (i = 0; i < fs->group_desc_count; i++) {
|
|
||||||
|
|
||||||
- /* Check superblocks/block group descriptros */
|
|
||||||
+ /* Check superblocks/block group descriptors */
|
|
||||||
if (ext2fs_bg_has_super(fs, i)) {
|
|
||||||
- if (test_block >= block &&
|
|
||||||
- (test_block <= block + fs->desc_blocks))
|
|
||||||
+ if (test_block >= first_block &&
|
|
||||||
+ (test_block <= first_block + fs->desc_blocks))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -804,7 +804,7 @@ static int check_if_fs_block(e2fsck_t ct
|
|
||||||
(test_block == fs->group_desc[i].bg_inode_bitmap))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
- block += fs->super->s_blocks_per_group;
|
|
||||||
+ first_block += fs->super->s_blocks_per_group;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/super.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/super.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/super.c
|
|
||||||
@@ -566,15 +566,17 @@ void check_super_block(e2fsck_t ctx)
|
|
||||||
* Verify the group descriptors....
|
|
||||||
*/
|
|
||||||
first_block = sb->s_first_data_block;
|
|
||||||
- last_block = first_block + blocks_per_group;
|
|
||||||
|
|
||||||
for (i = 0, gd=fs->group_desc; i < fs->group_desc_count; i++, gd++) {
|
|
||||||
pctx.group = i;
|
|
||||||
|
|
||||||
if (i == fs->group_desc_count - 1)
|
|
||||||
- last_block = sb->s_blocks_count;
|
|
||||||
+ last_block = sb->s_blocks_count - 1;
|
|
||||||
+ else
|
|
||||||
+ last_block = first_block + blocks_per_group - 1;
|
|
||||||
+
|
|
||||||
if ((gd->bg_block_bitmap < first_block) ||
|
|
||||||
- (gd->bg_block_bitmap >= last_block)) {
|
|
||||||
+ (gd->bg_block_bitmap > last_block)) {
|
|
||||||
pctx.blk = gd->bg_block_bitmap;
|
|
||||||
if (fix_problem(ctx, PR_0_BB_NOT_GROUP, &pctx))
|
|
||||||
gd->bg_block_bitmap = 0;
|
|
||||||
@@ -584,7 +586,7 @@ void check_super_block(e2fsck_t ctx)
|
|
||||||
ctx->invalid_bitmaps++;
|
|
||||||
}
|
|
||||||
if ((gd->bg_inode_bitmap < first_block) ||
|
|
||||||
- (gd->bg_inode_bitmap >= last_block)) {
|
|
||||||
+ (gd->bg_inode_bitmap > last_block)) {
|
|
||||||
pctx.blk = gd->bg_inode_bitmap;
|
|
||||||
if (fix_problem(ctx, PR_0_IB_NOT_GROUP, &pctx))
|
|
||||||
gd->bg_inode_bitmap = 0;
|
|
||||||
@@ -595,7 +597,7 @@ void check_super_block(e2fsck_t ctx)
|
|
||||||
}
|
|
||||||
if ((gd->bg_inode_table < first_block) ||
|
|
||||||
((gd->bg_inode_table +
|
|
||||||
- fs->inode_blocks_per_group - 1) >= last_block)) {
|
|
||||||
+ fs->inode_blocks_per_group - 1) > last_block)) {
|
|
||||||
pctx.blk = gd->bg_inode_table;
|
|
||||||
if (fix_problem(ctx, PR_0_ITABLE_NOT_GROUP, &pctx))
|
|
||||||
gd->bg_inode_table = 0;
|
|
||||||
@@ -607,7 +609,6 @@ void check_super_block(e2fsck_t ctx)
|
|
||||||
free_blocks += gd->bg_free_blocks_count;
|
|
||||||
free_inodes += gd->bg_free_inodes_count;
|
|
||||||
first_block += sb->s_blocks_per_group;
|
|
||||||
- last_block += sb->s_blocks_per_group;
|
|
||||||
|
|
||||||
if ((gd->bg_free_blocks_count > sb->s_blocks_per_group) ||
|
|
||||||
(gd->bg_free_inodes_count > sb->s_inodes_per_group) ||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
@@ -1,3 +1,8 @@
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
+ * check_desc.c (ext2fs_check_desc): avoid overflows when iterating
|
|
||||||
+ over group descriptors on very large filesystems.
|
|
||||||
+
|
|
||||||
2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* bitmaps.c (ext2fs_set_bitmap_padding): Fix potential overflow
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/check_desc.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/check_desc.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/check_desc.c
|
|
||||||
@@ -32,37 +32,41 @@
|
|
||||||
errcode_t ext2fs_check_desc(ext2_filsys fs)
|
|
||||||
{
|
|
||||||
dgrp_t i;
|
|
||||||
- blk_t block = fs->super->s_first_data_block;
|
|
||||||
- blk_t next;
|
|
||||||
+ blk_t first_block = fs->super->s_first_data_block;
|
|
||||||
+ blk_t last_block;
|
|
||||||
|
|
||||||
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
|
|
||||||
|
|
||||||
for (i = 0; i < fs->group_desc_count; i++) {
|
|
||||||
- next = block + fs->super->s_blocks_per_group;
|
|
||||||
+ if (i == fs->group_desc_count - 1)
|
|
||||||
+ last_block = fs->super->s_blocks_count - 1;
|
|
||||||
+ else
|
|
||||||
+ last_block = first_block +
|
|
||||||
+ fs->super->s_blocks_per_group - 1;
|
|
||||||
/*
|
|
||||||
* Check to make sure block bitmap for group is
|
|
||||||
* located within the group.
|
|
||||||
*/
|
|
||||||
- if (fs->group_desc[i].bg_block_bitmap < block ||
|
|
||||||
- fs->group_desc[i].bg_block_bitmap >= next)
|
|
||||||
+ if (fs->group_desc[i].bg_block_bitmap < first_block ||
|
|
||||||
+ fs->group_desc[i].bg_block_bitmap > last_block)
|
|
||||||
return EXT2_ET_GDESC_BAD_BLOCK_MAP;
|
|
||||||
/*
|
|
||||||
* Check to make sure inode bitmap for group is
|
|
||||||
* located within the group
|
|
||||||
*/
|
|
||||||
- if (fs->group_desc[i].bg_inode_bitmap < block ||
|
|
||||||
- fs->group_desc[i].bg_inode_bitmap >= next)
|
|
||||||
+ if (fs->group_desc[i].bg_inode_bitmap < first_block ||
|
|
||||||
+ fs->group_desc[i].bg_inode_bitmap > last_block)
|
|
||||||
return EXT2_ET_GDESC_BAD_INODE_MAP;
|
|
||||||
/*
|
|
||||||
* Check to make sure inode table for group is located
|
|
||||||
* within the group
|
|
||||||
*/
|
|
||||||
- if (fs->group_desc[i].bg_inode_table < block ||
|
|
||||||
+ if (fs->group_desc[i].bg_inode_table < first_block ||
|
|
||||||
((fs->group_desc[i].bg_inode_table +
|
|
||||||
- fs->inode_blocks_per_group) >= next))
|
|
||||||
+ fs->inode_blocks_per_group) > last_block))
|
|
||||||
return EXT2_ET_GDESC_BAD_INODE_TABLE;
|
|
||||||
|
|
||||||
- block = next;
|
|
||||||
+ first_block += fs->super->s_blocks_per_group;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
@@ -1,3 +1,12 @@
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
+ * dumpe2fs.c (list_desc, mark_table_blocks): Avoid overflows when
|
|
||||||
+ iterating over group descriptors on very large
|
|
||||||
+ filesystems.
|
|
||||||
+
|
|
||||||
+ * e2image.c (mark_table_blocks): Change block group loop to use a
|
|
||||||
+ common pattern of first_block/last_block, etc.
|
|
||||||
+
|
|
||||||
2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* tune2fs.c (main), mke2fs.c (PRS): Use e2p_percent to properly
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/dumpe2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/dumpe2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/dumpe2fs.c
|
|
||||||
@@ -130,7 +130,7 @@ static void list_desc (ext2_filsys fs)
|
|
||||||
{
|
|
||||||
unsigned long i;
|
|
||||||
long diff;
|
|
||||||
- blk_t group_blk, next_blk;
|
|
||||||
+ blk_t first_block, last_block;
|
|
||||||
blk_t super_blk, old_desc_blk, new_desc_blk;
|
|
||||||
char *block_bitmap=NULL, *inode_bitmap=NULL;
|
|
||||||
int inode_blocks_per_group, old_desc_blocks, reserved_gdt;
|
|
||||||
@@ -147,7 +147,7 @@ static void list_desc (ext2_filsys fs)
|
|
||||||
EXT2_BLOCK_SIZE(fs->super);
|
|
||||||
reserved_gdt = fs->super->s_reserved_gdt_blocks;
|
|
||||||
fputc('\n', stdout);
|
|
||||||
- group_blk = fs->super->s_first_data_block;
|
|
||||||
+ first_block = fs->super->s_first_data_block;
|
|
||||||
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
|
|
||||||
old_desc_blocks = fs->super->s_first_meta_bg;
|
|
||||||
else
|
|
||||||
@@ -155,11 +155,14 @@ static void list_desc (ext2_filsys fs)
|
|
||||||
for (i = 0; i < fs->group_desc_count; i++) {
|
|
||||||
ext2fs_super_and_bgd_loc(fs, i, &super_blk,
|
|
||||||
&old_desc_blk, &new_desc_blk, 0);
|
|
||||||
- next_blk = group_blk + fs->super->s_blocks_per_group;
|
|
||||||
- if (next_blk > fs->super->s_blocks_count)
|
|
||||||
- next_blk = fs->super->s_blocks_count;
|
|
||||||
+ if (i == fs->group_desc_count - 1)
|
|
||||||
+ last_block = fs->super->s_blocks_count - 1;
|
|
||||||
+ else
|
|
||||||
+ last_block = first_block +
|
|
||||||
+ fs->super->s_blocks_per_group - 1;
|
|
||||||
+
|
|
||||||
printf (_("Group %lu: (Blocks "), i);
|
|
||||||
- print_range(group_blk, next_blk - 1);
|
|
||||||
+ print_range(first_block, last_block);
|
|
||||||
fputs(")", stdout);
|
|
||||||
print_bg_opts(fs, i);
|
|
||||||
has_super = ((i==0) || super_blk);
|
|
||||||
@@ -188,19 +191,19 @@ static void list_desc (ext2_filsys fs)
|
|
||||||
fputc('\n', stdout);
|
|
||||||
fputs(_(" Block bitmap at "), stdout);
|
|
||||||
print_number(fs->group_desc[i].bg_block_bitmap);
|
|
||||||
- diff = fs->group_desc[i].bg_block_bitmap - group_blk;
|
|
||||||
+ diff = fs->group_desc[i].bg_block_bitmap - first_block;
|
|
||||||
if (diff >= 0)
|
|
||||||
printf(" (+%ld)", diff);
|
|
||||||
fputs(_(", Inode bitmap at "), stdout);
|
|
||||||
print_number(fs->group_desc[i].bg_inode_bitmap);
|
|
||||||
- diff = fs->group_desc[i].bg_inode_bitmap - group_blk;
|
|
||||||
+ diff = fs->group_desc[i].bg_inode_bitmap - first_block;
|
|
||||||
if (diff >= 0)
|
|
||||||
printf(" (+%ld)", diff);
|
|
||||||
fputs(_("\n Inode table at "), stdout);
|
|
||||||
print_range(fs->group_desc[i].bg_inode_table,
|
|
||||||
fs->group_desc[i].bg_inode_table +
|
|
||||||
inode_blocks_per_group - 1);
|
|
||||||
- diff = fs->group_desc[i].bg_inode_table - group_blk;
|
|
||||||
+ diff = fs->group_desc[i].bg_inode_table - first_block;
|
|
||||||
if (diff > 0)
|
|
||||||
printf(" (+%ld)", diff);
|
|
||||||
printf (_("\n %d free blocks, %d free inodes, "
|
|
||||||
@@ -223,7 +226,7 @@ static void list_desc (ext2_filsys fs)
|
|
||||||
fputc('\n', stdout);
|
|
||||||
inode_bitmap += fs->super->s_inodes_per_group / 8;
|
|
||||||
}
|
|
||||||
- group_blk = next_blk;
|
|
||||||
+ first_block += fs->super->s_blocks_per_group;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/e2image.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/e2image.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/e2image.c
|
|
||||||
@@ -244,21 +244,21 @@ static int process_file_block(ext2_filsy
|
|
||||||
|
|
||||||
static void mark_table_blocks(ext2_filsys fs)
|
|
||||||
{
|
|
||||||
- blk_t block, b;
|
|
||||||
+ blk_t first_block, b;
|
|
||||||
unsigned int i,j;
|
|
||||||
|
|
||||||
- block = fs->super->s_first_data_block;
|
|
||||||
+ first_block = fs->super->s_first_data_block;
|
|
||||||
/*
|
|
||||||
* Mark primary superblock
|
|
||||||
*/
|
|
||||||
- ext2fs_mark_block_bitmap(meta_block_map, block);
|
|
||||||
+ ext2fs_mark_block_bitmap(meta_block_map, first_block);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Mark the primary superblock descriptors
|
|
||||||
*/
|
|
||||||
for (j = 0; j < fs->desc_blocks; j++) {
|
|
||||||
ext2fs_mark_block_bitmap(meta_block_map,
|
|
||||||
- ext2fs_descriptor_block_loc(fs, block, j));
|
|
||||||
+ ext2fs_descriptor_block_loc(fs, first_block, j));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < fs->group_desc_count; i++) {
|
|
||||||
@@ -287,7 +287,7 @@ static void mark_table_blocks(ext2_filsy
|
|
||||||
ext2fs_mark_block_bitmap(meta_block_map,
|
|
||||||
fs->group_desc[i].bg_inode_bitmap);
|
|
||||||
}
|
|
||||||
- block += fs->super->s_blocks_per_group;
|
|
||||||
+ first_block += fs->super->s_blocks_per_group;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/getsize.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/getsize.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/getsize.c
|
|
||||||
@@ -250,6 +250,11 @@ errcode_t ext2fs_get_device_size(const c
|
|
||||||
if (fstat(fd, &st) == 0)
|
|
||||||
#endif
|
|
||||||
if (S_ISREG(st.st_mode)) {
|
|
||||||
+ if ((sizeof(*retblocks) < sizeof(unsigned long long)) &&
|
|
||||||
+ ((st.st_size / blocksize) > 0xFFFFFFFF)) {
|
|
||||||
+ rc = EFBIG;
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
*retblocks = st.st_size / blocksize;
|
|
||||||
goto out;
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
--- e2fsprogs-1.39/lib/blkid/probe.c.leak 2006-09-05 15:41:13.000000000 -0400
|
|
||||||
+++ e2fsprogs-1.39/lib/blkid/probe.c 2006-09-05 15:40:19.000000000 -0400
|
|
||||||
@@ -884,7 +884,12 @@
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dev->bid_type) {
|
|
||||||
- if (probe.fd >= 0) close(probe.fd);
|
|
||||||
+ if (probe.fd >= 0)
|
|
||||||
+ close(probe.fd);
|
|
||||||
+ if (probe.sbbuf)
|
|
||||||
+ free(probe.sbbuf);
|
|
||||||
+ if (probe.buf)
|
|
||||||
+ free(probe.buf);
|
|
||||||
blkid_free_dev(dev);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date 1159151618 14400
|
|
||||||
# Node ID 6ded68c87fd5e19be3a43ced60477d96b87cbae0
|
|
||||||
# Parent d39ab0d5fde2da82c7de72a536c9bd635d372836
|
|
||||||
blkid_devno_to_devname(): Avoid recursive loops due to symlinks in /dev
|
|
||||||
|
|
||||||
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/lib/blkid/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/lib/blkid/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/lib/blkid/ChangeLog
|
|
||||||
@@ -2,6 +2,11 @@
|
|
||||||
|
|
||||||
* read.c (parse_dev): Fix memory leak on error path.
|
|
||||||
|
|
||||||
+2006-09-24 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * devno.c (scan_dir): Don't follow symlinks when recursively
|
|
||||||
+ searching directories under /dev.
|
|
||||||
+
|
|
||||||
2006-09-17 Karel Zak <kzak@redhat.com>
|
|
||||||
|
|
||||||
* probe.c (probe_fat): Fix problem with empty FAT label.
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/lib/blkid/devno.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/lib/blkid/devno.c
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/lib/blkid/devno.c
|
|
||||||
@@ -120,15 +120,16 @@ static void scan_dir(char *dirname, dev_
|
|
||||||
if (stat(path, &st) < 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
- if (S_ISDIR(st.st_mode))
|
|
||||||
- add_to_dirlist(path, list);
|
|
||||||
- else if (S_ISBLK(st.st_mode) && st.st_rdev == devno) {
|
|
||||||
+ if (S_ISBLK(st.st_mode) && st.st_rdev == devno) {
|
|
||||||
*devname = blkid_strdup(path);
|
|
||||||
DBG(DEBUG_DEVNO,
|
|
||||||
printf("found 0x%llx at %s (%p)\n", devno,
|
|
||||||
path, *devname));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
+ if (S_ISDIR(st.st_mode) && !lstat(path, &st) &&
|
|
||||||
+ S_ISDIR(st.st_mode))
|
|
||||||
+ add_to_dirlist(path, list);
|
|
||||||
}
|
|
||||||
closedir(dir);
|
|
||||||
return;
|
|
@ -1,52 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date 1156885376 14400
|
|
||||||
# Node ID 78dd5824848b223988f2d8531c7dbbf068bc255e
|
|
||||||
# Parent 712ade33bdf31b709d4796721bfa0f458f858a24
|
|
||||||
Fix debugfs coredump when lsdel is run without an open filesystem
|
|
||||||
|
|
||||||
Addresses Debian Bug: #378335
|
|
||||||
|
|
||||||
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
|
|
||||||
--- a/debugfs/ChangeLog Sat Aug 19 21:16:17 2006 -0400
|
|
||||||
+++ b/debugfs/ChangeLog Tue Aug 29 17:02:56 2006 -0400
|
|
||||||
@@ -28,6 +28,12 @@
|
|
||||||
|
|
||||||
* htree.c (htree_dump_int_node): Fix printf formats.
|
|
||||||
|
|
||||||
+2006-08-29 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * lsdel.c (do_lsdel): Fix core-dumping bug. Don't depend on
|
|
||||||
+ current_fs being non-NULL until after the call to
|
|
||||||
+ common_args_process(). (Addresses Debian Bug: #378335)
|
|
||||||
+
|
|
||||||
2006-05-29 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* util.c (reset_getopt): In order to support ancient Linux header
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/debugfs/lsdel.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/debugfs/lsdel.c
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/debugfs/lsdel.c
|
|
||||||
@@ -81,12 +81,13 @@ void do_lsdel(int argc, char **argv)
|
|
||||||
int i;
|
|
||||||
long secs = 0;
|
|
||||||
char *tmp;
|
|
||||||
- time_t now = current_fs->now ? current_fs->now : time(0);
|
|
||||||
+ time_t now;
|
|
||||||
FILE *out;
|
|
||||||
|
|
||||||
if (common_args_process(argc, argv, 1, 2, "ls_deleted_inodes",
|
|
||||||
"[secs]", 0))
|
|
||||||
return;
|
|
||||||
+
|
|
||||||
if (argc > 1) {
|
|
||||||
secs = strtol(argv[1],&tmp,0);
|
|
||||||
if (*tmp) {
|
|
||||||
@@ -95,6 +96,7 @@ void do_lsdel(int argc, char **argv)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ now = current_fs->now ? current_fs->now : time(0);
|
|
||||||
max_delarray = 100;
|
|
||||||
num_delarray = 0;
|
|
||||||
delarray = malloc(max_delarray * sizeof(struct deleted_info));
|
|
@ -1,106 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date Tue Sep 12 14:56:18 2006 -0400
|
|
||||||
# Node ID 8be686f713b52a3fa0b5dab70980ea3ddbad27b5
|
|
||||||
# parent: 7e1e8751d2be27716166e88453b52273b7096039
|
|
||||||
Fix more rounding overflows for filesystems that have 2**32-1 blocks
|
|
||||||
|
|
||||||
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
@@ -1,5 +1,9 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * pass1.c (handle_bad_fs_blocks): use blk_t, not int for first_block.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* pass1.c (new_table_block, handle_fs_bad_blocks):
|
|
||||||
* super.c (check_super_block):
|
|
||||||
Use new inlines to calculate group first & last blocks.
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/pass1.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1.c
|
|
||||||
@@ -1953,7 +1953,7 @@ static void handle_fs_bad_blocks(e2fsck_
|
|
||||||
{
|
|
||||||
ext2_filsys fs = ctx->fs;
|
|
||||||
dgrp_t i;
|
|
||||||
- int first_block;
|
|
||||||
+ blk_t first_block;
|
|
||||||
|
|
||||||
for (i = 0; i < fs->group_desc_count; i++) {
|
|
||||||
first_block = ext2fs_group_first_block(fs, i);
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
@@ -1,5 +1,9 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * mke2fs.c (PRS): Avoid overflow in megs calculation.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* dumpe2fs.c (list_desc): Use new inlines to calculate group
|
|
||||||
first & last blocks.
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/mke2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/mke2fs.c
|
|
||||||
@@ -1261,7 +1261,7 @@ static void PRS(int argc, char *argv[])
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fs_type) {
|
|
||||||
- int megs = fs_param.s_blocks_count *
|
|
||||||
+ int megs = (__u64)fs_param.s_blocks_count *
|
|
||||||
(EXT2_BLOCK_SIZE(&fs_param) / 1024) / 1024;
|
|
||||||
|
|
||||||
if (megs <= 3)
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
@@ -1,5 +1,11 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * online.c (online_resize_fs): use div_ceil for r_frac calculation.
|
|
||||||
+ * resize2fs.c (adjust_fs_info): avoid overflow in blk calculation
|
|
||||||
+ when figuring new reserved blocks count.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* resize2fs.c (adjust_fs_info): Disallow > 2^32 indoes at resize time.
|
|
||||||
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/online.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/online.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/online.c
|
|
||||||
@@ -59,8 +59,7 @@ errcode_t online_resize_fs(ext2_filsys f
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
- r_frac = ((100 * sb->s_r_blocks_count) + sb->s_blocks_count-1) /
|
|
||||||
- sb->s_blocks_count;
|
|
||||||
+ r_frac = ext2fs_div_ceil(100 * sb->s_r_blocks_count, sb->s_blocks_count);
|
|
||||||
|
|
||||||
retval = ext2fs_read_bitmaps(fs);
|
|
||||||
if (retval)
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/resize2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c
|
|
||||||
@@ -250,7 +250,7 @@ retry:
|
|
||||||
/*
|
|
||||||
* Adjust the number of reserved blocks
|
|
||||||
*/
|
|
||||||
- blk = old_fs->super->s_r_blocks_count * 100 /
|
|
||||||
+ blk = (__u64)old_fs->super->s_r_blocks_count * 100 /
|
|
||||||
old_fs->super->s_blocks_count;
|
|
||||||
fs->super->s_r_blocks_count = e2p_percent(blk,
|
|
||||||
fs->super->s_blocks_count);
|
|
@ -1,173 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date 1182205610 14400
|
|
||||||
# Node ID 5c00c21991974cc750efa2474fab484b0a1f1522
|
|
||||||
# Parent 449d075befe0e4be32cce9d34ca1f03575e292d2
|
|
||||||
Don't write changes to the backup superblocks by default
|
|
||||||
|
|
||||||
This patch changes ext2fs_open() to set EXT2_FLAG_MASTER_SB_ONLY by
|
|
||||||
default. This avoids some problems in e2fsck (reported by Jim Garlick)
|
|
||||||
where a corrupt journal can end up writing the bad superblock to the
|
|
||||||
backups. In general, only e2fsck (after the filesystem is clean),
|
|
||||||
tune2fs, and resize2fs should change the backup superblocks by default.
|
|
||||||
Most callers of ext2fs_open() should not be touching anything where the
|
|
||||||
backups should be touched. So let's change the defaults to avoid
|
|
||||||
potential problems.
|
|
||||||
|
|
||||||
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog
|
|
||||||
@@ -1,3 +1,10 @@
|
|
||||||
+2007-06-18 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * journal.c (e2fsck_run_ext3_journal), unix.c (main): Explicitly
|
|
||||||
+ add the EXT2_FLAG_MASTER_SB_ONLY flag to make sure we
|
|
||||||
+ won't write out the backup superblocks until we're sure
|
|
||||||
+ that we want write them out.
|
|
||||||
+
|
|
||||||
2007-03-28 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* pass1.c (e2fsck_pass1, check_ext_attr),
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/e2fsck/journal.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/e2fsck/journal.c
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/e2fsck/journal.c
|
|
||||||
@@ -832,6 +832,7 @@ int e2fsck_run_ext3_journal(e2fsck_t ctx
|
|
||||||
}
|
|
||||||
ctx->fs->priv_data = ctx;
|
|
||||||
ctx->fs->now = ctx->now;
|
|
||||||
+ ctx->fs->flags |= EXT2_FLAG_MASTER_SB_ONLY;
|
|
||||||
|
|
||||||
/* Set the superblock flags */
|
|
||||||
e2fsck_clear_recover(ctx, recover_retval);
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/e2fsck/unix.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/e2fsck/unix.c
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/e2fsck/unix.c
|
|
||||||
@@ -978,6 +978,19 @@ restart:
|
|
||||||
fix_problem(ctx, PR_0_SB_CORRUPT, &pctx);
|
|
||||||
fatal_error(ctx, 0);
|
|
||||||
}
|
|
||||||
+ /*
|
|
||||||
+ * We only update the master superblock because (a) paranoia;
|
|
||||||
+ * we don't want to corrupt the backup superblocks, and (b) we
|
|
||||||
+ * don't need to update the mount count and last checked
|
|
||||||
+ * fields in the backup superblock (the kernel doesn't update
|
|
||||||
+ * the backup superblocks anyway). With newer versions of the
|
|
||||||
+ * library this flag is set by ext2fs_open2(), but we set this
|
|
||||||
+ * here just to be sure. (No, we don't support e2fsck running
|
|
||||||
+ * with some other libext2fs than the one that it was shipped
|
|
||||||
+ * with, but just in case....)
|
|
||||||
+ */
|
|
||||||
+ fs->flags |= EXT2_FLAG_MASTER_SB_ONLY;
|
|
||||||
+
|
|
||||||
ctx->fs = fs;
|
|
||||||
fs->priv_data = ctx;
|
|
||||||
fs->now = ctx->now;
|
|
||||||
@@ -989,7 +1002,6 @@ restart:
|
|
||||||
get_newer:
|
|
||||||
fatal_error(ctx, _("Get a newer version of e2fsck!"));
|
|
||||||
}
|
|
||||||
-
|
|
||||||
/*
|
|
||||||
* Set the device name, which is used whenever we print error
|
|
||||||
* or informational messages to the user.
|
|
||||||
@@ -1088,15 +1100,6 @@ restart:
|
|
||||||
!(ctx->options & E2F_OPT_READONLY))
|
|
||||||
ext2fs_mark_super_dirty(fs);
|
|
||||||
|
|
||||||
- /*
|
|
||||||
- * We only update the master superblock because (a) paranoia;
|
|
||||||
- * we don't want to corrupt the backup superblocks, and (b) we
|
|
||||||
- * don't need to update the mount count and last checked
|
|
||||||
- * fields in the backup superblock (the kernel doesn't
|
|
||||||
- * update the backup superblocks anyway).
|
|
||||||
- */
|
|
||||||
- fs->flags |= EXT2_FLAG_MASTER_SB_ONLY;
|
|
||||||
-
|
|
||||||
ehandler_init(fs->io);
|
|
||||||
|
|
||||||
if (ctx->superblock)
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog
|
|
||||||
@@ -1,3 +1,10 @@
|
|
||||||
+2007-06-12 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * openfs.c (ext2fs_open2): We now set EXT2_FLAG_MASTER_SB_ONLY
|
|
||||||
+ when we open a filesystem. Applications that want to
|
|
||||||
+ write changes to the backup superblocks need to explicitly
|
|
||||||
+ clear this flag.
|
|
||||||
+
|
|
||||||
2007-03-21 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* imager.c (ext2fs_image_inode_write), inode.c
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/openfs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/openfs.c
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/openfs.c
|
|
||||||
@@ -100,6 +100,8 @@ errcode_t ext2fs_open2(const char *name,
|
|
||||||
memset(fs, 0, sizeof(struct struct_ext2_filsys));
|
|
||||||
fs->magic = EXT2_ET_MAGIC_EXT2FS_FILSYS;
|
|
||||||
fs->flags = flags;
|
|
||||||
+ /* don't overwrite sb backups unless flag is explicitly cleared */
|
|
||||||
+ fs->flags |= EXT2_FLAG_MASTER_SB_ONLY;
|
|
||||||
fs->umask = 022;
|
|
||||||
retval = ext2fs_get_mem(strlen(name)+1, &fs->device_name);
|
|
||||||
if (retval)
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/misc/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/misc/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/misc/ChangeLog
|
|
||||||
@@ -1,3 +1,9 @@
|
|
||||||
+2007-06-12 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * tune2fs.c (main): Clear the EXT2_FLAG_MASTER_SB_ONLY flag
|
|
||||||
+ because we want tune2fs changes to get written to the
|
|
||||||
+ backup blocks.
|
|
||||||
+
|
|
||||||
2007-05-31 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* mke2fs.c (parse_extended_opts): Free allocated buf on return
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/misc/tune2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/misc/tune2fs.c
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/misc/tune2fs.c
|
|
||||||
@@ -781,6 +781,7 @@ int main (int argc, char ** argv)
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
sb = fs->super;
|
|
||||||
+ fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
|
|
||||||
if (print_label) {
|
|
||||||
/* For e2label emulation */
|
|
||||||
printf("%.*s\n", (int) sizeof(sb->s_volume_name),
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/resize/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/resize/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/resize/ChangeLog
|
|
||||||
@@ -1,3 +1,9 @@
|
|
||||||
+2007-06-12 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * resize2fs.c (resize_fs): Clear the EXT2_FLAG_MASTER_SB_ONLY flag
|
|
||||||
+ to make sure the superblock changes are written out to the
|
|
||||||
+ backup superblocks.
|
|
||||||
+
|
|
||||||
2007-03-18 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* resize2fs.c (check_and_change_inodes): Check to make sure the
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/resize/resize2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/resize/resize2fs.c
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/resize/resize2fs.c
|
|
||||||
@@ -138,6 +138,7 @@ errcode_t resize_fs(ext2_filsys fs, blk_
|
|
||||||
if (retval)
|
|
||||||
goto errout;
|
|
||||||
|
|
||||||
+ rfs->new_fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
|
|
||||||
retval = ext2fs_close(rfs->new_fs);
|
|
||||||
if (retval)
|
|
||||||
goto errout;
|
|
@ -1,111 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date 1176573631 14400
|
|
||||||
# Node ID aa8d65921c8922dfed73dd05027a097cc5946653
|
|
||||||
# Parent 4b2e34b5f7506f9f74b3fadf79280316d57e47d5
|
|
||||||
Correct byteswapping for fast symlinks with xattrs
|
|
||||||
|
|
||||||
Fix a problem byte-swapping fast symlinks inodes that contain extended
|
|
||||||
attributes.
|
|
||||||
|
|
||||||
Addresses Red Hat Bugzilla: #232663
|
|
||||||
Addresses LTC Bugzilla: #27634
|
|
||||||
|
|
||||||
Signed-off-by: "Bryn M. Reeves" <breeves@redhat.com>
|
|
||||||
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog
|
|
||||||
@@ -5,6 +5,14 @@
|
|
||||||
won't write out the backup superblocks until we're sure
|
|
||||||
that we want write them out.
|
|
||||||
|
|
||||||
+2007-04-14 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * pass2.c (e2fsck_process_bad_inode): Remove special kludge that
|
|
||||||
+ dealt with long symlinks on big endian systems. It turns
|
|
||||||
+ out this was a workaround to a bug described in Red Hat
|
|
||||||
+ Bugzilla #232663, with an odd twist. See comment #12 for
|
|
||||||
+ more details.
|
|
||||||
+
|
|
||||||
2007-03-28 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* pass1.c (e2fsck_pass1, check_ext_attr),
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/e2fsck/pass2.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/e2fsck/pass2.c
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/e2fsck/pass2.c
|
|
||||||
@@ -1187,22 +1187,6 @@ extern int e2fsck_process_bad_inode(e2fs
|
|
||||||
!(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
|
|
||||||
if (fix_problem(ctx, PR_2_FILE_ACL_ZERO, &pctx)) {
|
|
||||||
inode.i_file_acl = 0;
|
|
||||||
-#ifdef EXT2FS_ENABLE_SWAPFS
|
|
||||||
- /*
|
|
||||||
- * This is a special kludge to deal with long
|
|
||||||
- * symlinks on big endian systems. i_blocks
|
|
||||||
- * had already been decremented earlier in
|
|
||||||
- * pass 1, but since i_file_acl hadn't yet
|
|
||||||
- * been cleared, ext2fs_read_inode() assumed
|
|
||||||
- * that the file was short symlink and would
|
|
||||||
- * not have byte swapped i_block[0]. Hence,
|
|
||||||
- * we have to byte-swap it here.
|
|
||||||
- */
|
|
||||||
- if (LINUX_S_ISLNK(inode.i_mode) &&
|
|
||||||
- (fs->flags & EXT2_FLAG_SWAP_BYTES) &&
|
|
||||||
- (inode.i_blocks == fs->blocksize >> 9))
|
|
||||||
- inode.i_block[0] = ext2fs_swab32(inode.i_block[0]);
|
|
||||||
-#endif
|
|
||||||
inode_modified++;
|
|
||||||
} else
|
|
||||||
not_fixed++;
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/swapfs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/swapfs.c
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/swapfs.c
|
|
||||||
@@ -124,7 +124,7 @@ void ext2fs_swap_inode_full(ext2_filsys
|
|
||||||
struct ext2_inode_large *f, int hostorder,
|
|
||||||
int bufsize)
|
|
||||||
{
|
|
||||||
- unsigned i;
|
|
||||||
+ unsigned i, has_data_blocks;
|
|
||||||
int islnk = 0;
|
|
||||||
__u32 *eaf, *eat;
|
|
||||||
|
|
||||||
@@ -141,11 +141,17 @@ void ext2fs_swap_inode_full(ext2_filsys
|
|
||||||
t->i_dtime = ext2fs_swab32(f->i_dtime);
|
|
||||||
t->i_gid = ext2fs_swab16(f->i_gid);
|
|
||||||
t->i_links_count = ext2fs_swab16(f->i_links_count);
|
|
||||||
+ if (hostorder)
|
|
||||||
+ has_data_blocks = ext2fs_inode_data_blocks(fs,
|
|
||||||
+ (struct ext2_inode *) f);
|
|
||||||
t->i_blocks = ext2fs_swab32(f->i_blocks);
|
|
||||||
+ if (!hostorder)
|
|
||||||
+ has_data_blocks = ext2fs_inode_data_blocks(fs,
|
|
||||||
+ (struct ext2_inode *) t);
|
|
||||||
t->i_flags = ext2fs_swab32(f->i_flags);
|
|
||||||
t->i_file_acl = ext2fs_swab32(f->i_file_acl);
|
|
||||||
t->i_dir_acl = ext2fs_swab32(f->i_dir_acl);
|
|
||||||
- if (!islnk || ext2fs_inode_data_blocks(fs, (struct ext2_inode *)t)) {
|
|
||||||
+ if (!islnk || has_data_blocks ) {
|
|
||||||
for (i = 0; i < EXT2_N_BLOCKS; i++)
|
|
||||||
t->i_block[i] = ext2fs_swab32(f->i_block[i]);
|
|
||||||
} else if (t != f) {
|
|
||||||
Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog
|
|
||||||
@@ -5,6 +5,12 @@
|
|
||||||
write changes to the backup superblocks need to explicitly
|
|
||||||
clear this flag.
|
|
||||||
|
|
||||||
+2007-04-14 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * swapfs.c (ext2fs_swap_inode_full): Fix a problem byte-swapping
|
|
||||||
+ fast symlinks inodes that contain extended attributes.
|
|
||||||
+ (Addresses Red Hat Bugzilla #232663, LTC bugzilla #27634)
|
|
||||||
+
|
|
||||||
2007-03-21 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* imager.c (ext2fs_image_inode_write), inode.c
|
|
@ -1,182 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date Tue Sep 12 14:56:12 2006 -0400
|
|
||||||
# Node ID 59bf36fb8344bb7a3971af7df22d41f8d8b14610
|
|
||||||
# parent: 90cd01f7fcd6293846f0b3ca6ce2b007e3dd7d51
|
|
||||||
Remove unused variables
|
|
||||||
|
|
||||||
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/ChangeLog
|
|
||||||
@@ -1,5 +1,9 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * pass1.c (handle_fs_bad_blocks): Remove unused variables.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* pass1b.c (check_if_fs_block): Change block group loop to use
|
|
||||||
a common pattern of first_block/last_block, etc.
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/e2fsck/pass1.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/e2fsck/pass1.c
|
|
||||||
@@ -1981,14 +1981,13 @@ static void handle_fs_bad_blocks(e2fsck_
|
|
||||||
static void mark_table_blocks(e2fsck_t ctx)
|
|
||||||
{
|
|
||||||
ext2_filsys fs = ctx->fs;
|
|
||||||
- blk_t block, b;
|
|
||||||
+ blk_t b;
|
|
||||||
dgrp_t i;
|
|
||||||
int j;
|
|
||||||
struct problem_context pctx;
|
|
||||||
|
|
||||||
clear_problem_context(&pctx);
|
|
||||||
|
|
||||||
- block = fs->super->s_first_data_block;
|
|
||||||
for (i = 0; i < fs->group_desc_count; i++) {
|
|
||||||
pctx.group = i;
|
|
||||||
|
|
||||||
@@ -2049,7 +2048,6 @@ static void mark_table_blocks(e2fsck_t c
|
|
||||||
fs->group_desc[i].bg_inode_bitmap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
- block += fs->super->s_blocks_per_group;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/ChangeLog
|
|
||||||
@@ -1,5 +1,10 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * closefs.c (write_backup_super):
|
|
||||||
+ * initialize.c (ext2fs_initialize): Remove unused variables.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* check_desc.c (ext2fs_check_desc): avoid overflows when iterating
|
|
||||||
over group descriptors on very large filesystems.
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/closefs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/closefs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/closefs.c
|
|
||||||
@@ -206,7 +206,6 @@ static errcode_t write_backup_super(ext2
|
|
||||||
errcode_t ext2fs_flush(ext2_filsys fs)
|
|
||||||
{
|
|
||||||
dgrp_t i,j;
|
|
||||||
- blk_t group_block;
|
|
||||||
errcode_t retval;
|
|
||||||
unsigned long fs_state;
|
|
||||||
struct ext2_super_block *super_shadow = 0;
|
|
||||||
@@ -275,7 +274,6 @@ errcode_t ext2fs_flush(ext2_filsys fs)
|
|
||||||
* Write out the master group descriptors, and the backup
|
|
||||||
* superblocks and group descriptors.
|
|
||||||
*/
|
|
||||||
- group_block = fs->super->s_first_data_block;
|
|
||||||
group_ptr = (char *) group_shadow;
|
|
||||||
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
|
|
||||||
old_desc_blocks = fs->super->s_first_meta_bg;
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/initialize.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/lib/ext2fs/initialize.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/lib/ext2fs/initialize.c
|
|
||||||
@@ -99,7 +99,6 @@ errcode_t ext2fs_initialize(const char *
|
|
||||||
int frags_per_block;
|
|
||||||
unsigned int rem;
|
|
||||||
unsigned int overhead = 0;
|
|
||||||
- blk_t group_block;
|
|
||||||
unsigned int ipg;
|
|
||||||
dgrp_t i;
|
|
||||||
blk_t numblocks;
|
|
||||||
@@ -360,7 +359,6 @@ retry:
|
|
||||||
* inode table have not been allocated (and in fact won't be
|
|
||||||
* by this routine), they are accounted for nevertheless.
|
|
||||||
*/
|
|
||||||
- group_block = super->s_first_data_block;
|
|
||||||
super->s_free_blocks_count = 0;
|
|
||||||
for (i = 0; i < fs->group_desc_count; i++) {
|
|
||||||
numblocks = ext2fs_reserve_super_and_bgd(fs, i, fs->block_map);
|
|
||||||
@@ -370,8 +368,6 @@ retry:
|
|
||||||
fs->group_desc[i].bg_free_inodes_count =
|
|
||||||
fs->super->s_inodes_per_group;
|
|
||||||
fs->group_desc[i].bg_used_dirs_count = 0;
|
|
||||||
-
|
|
||||||
- group_block += super->s_blocks_per_group;
|
|
||||||
}
|
|
||||||
|
|
||||||
ext2fs_mark_super_dirty(fs);
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/ChangeLog
|
|
||||||
@@ -1,5 +1,10 @@
|
|
||||||
2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
|
|
||||||
+ * e2image.c (mark_table_blocks): Remove unused first_block
|
|
||||||
+ incrementing from loop.
|
|
||||||
+
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
* dumpe2fs.c (list_desc, mark_table_blocks): Avoid overflows when
|
|
||||||
iterating over group descriptors on very large
|
|
||||||
filesystems.
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/misc/e2image.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/misc/e2image.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/misc/e2image.c
|
|
||||||
@@ -287,7 +287,6 @@ static void mark_table_blocks(ext2_filsy
|
|
||||||
ext2fs_mark_block_bitmap(meta_block_map,
|
|
||||||
fs->group_desc[i].bg_inode_bitmap);
|
|
||||||
}
|
|
||||||
- first_block += fs->super->s_blocks_per_group;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/ChangeLog
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/ChangeLog
|
|
||||||
@@ -1,3 +1,7 @@
|
|
||||||
+2006-08-30 Eric Sandeen <esandeen@redhat.com>
|
|
||||||
+
|
|
||||||
+ * resize2fs.c (mark_table_blocks): Remove unused variable.
|
|
||||||
+
|
|
||||||
2006-08-30 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* resize2fs.c (adjust_fs_info), online.c (online_resize_fs): Use
|
|
||||||
Index: e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c
|
|
||||||
===================================================================
|
|
||||||
--- e2fsprogs-1.39-my-patches-from-ted.orig/resize/resize2fs.c
|
|
||||||
+++ e2fsprogs-1.39-my-patches-from-ted/resize/resize2fs.c
|
|
||||||
@@ -536,14 +536,13 @@ errout:
|
|
||||||
static errcode_t mark_table_blocks(ext2_filsys fs,
|
|
||||||
ext2fs_block_bitmap bmap)
|
|
||||||
{
|
|
||||||
- blk_t block, b;
|
|
||||||
+ blk_t b;
|
|
||||||
unsigned int j;
|
|
||||||
dgrp_t i;
|
|
||||||
unsigned long meta_bg_size;
|
|
||||||
unsigned int old_desc_blocks;
|
|
||||||
|
|
||||||
meta_bg_size = (fs->blocksize / sizeof (struct ext2_group_desc));
|
|
||||||
- block = fs->super->s_first_data_block;
|
|
||||||
if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
|
|
||||||
old_desc_blocks = fs->super->s_first_meta_bg;
|
|
||||||
else
|
|
||||||
@@ -571,7 +570,6 @@ static errcode_t mark_table_blocks(ext2_
|
|
||||||
*/
|
|
||||||
ext2fs_mark_block_bitmap(bmap,
|
|
||||||
fs->group_desc[i].bg_inode_bitmap);
|
|
||||||
- block += fs->super->s_blocks_per_group;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,121 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date Sun Oct 22 00:18:49 2006 -0400
|
|
||||||
# Node ID 91cc4c459889b6013c832477742dc80274cca2e3
|
|
||||||
# parent: fa7a505b350d10ab97de18f5caeef0a8493dba94
|
|
||||||
Add failsafe against duplicate UUID's generated by threaded programs
|
|
||||||
|
|
||||||
Add in randomness based on Linux's thread id (gettid) to avoid race
|
|
||||||
conditions when two threads try to generate uuid's at the same time.
|
|
||||||
This shouldn't be an issue if /dev/urandom has proper locking and is
|
|
||||||
present, so this is just a failsafe.
|
|
||||||
|
|
||||||
Addresses SourceForge Bug: #1529672
|
|
||||||
|
|
||||||
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
|
|
||||||
|
|
||||||
--- a/ChangeLog Sun Oct 22 00:14:26 2006 -0400
|
|
||||||
+++ b/ChangeLog Sun Oct 22 00:18:49 2006 -0400
|
|
||||||
@@ -0,0 +1,4 @@
|
|
||||||
+2006-10-22 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * configure, configure.in: Add test for jrand48()
|
|
||||||
+
|
|
||||||
--- a/configure Sun Oct 22 00:14:26 2006 -0400
|
|
||||||
+++ b/configure Sun Oct 22 00:18:49 2006 -0400
|
|
||||||
@@ -16306,7 +16306,8 @@
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-for ac_func in chflags getrusage llseek lseek64 open64 fstat64 getmntinfo strtoull strcasecmp srandom fchown mallinfo fdatasync strnlen strptime sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl
|
|
||||||
+
|
|
||||||
+for ac_func in chflags getrusage llseek lseek64 open64 fstat64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync strnlen strptime sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl
|
|
||||||
do
|
|
||||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
|
||||||
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
|
|
||||||
--- a/configure.in Sun Oct 22 00:14:26 2006 -0400
|
|
||||||
+++ b/configure.in Sun Oct 22 00:18:49 2006 -0400
|
|
||||||
@@ -659,7 +659,7 @@
|
|
||||||
[#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>])
|
|
||||||
dnl
|
|
||||||
-AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 fstat64 getmntinfo strtoull strcasecmp srandom fchown mallinfo fdatasync strnlen strptime sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl)
|
|
||||||
+AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 fstat64 getmntinfo strtoull strcasecmp srandom jrand48 fchown mallinfo fdatasync strnlen strptime sysconf pathconf posix_memalign memalign valloc __secure_getenv prctl)
|
|
||||||
dnl
|
|
||||||
dnl Check to see if -lsocket is required (solaris) to make something
|
|
||||||
dnl that uses socket() to compile; this is needed for the UUID library
|
|
||||||
--- a/lib/uuid/ChangeLog Sun Oct 22 00:14:26 2006 -0400
|
|
||||||
+++ b/lib/uuid/ChangeLog Sun Oct 22 00:18:49 2006 -0400
|
|
||||||
@@ -1,3 +1,12 @@
|
|
||||||
+2006-10-22 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * gen_uuid.c (get_random_bytes): Add in randomness based on
|
|
||||||
+ Linux's thread id (gettid) to avoid race conditions when
|
|
||||||
+ two threads try to generate uuid's at the same time. This
|
|
||||||
+ shouldn't be an issue if /dev/urandom has proper locking
|
|
||||||
+ and is present, so this is just a failsafe. (Addresses
|
|
||||||
+ SourceForge Bug: #1529672)
|
|
||||||
+
|
|
||||||
2006-01-06 Theodore Ts'o <tytso@mit.edu>
|
|
||||||
|
|
||||||
* gen_uuid.c (get_random_fd): Set the FD_CLOEXEC flag on the file
|
|
||||||
--- a/lib/uuid/gen_uuid.c Sun Oct 22 00:14:26 2006 -0400
|
|
||||||
+++ b/lib/uuid/gen_uuid.c Sun Oct 22 00:18:49 2006 -0400
|
|
||||||
@@ -69,12 +69,20 @@
|
|
||||||
#ifdef HAVE_NET_IF_DL_H
|
|
||||||
#include <net/if_dl.h>
|
|
||||||
#endif
|
|
||||||
+#ifdef __linux__
|
|
||||||
+#include <sys/syscall.h>
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
#include "uuidP.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_SRANDOM
|
|
||||||
#define srand(x) srandom(x)
|
|
||||||
#define rand() random()
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+#if defined(__linux__) && defined(__NR_gettid) && defined(HAVE_JRAND48)
|
|
||||||
+#define DO_JRAND_MIX
|
|
||||||
+static unsigned short jrand_seed[3];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int get_random_fd(void)
|
|
||||||
@@ -94,6 +102,11 @@
|
|
||||||
fcntl(fd, F_SETFD, i | FD_CLOEXEC);
|
|
||||||
}
|
|
||||||
srand((getpid() << 16) ^ getuid() ^ tv.tv_sec ^ tv.tv_usec);
|
|
||||||
+#ifdef DO_JRAND_MIX
|
|
||||||
+ jrand_seed[0] = getpid() ^ (tv.tv_sec & 0xFFFF);
|
|
||||||
+ jrand_seed[1] = getppid() ^ (tv.tv_usec & 0xFFFF);
|
|
||||||
+ jrand_seed[2] = (tv.tv_sec ^ tv.tv_usec) >> 16;
|
|
||||||
+#endif
|
|
||||||
}
|
|
||||||
/* Crank the random number generator a few times */
|
|
||||||
gettimeofday(&tv, 0);
|
|
||||||
@@ -112,6 +125,7 @@
|
|
||||||
int i, n = nbytes, fd = get_random_fd();
|
|
||||||
int lose_counter = 0;
|
|
||||||
unsigned char *cp = (unsigned char *) buf;
|
|
||||||
+ unsigned short tmp_seed[3];
|
|
||||||
|
|
||||||
if (fd >= 0) {
|
|
||||||
while (n > 0) {
|
|
||||||
@@ -133,6 +147,15 @@
|
|
||||||
*/
|
|
||||||
for (cp = buf, i = 0; i < nbytes; i++)
|
|
||||||
*cp++ ^= (rand() >> 7) & 0xFF;
|
|
||||||
+#ifdef DO_JRAND_MIX
|
|
||||||
+ memcpy(tmp_seed, jrand_seed, sizeof(tmp_seed));
|
|
||||||
+ jrand_seed[2] = jrand_seed[2] ^ syscall(__NR_gettid);
|
|
||||||
+ for (cp = buf, i = 0; i < nbytes; i++)
|
|
||||||
+ *cp++ ^= (jrand48(tmp_seed) >> 7) & 0xFF;
|
|
||||||
+ memcpy(jrand_seed, tmp_seed,
|
|
||||||
+ sizeof(jrand_seed)-sizeof(unsigned short));
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
# HG changeset patch
|
|
||||||
# User tytso@mit.edu
|
|
||||||
# Date 1182493358 14400
|
|
||||||
# Node ID 702632e66380e459f60b238570edd1e911dd46bc
|
|
||||||
# Parent 17c2ad1542e716779e127b5db35879c391ac6282
|
|
||||||
e2fsck: added sanity check for xattr validation
|
|
||||||
|
|
||||||
Add an extra validity test in check_ext_attr(). If an attribute's
|
|
||||||
e_value_size is zero the current code does not allocate a region for it
|
|
||||||
and as a result the e_value_offs value is not verified. However, if
|
|
||||||
e_value_offs is very large then the later call to
|
|
||||||
ext2fs_ext_attr_hash_entry() can dereference bad memory and crash
|
|
||||||
e2fsck.
|
|
||||||
|
|
||||||
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
|
|
||||||
Signed-off-by: Jim Garlick <garlick@llnl.gov>
|
|
||||||
|
|
||||||
--- a/e2fsck/ChangeLog Thu Jun 21 13:43:33 2007 -0400
|
|
||||||
+++ b/e2fsck/ChangeLog Fri Jun 22 02:22:38 2007 -0400
|
|
||||||
@@ -1,3 +1,13 @@ 2007-06-18 Theodore Tso <tytso@mit.edu
|
|
||||||
+2007-06-22 Theodore Tso <tytso@mit.edu>
|
|
||||||
+
|
|
||||||
+ * pass1.c (check_ext_attr): Adds an extra validity test in
|
|
||||||
+ check_ext_attr(). If an attribute's e_value_size is zero
|
|
||||||
+ the current code does not allocate a region for it and as
|
|
||||||
+ a result the e_value_offs value is not verified. However,
|
|
||||||
+ if e_value_offs is very large then the later call to
|
|
||||||
+ ext2fs_ext_attr_hash_entry() can dereference bad memory
|
|
||||||
+ and crash e2fsck.
|
|
||||||
+
|
|
||||||
2007-06-18 Theodore Tso <tytso@mit.edu>
|
|
||||||
|
|
||||||
* journal.c (e2fsck_run_ext3_journal), unix.c (main): Explicitly
|
|
||||||
--- a/e2fsck/pass1.c Thu Jun 21 13:43:33 2007 -0400
|
|
||||||
+++ b/e2fsck/pass1.c Fri Jun 22 02:22:38 2007 -0400
|
|
||||||
@@ -1380,6 +1380,11 @@ static int check_ext_attr(e2fsck_t ctx,
|
|
||||||
if (fix_problem(ctx, PR_1_EA_BAD_VALUE, pctx))
|
|
||||||
goto clear_extattr;
|
|
||||||
}
|
|
||||||
+ if (entry->e_value_offs + entry->e_value_size > fs->blocksize) {
|
|
||||||
+ if (fix_problem(ctx, PR_1_EA_BAD_VALUE, pctx))
|
|
||||||
+ goto clear_extattr;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
if (entry->e_value_size &&
|
|
||||||
region_allocate(region, entry->e_value_offs,
|
|
||||||
EXT2_EXT_ATTR_SIZE(entry->e_value_size))) {
|
|
||||||
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
Summary: Utilities for managing the second and third extended (ext2/ext3) filesystems
|
Summary: Utilities for managing the second and third extended (ext2/ext3) filesystems
|
||||||
Name: e2fsprogs
|
Name: e2fsprogs
|
||||||
Version: 1.40.2
|
Version: 1.40.2
|
||||||
Release: 10%{?dist}
|
Release: 11%{?dist}
|
||||||
# License based on upstream-modified COPYING file,
|
# License based on upstream-modified COPYING file,
|
||||||
# which clearly states "V2" intent.
|
# which clearly states "V2" intent.
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
@ -267,6 +267,9 @@ exit 0
|
|||||||
%{_mandir}/man3/uuid_unparse.3*
|
%{_mandir}/man3/uuid_unparse.3*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Oct 23 2007 Eric Sandeen <esandeen@redhat.com> 1.40.2-11
|
||||||
|
- Add arm to multilib header wrapper
|
||||||
|
|
||||||
* Sat Oct 20 2007 Eric Sandeen <esandeen@redhat.com> 1.40.2-10
|
* Sat Oct 20 2007 Eric Sandeen <esandeen@redhat.com> 1.40.2-10
|
||||||
- Make (more) file timestamps match those in tarball for multilib tidiness
|
- Make (more) file timestamps match those in tarball for multilib tidiness
|
||||||
- Fix e2fsprogs-libs summary (shared libs not static)
|
- Fix e2fsprogs-libs summary (shared libs not static)
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#include "ext2_types-x86_64.h"
|
#include "ext2_types-x86_64.h"
|
||||||
#elif defined(__alpha__)
|
#elif defined(__alpha__)
|
||||||
#include "ext2_types-alpha.h"
|
#include "ext2_types-alpha.h"
|
||||||
|
#elif defined(__arm__)
|
||||||
|
#include "ext2_types-arm.h"
|
||||||
#else
|
#else
|
||||||
#error "This e2fsprogs-devel package does not work your architecture?"
|
#error "This e2fsprogs-devel package does not work your architecture?"
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user