summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog3
-rw-r--r--Makefile.in2
-rw-r--r--quotacheck.c46
-rw-r--r--quotacheck_v1.c5
4 files changed, 35 insertions, 21 deletions
diff --git a/Changelog b/Changelog
index bd938ab..ee6e3de 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,7 @@
Changes in quota-tools from 3.08 to 3.09
+* quotacheck(8) now remembers only hardlinked files and not all inodes with
+ n_link > 1 (Jan Kara, Jan Kasprzak)
+* quotacheck(8) doesn't store structures for all users in old quota format (Jan Kasprzak)
* fixed minor bug in documentation (Jan Kara, Lucas Brasilino)
* repquota(8) handles multiple entries in /etc/passwd better (Jan Kara)
* made tools not to touch mountpoints mounted without quota options (Jan Kara)
diff --git a/Makefile.in b/Makefile.in
index 55725d2..909476c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,6 +1,6 @@
PROGS = quotacheck quotaon quota quot repquota warnquota quotastats xqmstats edquota setquota convertquota rpc.rquotad
SOURCES = bylabel.c common.c convertquota.c edquota.c pot.c quot.c quota.c quotacheck.c quotacheck_v1.c quotacheck_v2.c quotaio.c quotaio_rpc.c quotaio_v1.c quotaio_v2.c quotaio_xfs.c quotaio_generic.c quotaon.c quotaon_xfs.c quotaops.c quotastats.c quotasys.c repquota.c rquota_client.c rquota_server.c rquota_svc.c setquota.c warnquota.c xqmstats.c svc_socket.c
-VERSIONDEF = -DQUOTA_VERSION=\"3.08\"
+VERSIONDEF = -DQUOTA_VERSION=\"3.09\"
CFLAGS = @CFLAGS@ @EXT2_DIRECT@ -D_GNU_SOURCE -Wall -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $(VERSIONDEF)
EXT2LIBS = @EXT2LIBS@
RPCSRC = rquota.h rquota_xdr.c rquota_clnt.c
diff --git a/quotacheck.c b/quotacheck.c
index ccdc3d0..e9fd0a8 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.33 2002/11/28 22:02:04 jkar8572 Exp $"
+#ident "$Id: quotacheck.c,v 1.34 2003/04/08 13:11:06 jkar8572 Exp $"
#include <dirent.h>
#include <stdio.h>
@@ -182,7 +182,7 @@ struct dquot *add_dquot(qid_t id, int type)
* Add a number of blocks and inodes to a quota.
*/
static void add_to_quota(int type, ino_t i_num, uid_t i_uid, gid_t i_gid, mode_t i_mode,
- nlink_t i_nlink, loff_t i_space)
+ nlink_t i_nlink, loff_t i_space, int need_remember)
{
qid_t wanted;
struct dquot *lptr;
@@ -195,7 +195,7 @@ static void add_to_quota(int type, ino_t i_num, uid_t i_uid, gid_t i_gid, mode_t
if ((lptr = lookup_dquot(wanted, type)) == NODQUOT)
lptr = add_dquot(wanted, type);
- if (i_nlink != 1)
+ if (i_nlink != 1 && need_remember)
if (store_dlinks(type, i_num)) /* Did we already count this inode? */
return;
lptr->dq_dqb.dqb_curinodes++;
@@ -402,19 +402,21 @@ static int ext2_direct_scan(char *device)
while ((long)i_num) {
if (inode.i_links_count) {
- debug(FL_DEBUG, _("Found i_num %ld\n"), (long)i_num);
+ debug(FL_DEBUG, _("Found i_num %ld, %ld\n"), (long)i_num, (long)inode.i_blocks);
if (flags & FL_VERBOSE)
blit();
uid = inode.i_uid | (inode.i_uid_high << 16);
gid = inode.i_gid | (inode.i_gid_high << 16);
+ if (inode.i_uid_high | inode.i_gid_high)
+ debug(FL_DEBUG, _("High uid detected.\n"));
if (ucheck)
add_to_quota(USRQUOTA, i_num, uid, gid,
inode.i_mode, inode.i_links_count,
- inode.i_blocks << 9);
+ inode.i_blocks << 9, 0);
if (gcheck)
add_to_quota(GRPQUOTA, i_num, uid, gid,
inode.i_mode, inode.i_links_count,
- inode.i_blocks << 9);
+ inode.i_blocks << 9, 0);
if (S_ISDIR(inode.i_mode))
dirs_done++;
else
@@ -445,6 +447,18 @@ static int scan_dir(char *pathname)
DIR *dp;
int ret;
+ if (lstat(pathname, &st) == -1) {
+ errstr(_("Cannot stat root directory %s: %s\n"), pathname, strerror(errno));
+ goto out;
+ }
+ qspace = getqsize(pathname, &st);
+ if (ucheck)
+ add_to_quota(USRQUOTA, st.st_ino, st.st_uid, st.st_gid, st.st_mode,
+ st.st_nlink, qspace, 0);
+ if (gcheck)
+ add_to_quota(GRPQUOTA, st.st_ino, st.st_uid, st.st_gid, st.st_mode,
+ st.st_nlink, qspace, 0);
+
if ((dp = opendir(pathname)) == (DIR *) NULL)
die(2, _("\nCan open directory %s: %s\n"), pathname, strerror(errno));
@@ -464,10 +478,10 @@ static int scan_dir(char *pathname)
qspace = getqsize(de->d_name, &st);
if (ucheck)
add_to_quota(USRQUOTA, st.st_ino, st.st_uid, st.st_gid, st.st_mode,
- st.st_nlink, qspace);
+ st.st_nlink, qspace, !S_ISDIR(st.st_mode));
if (gcheck)
add_to_quota(GRPQUOTA, st.st_ino, st.st_uid, st.st_gid, st.st_mode,
- st.st_nlink, qspace);
+ st.st_nlink, qspace, !S_ISDIR(st.st_mode));
if (S_ISDIR(st.st_mode)) {
if (st.st_dev != cur_dev)
@@ -746,20 +760,12 @@ static void check_dir(struct mntent *mnt)
qspace = getqsize(mnt->mnt_dir, &st);
cur_dev = st.st_dev;
files_done = dirs_done = 0;
- if (ucheck) {
- if (process_file(mnt, USRQUOTA) >= 0)
- add_to_quota(USRQUOTA, st.st_ino, st.st_uid, st.st_gid, st.st_mode,
- st.st_nlink, qspace);
- else
+ if (ucheck)
+ if (process_file(mnt, USRQUOTA) < 0)
ucheck = 0;
- }
- if (gcheck) {
- if (process_file(mnt, GRPQUOTA) >= 0)
- add_to_quota(GRPQUOTA, st.st_ino, st.st_uid, st.st_gid, st.st_mode,
- st.st_nlink, qspace);
- else
+ if (gcheck)
+ if (process_file(mnt, GRPQUOTA) < 0)
gcheck = 0;
- }
if (!ucheck && !gcheck) /* Nothing to check? */
return;
if (!(flags & FL_NOREMOUNT)) {
diff --git a/quotacheck_v1.c b/quotacheck_v1.c
index 7fe8012..1f583f7 100644
--- a/quotacheck_v1.c
+++ b/quotacheck_v1.c
@@ -34,6 +34,11 @@ static void load_dquots(char *filename, int fd, int type)
(uint) id);
break;
}
+ if (ddqblk.dqb_bhardlimit == 0
+ && ddqblk.dqb_bsoftlimit == 0
+ && ddqblk.dqb_ihardlimit == 0
+ && ddqblk.dqb_isoftlimit == 0)
+ continue;
dquot = add_dquot(id, type);
udq = &dquot->dq_dqb;
udq->dqb_bhardlimit = ddqblk.dqb_bhardlimit;