svn commit: r230762 - stable/8/sys/ufs/ffs
Kirk McKusick
mckusick at FreeBSD.org
Mon Jan 30 05:45:12 UTC 2012
Author: mckusick
Date: Mon Jan 30 05:45:11 2012
New Revision: 230762
URL: http://svn.freebsd.org/changeset/base/230762
Log:
MFC r230101:
Convert FFS mount error messages from kernel printf's to using the
vfs_mount_error error message facility provided by the nmount
interface.
Clean up formatting of mount warnings which still need to use
kernel printf's since they do not return errors.
Requested by: Craig Rodrigues <rodrigc at crodrigues.org>
Modified:
stable/8/sys/ufs/ffs/ffs_vfsops.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
Modified: stable/8/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- stable/8/sys/ufs/ffs/ffs_vfsops.c Mon Jan 30 00:27:02 2012 (r230761)
+++ stable/8/sys/ufs/ffs/ffs_vfsops.c Mon Jan 30 05:45:11 2012 (r230762)
@@ -188,8 +188,9 @@ ffs_mount(struct mount *mp)
if (vfs_getopt(mp->mnt_optnew, "nfsv4acls", NULL, NULL) == 0) {
if (mntorflags & MNT_ACLS) {
- printf("WARNING: \"acls\" and \"nfsv4acls\" "
- "options are mutually exclusive\n");
+ vfs_mount_error(mp,
+ "\"acls\" and \"nfsv4acls\" options "
+ "are mutually exclusive");
return (EINVAL);
}
mntorflags |= MNT_NFS4ACLS;
@@ -256,8 +257,8 @@ ffs_mount(struct mount *mp)
}
if (fs->fs_pendingblocks != 0 ||
fs->fs_pendinginodes != 0) {
- printf("%s: %s: blocks %jd files %d\n",
- fs->fs_fsmnt, "update error",
+ printf("WARNING: %s Update error: blocks %jd "
+ "files %d\n", fs->fs_fsmnt,
(intmax_t)fs->fs_pendingblocks,
fs->fs_pendinginodes);
fs->fs_pendingblocks = 0;
@@ -311,12 +312,13 @@ ffs_mount(struct mount *mp)
if ((mp->mnt_flag & MNT_FORCE) ||
((fs->fs_flags & FS_NEEDSFSCK) == 0 &&
(fs->fs_flags & FS_DOSOFTDEP))) {
- printf("WARNING: %s was not %s\n",
- fs->fs_fsmnt, "properly dismounted");
+ printf("WARNING: %s was not properly "
+ "dismounted\n", fs->fs_fsmnt);
} else {
- printf(
-"WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck\n",
- fs->fs_fsmnt);
+ vfs_mount_error(mp,
+ "R/W mount of %s denied. %s.",
+ fs->fs_fsmnt,
+ "Filesystem is not clean - run fsck");
return (EPERM);
}
}
@@ -548,8 +550,8 @@ ffs_reload(struct mount *mp, struct thre
ffs_oldfscompat_read(fs, VFSTOUFS(mp), sblockloc);
UFS_LOCK(ump);
if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) {
- printf("%s: reload pending error: blocks %jd files %d\n",
- fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks,
+ printf("WARNING: %s: reload pending error: blocks %jd "
+ "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks,
fs->fs_pendinginodes);
fs->fs_pendingblocks = 0;
fs->fs_pendinginodes = 0;
@@ -723,24 +725,23 @@ ffs_mountfs(devvp, mp, td)
"WARNING: %s was not properly dismounted\n",
fs->fs_fsmnt);
} else {
- printf(
-"WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck\n",
- fs->fs_fsmnt);
+ vfs_mount_error(mp, "R/W mount of %s denied. %s.",
+ fs->fs_fsmnt, "Filesystem is not clean - run fsck");
error = EPERM;
goto out;
}
if ((fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) &&
(mp->mnt_flag & MNT_FORCE)) {
- printf("%s: lost blocks %jd files %d\n", fs->fs_fsmnt,
- (intmax_t)fs->fs_pendingblocks,
+ printf("WARNING: %s: lost blocks %jd files %d\n",
+ fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks,
fs->fs_pendinginodes);
fs->fs_pendingblocks = 0;
fs->fs_pendinginodes = 0;
}
}
if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) {
- printf("%s: mount pending error: blocks %jd files %d\n",
- fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks,
+ printf("WARNING: %s: mount pending error: blocks %jd "
+ "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks,
fs->fs_pendinginodes);
fs->fs_pendingblocks = 0;
fs->fs_pendinginodes = 0;
@@ -760,16 +761,15 @@ ffs_mountfs(devvp, mp, td)
mp->mnt_flag |= MNT_GJOURNAL;
MNT_IUNLOCK(mp);
} else {
- printf(
-"WARNING: %s: GJOURNAL flag on fs but no gjournal provider below\n",
+ printf("WARNING: %s: GJOURNAL flag on fs "
+ "but no gjournal provider below\n",
mp->mnt_stat.f_mntonname);
free(mp->mnt_gjprovider, M_UFSMNT);
mp->mnt_gjprovider = NULL;
}
#else
- printf(
-"WARNING: %s: GJOURNAL flag on fs but no UFS_GJOURNAL support\n",
- mp->mnt_stat.f_mntonname);
+ printf("WARNING: %s: GJOURNAL flag on fs but no "
+ "UFS_GJOURNAL support\n", mp->mnt_stat.f_mntonname);
#endif
} else {
mp->mnt_gjprovider = NULL;
@@ -853,9 +853,8 @@ ffs_mountfs(devvp, mp, td)
mp->mnt_flag |= MNT_MULTILABEL;
MNT_IUNLOCK(mp);
#else
- printf(
-"WARNING: %s: multilabel flag on fs but no MAC support\n",
- mp->mnt_stat.f_mntonname);
+ printf("WARNING: %s: multilabel flag on fs but "
+ "no MAC support\n", mp->mnt_stat.f_mntonname);
#endif
}
if ((fs->fs_flags & FS_ACLS) != 0) {
@@ -863,8 +862,9 @@ ffs_mountfs(devvp, mp, td)
MNT_ILOCK(mp);
if (mp->mnt_flag & MNT_NFS4ACLS)
- printf("WARNING: ACLs flag on fs conflicts with "
- "\"nfsv4acls\" mount option; option ignored\n");
+ printf("WARNING: %s: ACLs flag on fs conflicts with "
+ "\"nfsv4acls\" mount option; option ignored\n",
+ mp->mnt_stat.f_mntonname);
mp->mnt_flag &= ~MNT_NFS4ACLS;
mp->mnt_flag |= MNT_ACLS;
@@ -880,16 +880,16 @@ ffs_mountfs(devvp, mp, td)
MNT_ILOCK(mp);
if (mp->mnt_flag & MNT_ACLS)
- printf("WARNING: NFSv4 ACLs flag on fs conflicts with "
- "\"acls\" mount option; option ignored\n");
+ printf("WARNING: %s: NFSv4 ACLs flag on fs conflicts "
+ "with \"acls\" mount option; option ignored\n",
+ mp->mnt_stat.f_mntonname);
mp->mnt_flag &= ~MNT_ACLS;
mp->mnt_flag |= MNT_NFS4ACLS;
MNT_IUNLOCK(mp);
#else
- printf(
-"WARNING: %s: NFSv4 ACLs flag on fs but no ACLs support\n",
- mp->mnt_stat.f_mntonname);
+ printf("WARNING: %s: NFSv4 ACLs flag on fs but no "
+ "ACLs support\n", mp->mnt_stat.f_mntonname);
#endif
}
if ((fs->fs_flags & FS_TRIM) != 0) {
@@ -897,12 +897,12 @@ ffs_mountfs(devvp, mp, td)
if (g_io_getattr("GEOM::candelete", cp, &size,
&ump->um_candelete) == 0) {
if (!ump->um_candelete)
- printf(
-"WARNING: %s: TRIM flag on fs but disk does not support TRIM\n",
+ printf("WARNING: %s: TRIM flag on fs but disk "
+ "does not support TRIM\n",
mp->mnt_stat.f_mntonname);
} else {
- printf(
-"WARNING: %s: TRIM flag on fs but cannot get whether disk supports TRIM\n",
+ printf("WARNING: %s: TRIM flag on fs but disk does "
+ "not confirm that it supports TRIM\n",
mp->mnt_stat.f_mntonname);
ump->um_candelete = 0;
}
@@ -1107,15 +1107,16 @@ ffs_unmount(mp, mntflags)
flags = 0;
td = curthread;
fs = ump->um_fs;
+ susp = 0;
if (mntflags & MNT_FORCE) {
flags |= FORCECLOSE;
susp = fs->fs_ronly != 0;
- } else
- susp = 0;
+ }
#ifdef UFS_EXTATTR
if ((error = ufs_extattr_stop(mp, td))) {
if (error != EOPNOTSUPP)
- printf("ffs_unmount: ufs_extattr_stop returned %d\n",
+ printf("WARNING: unmount %s: ufs_extattr_stop "
+ "returned errno %d\n", mp->mnt_stat.f_mntonname,
error);
e_restart = 0;
} else {
@@ -1153,8 +1154,8 @@ ffs_unmount(mp, mntflags)
UFS_LOCK(ump);
if (fs->fs_pendingblocks != 0 || fs->fs_pendinginodes != 0) {
- printf("%s: unmount pending error: blocks %jd files %d\n",
- fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks,
+ printf("WARNING: unmount %s: pending error: blocks %jd "
+ "files %d\n", fs->fs_fsmnt, (intmax_t)fs->fs_pendingblocks,
fs->fs_pendinginodes);
fs->fs_pendingblocks = 0;
fs->fs_pendinginodes = 0;
@@ -1322,10 +1323,9 @@ ffs_sync(mp, waitfor)
td = curthread;
fs = ump->um_fs;
- if (fs->fs_fmod != 0 && fs->fs_ronly != 0) { /* XXX */
- printf("fs = %s\n", fs->fs_fsmnt);
- panic("ffs_sync: rofs mod");
- }
+ if (fs->fs_fmod != 0 && fs->fs_ronly != 0)
+ panic("%s: ffs_sync: modification on read-only filesystem",
+ fs->fs_fsmnt);
/*
* Write back each (modified) inode.
*/
@@ -1742,13 +1742,13 @@ ffs_sbupdate(mp, waitfor, suspended)
bp = sbbp;
if (fs->fs_magic == FS_UFS1_MAGIC && fs->fs_sblockloc != SBLOCK_UFS1 &&
(fs->fs_flags & FS_FLAGS_UPDATED) == 0) {
- printf("%s: correcting fs_sblockloc from %jd to %d\n",
+ printf("WARNING: %s: correcting fs_sblockloc from %jd to %d\n",
fs->fs_fsmnt, fs->fs_sblockloc, SBLOCK_UFS1);
fs->fs_sblockloc = SBLOCK_UFS1;
}
if (fs->fs_magic == FS_UFS2_MAGIC && fs->fs_sblockloc != SBLOCK_UFS2 &&
(fs->fs_flags & FS_FLAGS_UPDATED) == 0) {
- printf("%s: correcting fs_sblockloc from %jd to %d\n",
+ printf("WARNING: %s: correcting fs_sblockloc from %jd to %d\n",
fs->fs_fsmnt, fs->fs_sblockloc, SBLOCK_UFS2);
fs->fs_sblockloc = SBLOCK_UFS2;
}
More information about the svn-src-all
mailing list