summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure6
-rw-r--r--configure.ac12
-rw-r--r--debugfs/ls.c2
-rw-r--r--debugfs/util.c7
-rw-r--r--e2fsck/e2fsck.h1
-rw-r--r--e2fsck/message.c26
-rw-r--r--e2fsck/pass1.c8
-rw-r--r--e2fsck/problem.c7
-rw-r--r--e2fsck/problem.h3
-rw-r--r--e2fsck/quota.c33
-rw-r--r--e2fsck/super.c2
-rw-r--r--lib/blkid/read.c2
-rw-r--r--lib/e2p/ostype.c2
-rw-r--r--lib/ext2fs/flushb.c9
-rw-r--r--lib/ext2fs/namei.c2
-rw-r--r--lib/ext2fs/openfs.c10
-rw-r--r--lib/support/mkquota.c15
-rw-r--r--lib/support/quotaio.c8
-rw-r--r--misc/Makefile.in26
-rw-r--r--misc/ext4.5.in9
-rw-r--r--misc/tune2fs.8.in15
-rw-r--r--resize/main.c4
-rw-r--r--tests/d_bad_ostype/expect1
-rw-r--r--tests/d_bad_ostype/name1
-rw-r--r--tests/d_bad_ostype/script21
-rw-r--r--tests/f_ind_inode_collision/expect.11
-rw-r--r--tests/f_itable_collision/expect.18
-rw-r--r--tests/f_quota_invalid_inum/expect.115
-rw-r--r--tests/f_quota_invalid_inum/expect.27
-rw-r--r--tests/f_quota_invalid_inum/image.gzbin0 -> 583 bytes
-rw-r--r--tests/f_quota_invalid_inum/name1
31 files changed, 206 insertions, 58 deletions
diff --git a/configure b/configure
index f8e0ce46..fc38dbed 100755
--- a/configure
+++ b/configure
@@ -13519,7 +13519,10 @@ $as_echo "#define HAVE_OPTRESET 1" >>confdefs.h
fi
SEM_INIT_LIB=''
-ac_fn_c_check_func "$LINENO" "sem_init" "ac_cv_func_sem_init"
+echo GL_THREADS_API: ${gl_threads_api}
+if test "${gl_threads_api}" != none
+then
+ ac_fn_c_check_func "$LINENO" "sem_init" "ac_cv_func_sem_init"
if test "x$ac_cv_func_sem_init" = xyes; then :
else
@@ -13652,6 +13655,7 @@ fi
fi
fi
+fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for unified diff option" >&5
$as_echo_n "checking for unified diff option... " >&6; }
diff --git a/configure.ac b/configure.ac
index 0c0c1d6f..ee05c670 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1239,16 +1239,20 @@ dnl Test for sem_init, and which library it might require:
dnl
AH_TEMPLATE([HAVE_SEM_INIT], [Define to 1 if sem_init() exists])
SEM_INIT_LIB=''
-AC_CHECK_FUNC(sem_init, ,
- AC_CHECK_LIB(pthread, sem_init,
+echo GL_THREADS_API: ${gl_threads_api}
+if test "${gl_threads_api}" != none
+then
+ AC_CHECK_FUNC(sem_init, ,
+ AC_CHECK_LIB(pthread, sem_init,
AC_DEFINE(HAVE_SEM_INIT, 1)
SEM_INIT_LIB=-lpthread,
- AC_CHECK_LIB(rt, sem_init,
+ AC_CHECK_LIB(rt, sem_init,
AC_DEFINE(HAVE_SEM_INIT, 1)
SEM_INIT_LIB=-lrt,
- AC_CHECK_LIB(posix4, sem_init,
+ AC_CHECK_LIB(posix4, sem_init,
AC_DEFINE(HAVE_SEM_INIT, 1)
SEM_INIT_LIB=-lposix4))))dnl
+fi
AC_SUBST(SEM_INIT_LIB)
dnl
dnl Check for unified diff
diff --git a/debugfs/ls.c b/debugfs/ls.c
index c990a93d..61b63196 100644
--- a/debugfs/ls.c
+++ b/debugfs/ls.c
@@ -122,7 +122,7 @@ static int list_dir_proc(ext2_ino_t dir EXT2FS_ATTR((unused)),
return 0;
} else
memset(&inode, 0, sizeof(struct ext2_inode));
- fprintf(ls->f,"/%u/%06o/%d/%d/%*s/", ino, inode.i_mode,
+ fprintf(ls->f,"/%u/%06o/%d/%d/%.*s/", ino, inode.i_mode,
inode.i_uid, inode.i_gid, thislen, dirent->name);
if (LINUX_S_ISDIR(inode.i_mode))
fprintf(ls->f, "/");
diff --git a/debugfs/util.c b/debugfs/util.c
index bd5de79e..5f101f48 100644
--- a/debugfs/util.c
+++ b/debugfs/util.c
@@ -119,7 +119,7 @@ ext2_ino_t string_to_inode(char *str)
*/
if ((len > 2) && (str[0] == '<') && (str[len-1] == '>')) {
ino = strtoul(str+1, &end, 0);
- if (*end=='>')
+ if (*end=='>' && (ino <= current_fs->super->s_inodes_count))
return ino;
}
@@ -128,6 +128,11 @@ ext2_ino_t string_to_inode(char *str)
com_err(str, retval, 0);
return 0;
}
+ if (ino > current_fs->super->s_inodes_count) {
+ com_err(str, 0, "resolves to an illegal inode number: %u\n",
+ ino);
+ return 0;
+ }
return ino;
}
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index ca414ccb..222f47c6 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -522,6 +522,7 @@ extern void set_up_logging(e2fsck_t ctx);
/* quota.c */
extern void e2fsck_hide_quota(e2fsck_t ctx);
+extern void e2fsck_validate_quota_inodes(e2fsck_t ctx);
/* pass1.c */
extern errcode_t e2fsck_setup_icount(e2fsck_t ctx, const char *icount_name,
diff --git a/e2fsck/message.c b/e2fsck/message.c
index 46522d10..7fc65692 100644
--- a/e2fsck/message.c
+++ b/e2fsck/message.c
@@ -48,6 +48,9 @@
* the containing directory.
* %r <blkcount> interpret blkcount as refcount
* %s <str> miscellaneous string
+ * %t time (in <num>)
+ * %T current time
+ * %U quota type (in <num>)
* %S backup superblock
* %X <num> hexadecimal format
*
@@ -92,9 +95,9 @@
#include <string.h>
#include <ctype.h>
#include <termios.h>
+#include "support/quotaio.h"
#include "e2fsck.h"
-
#include "problem.h"
#ifdef __GNUC__
@@ -473,6 +476,27 @@ static _INLINE_ void expand_percent_expression(FILE *f, ext2_filsys fs,
case 'T':
print_time(f, e2fsck_ctx ? e2fsck_ctx->now : time(0));
break;
+ case 'U':
+ switch (ctx->num) {
+ case USRQUOTA:
+ m = _("user");
+ break;
+ case GRPQUOTA:
+ m = _("group");
+ break;
+ case PRJQUOTA:
+ m = _("group");
+ break;
+ default:
+ m = _("unknown quota type");
+ break;
+ }
+ if (*first && islower(m[0]))
+ fputc(toupper(*m++), f);
+ fputs(m, f);
+ if (ctx->num > PRJQUOTA)
+ fprintf(f, " %d", (int) ctx->num);
+ break;
case 'x':
fprintf(f, "0x%0*x", width, ctx->csum1);
break;
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 690d1dc7..47a8b27c 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -2897,6 +2897,7 @@ report_problem:
* will reallocate the block; then we can try again.
*/
if (pb->ino != EXT2_RESIZE_INO &&
+ extent.e_pblk < ctx->fs->super->s_blocks_count &&
ext2fs_test_block_bitmap2(ctx->block_metadata_map,
extent.e_pblk)) {
next_try_repairs = 0;
@@ -2904,7 +2905,8 @@ report_problem:
fix_problem(ctx,
PR_1_CRITICAL_METADATA_COLLISION,
pctx);
- ctx->flags |= E2F_FLAG_RESTART_LATER;
+ if ((ctx->options & E2F_OPT_NO) == 0)
+ ctx->flags |= E2F_FLAG_RESTART_LATER;
}
pctx->errcode = ext2fs_extent_get(ehandle,
EXT2_EXTENT_DOWN, &extent);
@@ -3656,10 +3658,12 @@ static int process_block(ext2_filsys fs,
*/
if (blockcnt < 0 &&
p->ino != EXT2_RESIZE_INO &&
+ blk < ctx->fs->super->s_blocks_count &&
ext2fs_test_block_bitmap2(ctx->block_metadata_map, blk)) {
pctx->blk = blk;
fix_problem(ctx, PR_1_CRITICAL_METADATA_COLLISION, pctx);
- ctx->flags |= E2F_FLAG_RESTART_LATER;
+ if ((ctx->options & E2F_OPT_NO) == 0)
+ ctx->flags |= E2F_FLAG_RESTART_LATER;
}
if (problem) {
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 97069335..2bb8d4e2 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -418,7 +418,7 @@ static struct e2fsck_problem problem_table[] = {
/* Making quota inode hidden */
{ PR_0_HIDE_QUOTA,
- N_("Making @q @i %i (%Q) hidden.\n"),
+ N_("Hiding %U @q @i %i (%Q).\n"),
PROMPT_NONE, PR_PREEN_OK },
/* Superblock has invalid MMP block. */
@@ -488,6 +488,11 @@ static struct e2fsck_problem problem_table[] = {
N_("Bad desired extra isize in @S (%N). "),
PROMPT_FIX, 0 },
+ /* Invalid quota inode number */
+ { PR_0_INVALID_QUOTA_INO,
+ N_("Invalid %U @q @i %i. "),
+ PROMPT_FIX, 0 },
+
/* Pass 1 errors */
/* Pass 1: Checking inodes, blocks, and sizes */
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
index f30f8f08..49a8c3ad 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -279,6 +279,9 @@ struct problem_context {
/* Bad desired extra isize in superblock */
#define PR_0_BAD_WANT_EXTRA_ISIZE 0x00004E
+/* Invalid quota inode number */
+#define PR_0_INVALID_QUOTA_INO 0x00004F
+
/*
* Pass 1 errors
diff --git a/e2fsck/quota.c b/e2fsck/quota.c
index f98053b6..b0f9af63 100644
--- a/e2fsck/quota.c
+++ b/e2fsck/quota.c
@@ -71,14 +71,47 @@ void e2fsck_hide_quota(e2fsck_t ctx)
return;
for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
+ pctx.dir = 2; /* This is a guess, but it's a good one */
pctx.ino = *quota_sb_inump(sb, qtype);
+ pctx.num = qtype;
quota_ino = quota_type2inum(qtype, fs->super);
if (pctx.ino && (pctx.ino != quota_ino) &&
fix_problem(ctx, PR_0_HIDE_QUOTA, &pctx)) {
move_quota_inode(fs, pctx.ino, quota_ino, qtype);
*quota_sb_inump(sb, qtype) = quota_ino;
+ ext2fs_mark_super_dirty(fs);
}
}
return;
}
+
+void e2fsck_validate_quota_inodes(e2fsck_t ctx)
+{
+ struct ext2_super_block *sb = ctx->fs->super;
+ struct problem_context pctx;
+ ext2_filsys fs = ctx->fs;
+ enum quota_type qtype;
+ ext2_ino_t quota_ino;
+
+ clear_problem_context(&pctx);
+
+ for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
+ pctx.ino = *quota_sb_inump(sb, qtype);
+ pctx.num = qtype;
+ if (pctx.ino &&
+ ((pctx.ino == EXT2_BAD_INO) ||
+ (pctx.ino == EXT2_ROOT_INO) ||
+ (pctx.ino == EXT2_BOOT_LOADER_INO) ||
+ (pctx.ino == EXT2_UNDEL_DIR_INO) ||
+ (pctx.ino == EXT2_RESIZE_INO) ||
+ (pctx.ino == EXT2_JOURNAL_INO) ||
+ (pctx.ino == EXT2_EXCLUDE_INO) ||
+ (pctx.ino == EXT4_REPLICA_INO) ||
+ (pctx.ino > fs->super->s_inodes_count)) &&
+ fix_problem(ctx, PR_0_INVALID_QUOTA_INO, &pctx)) {
+ *quota_sb_inump(sb, qtype) = 0;
+ ext2fs_mark_super_dirty(fs);
+ }
+ }
+}
diff --git a/e2fsck/super.c b/e2fsck/super.c
index d2fd9225..8153f2bf 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -910,6 +910,8 @@ void check_super_block(e2fsck_t ctx)
}
}
+ e2fsck_validate_quota_inodes(ctx);
+
/*
* Move the ext3 journal file, if necessary.
*/
diff --git a/lib/blkid/read.c b/lib/blkid/read.c
index efc348b9..b8948564 100644
--- a/lib/blkid/read.c
+++ b/lib/blkid/read.c
@@ -199,7 +199,7 @@ static int parse_dev(blkid_cache cache, blkid_dev *dev, char **cp)
start = skip_over_blank(start + 1);
end = skip_over_word(start);
- DBG(DEBUG_READ, printf("device should be %*s\n",
+ DBG(DEBUG_READ, printf("device should be %.*s\n",
(int)(end - start), start));
if (**cp == '>')
diff --git a/lib/e2p/ostype.c b/lib/e2p/ostype.c
index 7f088446..c5fd8ab3 100644
--- a/lib/e2p/ostype.c
+++ b/lib/e2p/ostype.c
@@ -30,7 +30,7 @@ char *e2p_os2string(int os_type)
const char *os;
char *ret;
- if (os_type <= EXT2_OS_LITES)
+ if (os_type >= 0 && os_type <= EXT2_OS_LITES)
os = os_tab[os_type];
else
os = "(unknown os)";
diff --git a/lib/ext2fs/flushb.c b/lib/ext2fs/flushb.c
index fe1d3e7d..bb7daf43 100644
--- a/lib/ext2fs/flushb.c
+++ b/lib/ext2fs/flushb.c
@@ -64,18 +64,25 @@ errcode_t ext2fs_sync_device(int fd, int flushb)
#endif
if (flushb) {
+ errcode_t retval = 0;
#ifdef BLKFLSBUF
if (ioctl (fd, BLKFLSBUF, 0) == 0)
return 0;
+ retval = errno;
#elif defined(__linux__)
#warning BLKFLSBUF not defined
#endif
#ifdef FDFLUSH
- return ioctl(fd, FDFLUSH, 0); /* In case this is a floppy */
+ /* In case this is a floppy */
+ if (ioctl(fd, FDFLUSH, 0) == 0)
+ return 0;
+ if (retval == 0)
+ retval = errno;
#elif defined(__linux__)
#warning FDFLUSH not defined
#endif
+ return retval;
}
return 0;
}
diff --git a/lib/ext2fs/namei.c b/lib/ext2fs/namei.c
index d485a720..1064ab53 100644
--- a/lib/ext2fs/namei.c
+++ b/lib/ext2fs/namei.c
@@ -142,7 +142,7 @@ static errcode_t open_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t base,
errcode_t retval;
#ifdef NAMEI_DEBUG
- printf("open_namei: root=%lu, dir=%lu, path=%*s, lc=%d\n",
+ printf("open_namei: root=%lu, dir=%lu, path=%.*s, lc=%d\n",
root, base, pathlen, pathname, link_count);
#endif
retval = dir_namei(fs, root, base, pathname, pathlen,
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index 93b02ed8..da03bc14 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -121,6 +121,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
blk64_t group_block, blk;
char *dest, *cp;
int group_zero_adjust = 0;
+ int inode_size;
#ifdef WORDS_BIGENDIAN
unsigned int groups_per_block;
struct ext2_group_desc *gdp;
@@ -275,8 +276,8 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
}
}
- if ((fs->super->s_log_block_size + EXT2_MIN_BLOCK_LOG_SIZE) >
- EXT2_MAX_BLOCK_LOG_SIZE) {
+ if (fs->super->s_log_block_size >
+ (unsigned) (EXT2_MAX_BLOCK_LOG_SIZE - EXT2_MIN_BLOCK_LOG_SIZE)) {
retval = EXT2_ET_CORRUPT_SUPERBLOCK;
goto cleanup;
}
@@ -297,7 +298,10 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
goto cleanup;
}
fs->fragsize = fs->blocksize = EXT2_BLOCK_SIZE(fs->super);
- if (EXT2_INODE_SIZE(fs->super) < EXT2_GOOD_OLD_INODE_SIZE) {
+ inode_size = EXT2_INODE_SIZE(fs->super);
+ if ((inode_size < EXT2_GOOD_OLD_INODE_SIZE) ||
+ (inode_size > fs->blocksize) ||
+ (inode_size & (inode_size - 1))) {
retval = EXT2_ET_CORRUPT_SUPERBLOCK;
goto cleanup;
}
diff --git a/lib/support/mkquota.c b/lib/support/mkquota.c
index 11a878e7..00f3a406 100644
--- a/lib/support/mkquota.c
+++ b/lib/support/mkquota.c
@@ -193,20 +193,21 @@ errcode_t quota_write_inode(quota_ctx_t qctx, unsigned int qtype_bits)
continue;
retval = quota_file_create(h, fs, qtype, fmt);
- if (retval < 0) {
- log_debug("Cannot initialize io on quotafile");
- continue;
+ if (retval) {
+ log_debug("Cannot initialize io on quotafile: %s",
+ error_message(retval));
+ goto out;
}
write_dquots(dict, h);
retval = quota_file_close(qctx, h);
- if (retval < 0) {
- log_err("Cannot finish IO on new quotafile: %s",
- strerror(errno));
+ if (retval) {
+ log_debug("Cannot finish IO on new quotafile: %s",
+ strerror(errno));
if (h->qh_qf.e2_file)
ext2fs_file_close(h->qh_qf.e2_file);
(void) quota_inode_truncate(fs, h->qh_qf.ino);
- continue;
+ goto out;
}
/* Set quota inode numbers in superblock. */
diff --git a/lib/support/quotaio.c b/lib/support/quotaio.c
index 240eab3d..2daf1785 100644
--- a/lib/support/quotaio.c
+++ b/lib/support/quotaio.c
@@ -273,11 +273,13 @@ errcode_t quota_file_open(quota_ctx_t qctx, struct quota_handle *h,
if (h->qh_ops->check_file &&
(h->qh_ops->check_file(h, qtype, fmt) == 0)) {
log_err("qh_ops->check_file failed");
+ err = EIO;
goto errout;
}
if (h->qh_ops->init_io && (h->qh_ops->init_io(h) < 0)) {
log_err("qh_ops->init_io failed");
+ err = EIO;
goto errout;
}
if (allocated_handle)
@@ -288,7 +290,7 @@ errout:
ext2fs_file_close(e2_file);
if (allocated_handle)
ext2fs_free_mem(&h);
- return -1;
+ return err;
}
static errcode_t quota_inode_init_new(ext2_filsys fs, ext2_ino_t ino)
@@ -405,12 +407,12 @@ errcode_t quota_file_close(quota_ctx_t qctx, struct quota_handle *h)
{
if (h->qh_io_flags & IOFL_INFODIRTY) {
if (h->qh_ops->write_info && h->qh_ops->write_info(h) < 0)
- return -1;
+ return EIO;
h->qh_io_flags &= ~IOFL_INFODIRTY;
}
if (h->qh_ops->end_io && h->qh_ops->end_io(h) < 0)
- return -1;
+ return EIO;
if (h->qh_qf.e2_file) {
__u64 new_size, size;
diff --git a/misc/Makefile.in b/misc/Makefile.in
index d08859d9..f696d13a 100644
--- a/misc/Makefile.in
+++ b/misc/Makefile.in
@@ -69,12 +69,13 @@ E2FREEFRAG_OBJS= e2freefrag.o
E2FUZZ_OBJS= e2fuzz.o
FUSE2FS_OBJS= fuse2fs.o journal.o recovery.o revoke.o
-PROFILED_TUNE2FS_OBJS= profiled/tune2fs.o profiled/util.o
+PROFILED_TUNE2FS_OBJS= profiled/tune2fs.o profiled/util.o profiled/journal.o \
+ profiled/recovery.o profiled/revoke.o
PROFILED_MKLPF_OBJS= profiled/mklost+found.o
-PROFILED_MKE2FS_OBJS= profiled/mke2fs.o profiled/util.o profiled/profile.o \
- profiled/prof_err.o profiled/default_profile.o \
- profiled/mk_hugefiles.o profiled/create_inode.o
-
+PROFILED_MKE2FS_OBJS= profiled/mke2fs.o profiled/util.o \
+ profiled/default_profile.o \
+ profiled/mk_hugefiles.o \
+ profiled/create_inode.o
PROFILED_CHATTR_OBJS= profiled/chattr.o
PROFILED_LSATTR_OBJS= profiled/lsattr.o
PROFILED_UUIDGEN_OBJS= profiled/uuidgen.o
@@ -106,8 +107,8 @@ SRCS= $(srcdir)/tune2fs.c $(srcdir)/mklost+found.c $(srcdir)/mke2fs.c $(srcdir)/
LIBS= $(LIBEXT2FS) $(LIBCOM_ERR) $(LIBSUPPORT)
DEPLIBS= $(LIBEXT2FS) $(DEPLIBCOM_ERR) $(DEPLIBSUPPORT)
-PROFILED_LIBS= $(PROFILED_LIBEXT2FS) $(PROFILED_LIBCOM_ERR) $(LIBSUPPORT)
-PROFILED_DEPLIBS= $(PROFILED_LIBEXT2FS) $(DEPPROFILED_LIBCOM_ERR) $(DEPLIBSUPPORT)
+PROFILED_LIBS= $(LIBSUPPORT) $(PROFILED_LIBEXT2FS) $(PROFILED_LIBCOM_ERR)
+PROFILED_DEPLIBS= $(DEPLIBSUPPORT) $(PROFILED_LIBEXT2FS) $(DEPPROFILED_LIBCOM_ERR)
STATIC_LIBS= $(LIBSUPPORT) $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR)
STATIC_DEPLIBS= $(DEPLIBSUPPORT) $(STATIC_LIBEXT2FS) $(DEPSTATIC_LIBCOM_ERR)
@@ -184,10 +185,9 @@ tune2fs.profiled: $(TUNE2FS_OBJS) $(PROFILED_DEPLIBS) \
$(PROFILED_E2P) $(DEPPROFILED_LIBBLKID) $(DEPPROFILED_LIBUUID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o tune2fs.profiled \
- $(PROFILED_TUNE2FS_OBJS) $(PROFILED_LIBBLKID) \
- $(PROFILED_LIBUUID) $(PROFILED_LIBE2P) \
- $(LIBINTL) $(PROFILED_LIBS) $(SYSLIBS) $(PROFILED_LIBBLKID) \
- $(LIBMAGIC)
+ $(PROFILED_TUNE2FS_OBJS) $(PROFILED_LIBS) \
+ $(PROFILED_LIBBLKID) $(PROFILED_LIBUUID) $(PROFILED_LIBE2P) \
+ $(LIBINTL) $(SYSLIBS) $(PROFILED_LIBUUID) $(LIBMAGIC)
blkid: $(BLKID_OBJS) $(DEPLIBBLKID) $(LIBEXT2FS)
$(E) " LD $@"
@@ -395,21 +395,25 @@ journal.o: $(srcdir)/../debugfs/journal.c
$(E) " CC $@"
$(Q) $(CC) -c $(JOURNAL_CFLAGS) -I$(srcdir) \
$(srcdir)/../debugfs/journal.c -o $@
+@PROFILE_CMT@ $(Q) $(CC) $(JOURNAL_CFLAGS) -g -pg -o profiled/$*.o -c $<
recovery.o: $(srcdir)/../e2fsck/recovery.c
$(E) " CC $@"
$(Q) $(CC) -c $(JOURNAL_CFLAGS) -I$(srcdir) \
$(srcdir)/../e2fsck/recovery.c -o $@
+@PROFILE_CMT@ $(Q) $(CC) $(JOURNAL_CFLAGS) -g -pg -o profiled/$*.o -c $<
revoke.o: $(srcdir)/../e2fsck/revoke.c
$(E) " CC $@"
$(Q) $(CC) -c $(JOURNAL_CFLAGS) -I$(srcdir) \
$(srcdir)/../e2fsck/revoke.c -o $@
+@PROFILE_CMT@ $(Q) $(CC) $(JOURNAL_CFLAGS) -g -pg -o profiled/$*.o -c $<
tst_ismounted: $(srcdir)/ismounted.c $(STATIC_LIBEXT2FS) $(DEPLIBCOM_ERR)
$(E) " LD $@"
$(CC) -o tst_ismounted $(srcdir)/ismounted.c -DDEBUG $(ALL_CFLAGS) \
$(LIBCOM_ERR) $(SYSLIBS)
+@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
tune2fs.8: $(DEP_SUBSTITUTE) $(srcdir)/tune2fs.8.in
$(E) " SUBST $@"
diff --git a/misc/ext4.5.in b/misc/ext4.5.in
index c1e67abb..021cd194 100644
--- a/misc/ext4.5.in
+++ b/misc/ext4.5.in
@@ -69,7 +69,14 @@ ext2 file systems.
.TP
.B dir_nlink
.br
-This ext4 feature allows more than 65000 subdirectories per directory.
+Normally, ext4 allows an inode to have no more than 65,000 hard links.
+This applies to regular files as well as directories, which means that
+there can be no more than 64,998 subdirectories in a directory (because
+each of the '.' and '..' entries, as well as the directory entry for the
+directory in its parent directory counts as a hard link). This feature
+lifts this limit by causing ext4 to use a link count of 1 to indicate
+that the number of hard links to a directory is not known when the link
+count might exceed the maximum count limit.
.TP
.B encrypt
.br
diff --git a/misc/tune2fs.8.in b/misc/tune2fs.8.in
index 5c885f9a..eccf2772 100644
--- a/misc/tune2fs.8.in
+++ b/misc/tune2fs.8.in
@@ -134,7 +134,9 @@ Staggering the mount-counts at which filesystems are forcibly
checked will avoid all filesystems being checked at one time
when using journaled filesystems.
.sp
-You should strongly consider the consequences of disabling
+Mount-count-dependent checking is disabled by default to avoid
+unanticipated long reboots while e2fsck does its work. However,
+you may wish to consider the consequences of disabling
mount-count-dependent checking entirely. Bad disk drives, cables,
memory, and kernel bugs could all corrupt a filesystem without
marking the filesystem dirty or in error. If you are using
@@ -289,15 +291,10 @@ as months, and
.B w
as weeks. A value of zero will disable the time-dependent checking.
.sp
-It is strongly recommended that either
+There are pros and cons to disabling these periodic checks; see the
+discussion under the
.B \-c
-(mount-count-dependent) or
-.B \-i
-(time-dependent) checking be enabled to force periodic full
-.BR e2fsck (8)
-checking of the filesystem. Failure to do so may lead to filesystem
-corruption (due to bad disks, cables, memory, or kernel bugs) going
-unnoticed, ultimately resulting in data loss or corruption.
+(mount-count-dependent check) option for details.
.TP
.B \-I
Change the inode size used by the file system. This requires rewriting
diff --git a/resize/main.c b/resize/main.c
index 396391b6..ab7375c1 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -440,6 +440,10 @@ int main (int argc, char ** argv)
!print_min_size)
checkit = 1;
+ if ((fs->super->s_free_blocks_count > fs->super->s_blocks_count) ||
+ (fs->super->s_free_inodes_count > fs->super->s_inodes_count))
+ checkit = 1;
+
if (checkit) {
fprintf(stderr,
_("Please run 'e2fsck -f %s' first.\n\n"),
diff --git a/tests/d_bad_ostype/expect b/tests/d_bad_ostype/expect
new file mode 100644
index 00000000..b00318c4
--- /dev/null
+++ b/tests/d_bad_ostype/expect
@@ -0,0 +1 @@
+Filesystem OS type: (unknown os)
diff --git a/tests/d_bad_ostype/name b/tests/d_bad_ostype/name
new file mode 100644
index 00000000..3da887a8
--- /dev/null
+++ b/tests/d_bad_ostype/name
@@ -0,0 +1 @@
+handle bad (negative) os_type
diff --git a/tests/d_bad_ostype/script b/tests/d_bad_ostype/script
new file mode 100644
index 00000000..992a3030
--- /dev/null
+++ b/tests/d_bad_ostype/script
@@ -0,0 +1,21 @@
+dd if=/dev/zero of=$TMPFILE bs=1k count=64 > /dev/null 2>&1
+$MKE2FS -q -b 1024 $TMPFILE
+$DEBUGFS -w -R 'set_super_value creator_os 0xf0000000' $TMPFILE
+
+OUT=$test_name.log
+EXP=$test_dir/expect
+$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed | grep 'Filesystem OS type:' > $OUT
+
+rm -f $TMPFILE
+cmp -s $OUT $EXP
+status=$?
+
+if [ "$status" = 0 ] ; then
+ echo "$test_name: $test_description: ok"
+ touch $test_name.ok
+else
+ echo "$test_name: $test_description: failed"
+ diff $DIFF_OPTS $EXP $OUT > $test_name.failed
+ rm -f $test_name.tmp
+fi
+unset OUT EXP
diff --git a/tests/f_ind_inode_collision/expect.1 b/tests/f_ind_inode_collision/expect.1
index 012cd9ff..63c128b4 100644
--- a/tests/f_ind_inode_collision/expect.1
+++ b/tests/f_ind_inode_collision/expect.1
@@ -2,7 +2,6 @@ Pass 1: Checking inodes, blocks, and sizes
Inode 12 block 41 conflicts with critical metadata, skipping block checks.
Inode 12 block 40 conflicts with critical metadata, skipping block checks.
Inode 12 block 34 conflicts with critical metadata, skipping block checks.
-Illegal block number passed to ext2fs_test_block_bitmap #16777215 for metadata block map
Inode 12 block 1 conflicts with critical metadata, skipping block checks.
Inode 12, i_size is 33, should be 25227264. Fix? yes
diff --git a/tests/f_itable_collision/expect.1 b/tests/f_itable_collision/expect.1
index 00cdced8..01c85d4d 100644
--- a/tests/f_itable_collision/expect.1
+++ b/tests/f_itable_collision/expect.1
@@ -12,23 +12,15 @@ Inodes that were part of a corrupted orphan linked list found. Fix? yes
Inode 49 was part of the orphaned inode list. FIXED.
Inode 14 block 36 conflicts with critical metadata, skipping block checks.
-Illegal block number passed to ext2fs_test_block_bitmap #4294967295 for metadata block map
Inode 14 has illegal block(s). Clear? yes
Illegal indirect block (4294967295) in inode 14. CLEARED.
-Illegal block number passed to ext2fs_test_block_bitmap #4294967295 for metadata block map
Illegal indirect block (4294967295) in inode 14. CLEARED.
-Illegal block number passed to ext2fs_test_block_bitmap #4294967295 for metadata block map
Illegal indirect block (4294967295) in inode 14. CLEARED.
-Illegal block number passed to ext2fs_test_block_bitmap #4294967295 for metadata block map
Illegal indirect block (4294967295) in inode 14. CLEARED.
-Illegal block number passed to ext2fs_test_block_bitmap #4294967295 for metadata block map
Illegal indirect block (4294967295) in inode 14. CLEARED.
-Illegal block number passed to ext2fs_test_block_bitmap #4294967295 for metadata block map
Illegal indirect block (4294967295) in inode 14. CLEARED.
-Illegal block number passed to ext2fs_test_block_bitmap #4294967295 for metadata block map
Illegal indirect block (4294967295) in inode 14. CLEARED.
-Illegal block number passed to ext2fs_test_block_bitmap #4294967295 for metadata block map
Too many illegal blocks in inode 14.
Clear inode? yes
diff --git a/tests/f_quota_invalid_inum/expect.1 b/tests/f_quota_invalid_inum/expect.1
new file mode 100644
index 00000000..a989f16c
--- /dev/null
+++ b/tests/f_quota_invalid_inum/expect.1
@@ -0,0 +1,15 @@
+Invalid user quota inode 808464432. Fix? yes
+
+Invalid group quota inode 808464432. Fix? yes
+
+Invalid group quota inode 808464432. Fix? yes
+
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/16 files (0.0% non-contiguous), 21/100 blocks
+Exit status is 1
diff --git a/tests/f_quota_invalid_inum/expect.2 b/tests/f_quota_invalid_inum/expect.2
new file mode 100644
index 00000000..41ceefb4
--- /dev/null
+++ b/tests/f_quota_invalid_inum/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/16 files (0.0% non-contiguous), 21/100 blocks
+Exit status is 0
diff --git a/tests/f_quota_invalid_inum/image.gz b/tests/f_quota_invalid_inum/image.gz
new file mode 100644
index 00000000..28be80ef
--- /dev/null
+++ b/tests/f_quota_invalid_inum/image.gz
Binary files differ
diff --git a/tests/f_quota_invalid_inum/name b/tests/f_quota_invalid_inum/name
new file mode 100644
index 00000000..a7424060
--- /dev/null
+++ b/tests/f_quota_invalid_inum/name
@@ -0,0 +1 @@
+invalid quota inode numbers