summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorjkennedy <none@none>2006-05-23 10:06:05 -0700
committerjkennedy <none@none>2006-05-23 10:06:05 -0700
commit20a1ae8aa548e5c0874f0cb213a5f242fe315a59 (patch)
treed5c04e191170ee3fa58eb508bcd67bfaf3840511 /usr/src
parent9760e1c48d45ca95f530c947bf07c62061b86c18 (diff)
downloadillumos-gate-20a1ae8aa548e5c0874f0cb213a5f242fe315a59.tar.gz
4775289 fsck reports wrong state in superblock if there once has existed a largefile
6302747 Performance regression when deleting large files from a logging ufs filesystem 6362734 df output corrupt after under heavy stress
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/fs.d/ufs/fsck/utilities.c27
-rw-r--r--usr/src/uts/common/fs/ufs/lufs_map.c42
-rw-r--r--usr/src/uts/common/fs/ufs/ufs_thread.c15
3 files changed, 42 insertions, 42 deletions
diff --git a/usr/src/cmd/fs.d/ufs/fsck/utilities.c b/usr/src/cmd/fs.d/ufs/fsck/utilities.c
index 40768e7a8f..6e49530bf9 100644
--- a/usr/src/cmd/fs.d/ufs/fsck/utilities.c
+++ b/usr/src/cmd/fs.d/ufs/fsck/utilities.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1152,7 +1152,7 @@ updateclean(void)
char fsclean;
int fsreclaim;
char fsflags;
- int flags_ok;
+ int flags_ok = 1;
daddr32_t fslogbno;
offset_t sblkoff;
time_t t;
@@ -1235,24 +1235,15 @@ updateclean(void)
fsflags &= ~FSLARGEFILES;
/*
- * If the only flag difference is that the superblock thinks
- * there are largefiles, but we didn't find any, then ignore
- * the discrepancy. The kernel never clears the flag, it just
- * sets it whenever a largefile is created. Since it is harmless
- * to have the flag set when it's not actually true, that by
- * itself is not grounds for declaring the superblock to be
- * in the wrong state.
- *
- * This could, in theory, prevent a filesystem from being
- * mounted, if the existing superblock claims such files are
- * out there and the user uses the nolargefiles option. So,
- * if we were forced to scan the filesystem, go ahead and
- * take FSLARGEFILES into account as well.
+ * There can be two discrepencies here. A) The superblock
+ * shows no largefiles but we found some while scanning.
+ * B) The superblock indicates the presence of largefiles,
+ * but none are present. Note that if preening, the superblock
+ * is silently corrected.
*/
- if (fflag)
+ if ((fsflags == FSLARGEFILES && sblock.fs_flags != FSLARGEFILES) ||
+ (fsflags != FSLARGEFILES && sblock.fs_flags == FSLARGEFILES))
flags_ok = 0;
- else
- flags_ok = (sblock.fs_flags & ~FSLARGEFILES) == fsflags;
if (debug)
(void) printf(
diff --git a/usr/src/uts/common/fs/ufs/lufs_map.c b/usr/src/uts/common/fs/ufs/lufs_map.c
index 72e1950617..a415b9a477 100644
--- a/usr/src/uts/common/fs/ufs/lufs_map.c
+++ b/usr/src/uts/common/fs/ufs/lufs_map.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -22,7 +21,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1737,27 +1736,32 @@ logmap_cancel(ml_unit_t *ul, offset_t mof, off_t nb, int metadata)
if (hnb > nb)
hnb = nb;
/*
- * find overlapping entries
+ * Find overlapping metadata entries. Don't search through
+ * the hash chains if this is user data because it is only
+ * possible to have overlapping map entries for metadata,
+ * and the search can become expensive for large files.
*/
- mep = MAP_HASH(mof, mtm);
- mutex_enter(&mtm->mtm_mutex);
- for (me = *mep; me; me = me->me_hash) {
- if (!DATAoverlapME(mof, hnb, me))
- continue;
+ if (metadata) {
+ mep = MAP_HASH(mof, mtm);
+ mutex_enter(&mtm->mtm_mutex);
+ for (me = *mep; me; me = me->me_hash) {
+ if (!DATAoverlapME(mof, hnb, me))
+ continue;
- ASSERT(MEwithinDATA(me, mof, hnb));
+ ASSERT(MEwithinDATA(me, mof, hnb));
- if ((me->me_flags & ME_CANCEL) == 0) {
- me->me_cancel = mtm->mtm_cancel;
- mtm->mtm_cancel = me;
- me->me_flags |= ME_CANCEL;
- crb = me->me_crb;
- if (crb) {
- crb->c_invalid = 1;
+ if ((me->me_flags & ME_CANCEL) == 0) {
+ me->me_cancel = mtm->mtm_cancel;
+ mtm->mtm_cancel = me;
+ me->me_flags |= ME_CANCEL;
+ crb = me->me_crb;
+ if (crb) {
+ crb->c_invalid = 1;
+ }
}
}
+ mutex_exit(&mtm->mtm_mutex);
}
- mutex_exit(&mtm->mtm_mutex);
/*
* put a cancel record into the log
diff --git a/usr/src/uts/common/fs/ufs/ufs_thread.c b/usr/src/uts/common/fs/ufs/ufs_thread.c
index d6f7f36d93..8df2d500f3 100644
--- a/usr/src/uts/common/fs/ufs/ufs_thread.c
+++ b/usr/src/uts/common/fs/ufs/ufs_thread.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -631,7 +630,13 @@ ufs_delete_adjust_stats(struct ufsvfs *ufsvfsp, struct statvfs64 *sp)
cv_wait(&delq_info->delq_fast_cv, &uq->uq_mutex);
}
- sp->f_bfree += delq_info->delq_unreclaimed_blocks;
+ /*
+ * The blocks accounted for in the delete queue info are
+ * counted in DEV_BSIZE chunks, but ufs_statvfs counts in
+ * filesystem fragments, so a conversion is required here.
+ */
+ sp->f_bfree += dbtofsb(ufsvfsp->vfs_fs,
+ delq_info->delq_unreclaimed_blocks);
sp->f_ffree += delq_info->delq_unreclaimed_files;
mutex_exit(&uq->uq_mutex);
}