summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog6
-rw-r--r--quotacheck.83
-rw-r--r--quotacheck.c19
-rw-r--r--quotacheck_v2.c4
-rw-r--r--quotaio_v2.c13
5 files changed, 31 insertions, 14 deletions
diff --git a/Changelog b/Changelog
index 9d75379..c97aa72 100644
--- a/Changelog
+++ b/Changelog
@@ -1,9 +1,11 @@
Changes in quota-tools from 3.12 to 3.13
* added sanity check to quota reporting (Jan Kara)
+* fixed check for illegal references in quotacheck(8) (Jan Kara)
* added NFSv4 to the list of supported fs types (Jan Kara)
-* added printing of directories to quotacheck (Jan Kara, Jan Engelhardt)
+* updating of progress is now less frequent - should speedup quotacheck -v a bit (Jan Kara)
+* added printing of directories to quotacheck(8) (Jan Kara, Jan Engelhardt)
* added dynamic mountpoint array allocation (Jan Kara)
-* made quotacheck(8) more friendly for journaled quota (Jan Kara)
+* made quotacheck(8) more friendly to journaled quota (Jan Kara)
* changed configure to detect whether nls is needed (Tomasz Kloczko, Jan Kara)
* added JFS into a set of supported filesystems (David Kleikamp)
* added French translation (Jerome Schell)
diff --git a/quotacheck.8 b/quotacheck.8
index 10190f7..e3188fa 100644
--- a/quotacheck.8
+++ b/quotacheck.8
@@ -78,7 +78,8 @@ to make backups of the quota file before writing the new data.
.B \-v
.B quotacheck
reports its operation as it progresses. Normally it operates silently.
-If the option is specified twice, also the current directory is printed.
+If the option is specified twice, also the current directory is printed (note
+that printing can slow down the scan measurably).
.TP
.B \-d
Enable debugging mode. It will result in a lot of information which can
diff --git a/quotacheck.c b/quotacheck.c
index 7d63ace..92e38c3 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -8,7 +8,7 @@
* New quota format implementation - Jan Kara <jack@suse.cz> - Sponsored by SuSE CR
*/
-#ident "$Id: quotacheck.c,v 1.43 2005/03/10 16:20:45 jkar8572 Exp $"
+#ident "$Id: quotacheck.c,v 1.44 2005/03/17 11:14:34 jkar8572 Exp $"
#include <dirent.h>
#include <stdio.h>
@@ -59,6 +59,7 @@ struct dirs {
};
#define BITS_SIZE 4 /* sizeof(bits) == 5 */
+#define BLIT_RATIO 10 /* Blit in just 1/10 of blit() calls */
dev_t cur_dev; /* Device we are working on */
int files_done, dirs_done;
@@ -269,18 +270,22 @@ static loff_t getqsize(char *fname, struct stat *st)
*/
static inline void blit(char *msg)
{
- static short bitc = 0;
+ static int bitc = 0;
static const char bits[] = "|/-\\";
+ static int slow_down;
if (flags & FL_VERYVERBOSE && msg) {
putchar('\r');
printf("%-70s ", msg);
}
- putchar(bits[bitc]);
- putchar('\b');
- fflush(stdout);
- bitc++;
- bitc %= BITS_SIZE;
+ if (flags & FL_VERYVERBOSE || ++slow_down >= BLIT_RATIO) {
+ putchar(bits[bitc]);
+ putchar('\b');
+ fflush(stdout);
+ bitc++;
+ bitc %= BITS_SIZE;
+ slow_down = 0;
+ }
}
static void usage(void)
diff --git a/quotacheck_v2.c b/quotacheck_v2.c
index 494f957..be53173 100644
--- a/quotacheck_v2.c
+++ b/quotacheck_v2.c
@@ -224,8 +224,10 @@ static void check_read_blk(int fd, uint blk, dqbuf_t buf)
static int check_tree_ref(uint blk, uint ref, uint blocks, int check_use, uint * corrupted,
uint * lblk)
{
- if (check_blkref(ref, blocks) < 0)
+ if (check_blkref(ref, blocks) < 0) {
blk_corrupted(corrupted, lblk, blk, _("Reference to illegal block %u"), ref);
+ return -1;
+ }
if (!ref)
return 0;
if (!check_use || !GET_BLK(ref))
diff --git a/quotaio_v2.c b/quotaio_v2.c
index 6ba7225..5176435 100644
--- a/quotaio_v2.c
+++ b/quotaio_v2.c
@@ -748,6 +748,12 @@ static int report_block(struct dquot *dquot, uint blk, char *bitmap,
return entries;
}
+static void check_reference(struct quota_handle *h, uint blk)
+{
+ if (blk >= h->qh_info.u.v2_mdqi.dqi_blocks)
+ die(2, _("Illegal reference in %s quota file on %s. Quota file is probably corrupted.\nPlease run quotacheck(8) and try again.\n"), type2name(h->qh_type), h->qh_quotadev);
+}
+
static int report_tree(struct dquot *dquot, uint blk, int depth, char *bitmap,
int (*process_dquot) (struct dquot *, char *))
{
@@ -759,17 +765,18 @@ static int report_tree(struct dquot *dquot, uint blk, int depth, char *bitmap,
if (depth == V2_DQTREEDEPTH - 1) {
for (i = 0; i < V2_DQBLKSIZE >> 2; i++) {
blk = __le32_to_cpu(ref[i]);
- if (blk >= dquot->dq_h->qh_info.u.v2_mdqi.dqi_blocks)
- die(2, _("Illegal reference in %s quota file on %s. Quota file is probably corrupted.\nPlease run quotacheck(8) and try again.\n"), type2name(dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev);
+ check_reference(dquot->dq_h, blk);
if (blk && !get_bit(bitmap, blk))
entries += report_block(dquot, blk, bitmap, process_dquot);
}
}
else {
for (i = 0; i < V2_DQBLKSIZE >> 2; i++)
- if ((blk = __le32_to_cpu(ref[i])))
+ if ((blk = __le32_to_cpu(ref[i]))) {
+ check_reference(dquot->dq_h, blk);
entries +=
report_tree(dquot, blk, depth + 1, bitmap, process_dquot);
+ }
}
freedqbuf(buf);
return entries;