Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ffs - Add debugging for mount...
details: https://anonhg.NetBSD.org/src/rev/6ed050b8256c
branches: trunk
changeset: 805034:6ed050b8256c
user: christos <christos%NetBSD.org@localhost>
date: Sun Dec 14 00:36:07 2014 +0000
description:
- Add debugging for mount...
- Merge some error returns
- Check more errors
diffstat:
sys/ufs/ffs/ffs_vfsops.c | 184 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 139 insertions(+), 45 deletions(-)
diffs (truncated from 451 to 300 lines):
diff -r 092506970cbe -r 6ed050b8256c sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c Sun Dec 14 00:28:46 2014 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c Sun Dec 14 00:36:07 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_vfsops.c,v 1.302 2014/11/14 10:09:50 manu Exp $ */
+/* $NetBSD: ffs_vfsops.c,v 1.303 2014/12/14 00:36:07 christos Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.302 2014/11/14 10:09:50 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.303 2014/12/14 00:36:07 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -120,6 +120,12 @@
/* how many times ffs_init() was called */
int ffs_initcount = 0;
+#ifdef DEBUG_FFS_MOUNT
+#define DPRINTF(a) printf a
+#else
+#define DPRINTF(a) do {} while (/*CONSTCOND*/0)
+#endif
+
extern const struct vnodeopv_desc ffs_vnodeop_opv_desc;
extern const struct vnodeopv_desc ffs_specop_opv_desc;
extern const struct vnodeopv_desc ffs_fifoop_opv_desc;
@@ -346,15 +352,22 @@
int error = 0, flags, update;
mode_t accessmode;
- if (args == NULL)
+ if (args == NULL) {
+ DPRINTF(("%s: NULL args\n", __func__));
return EINVAL;
- if (*data_len < sizeof *args)
+ }
+ if (*data_len < sizeof(*args)) {
+ DPRINTF(("%s: bad size args %zu != %zu\n",
+ __func__, *data_len, sizeof(*args)));
return EINVAL;
+ }
if (mp->mnt_flag & MNT_GETARGS) {
ump = VFSTOUFS(mp);
- if (ump == NULL)
+ if (ump == NULL) {
+ DPRINTF(("%s: no ump\n", __func__));
return EIO;
+ }
args->fspec = NULL;
*data_len = sizeof *args;
return 0;
@@ -368,18 +381,26 @@
* Look up the name and verify that it's sane.
*/
error = namei_simple_user(args->fspec,
- NSM_FOLLOW_NOEMULROOT, &devvp);
- if (error != 0)
- return (error);
+ NSM_FOLLOW_NOEMULROOT, &devvp);
+ if (error != 0) {
+ DPRINTF(("%s: namei_simple_user %d\n", __func__,
+ error));
+ return error;
+ }
if (!update) {
/*
* Be sure this is a valid block device
*/
- if (devvp->v_type != VBLK)
+ if (devvp->v_type != VBLK) {
+ DPRINTF(("%s: non block device %d\n",
+ __func__, devvp->v_type));
error = ENOTBLK;
- else if (bdevsw_lookup(devvp->v_rdev) == NULL)
+ } else if (bdevsw_lookup(devvp->v_rdev) == NULL) {
+ DPRINTF(("%s: can't find block device 0x%jx\n",
+ __func__, devvp->v_rdev));
error = ENXIO;
+ }
} else {
/*
* Be sure we're still naming the same device
@@ -387,9 +408,13 @@
*/
ump = VFSTOUFS(mp);
if (devvp != ump->um_devvp) {
- if (devvp->v_rdev != ump->um_devvp->v_rdev)
+ if (devvp->v_rdev != ump->um_devvp->v_rdev) {
+ DPRINTF(("%s: wrong device 0x%jx"
+ " != 0x%jx\n", __func__,
+ (uintmax_t)devvp->v_rdev,
+ (uintmax_t)ump->um_devvp->v_rdev));
error = EINVAL;
- else {
+ } else {
vrele(devvp);
devvp = ump->um_devvp;
vref(devvp);
@@ -399,7 +424,8 @@
} else {
if (!update) {
/* New mounts must have a filename for the device */
- return (EINVAL);
+ DPRINTF(("%s: no filename for mount\n", __func__));
+ return EINVAL;
} else {
/* Use the extant mount */
ump = VFSTOUFS(mp);
@@ -426,6 +452,9 @@
error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
KAUTH_REQ_SYSTEM_MOUNT_DEVICE, mp, devvp,
KAUTH_ARG(accessmode));
+ if (error) {
+ DPRINTF(("%s: kauth %d\n", __func__, error));
+ }
VOP_UNLOCK(devvp);
}
@@ -453,10 +482,13 @@
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_OPEN(devvp, xflags, FSCRED);
VOP_UNLOCK(devvp);
- if (error)
+ if (error) {
+ DPRINTF(("%s: VOP_OPEN %d\n", __func__, error));
goto fail;
+ }
error = ffs_mountfs(devvp, mp, l);
if (error) {
+ DPRINTF(("%s: ffs_mountfs %d\n", __func__, error));
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
(void)VOP_CLOSE(devvp, xflags, NOCRED);
VOP_UNLOCK(devvp);
@@ -497,17 +529,21 @@
fs->fs_clean = FS_ISCLEAN;
(void) ffs_sbupdate(ump, MNT_WAIT);
}
- if (error == 0)
- UFS_WAPBL_END(mp);
- if (error)
- return (error);
+ if (error) {
+ DPRINTF(("%s: wapbl %d\n", __func__, error));
+ return error;
+ }
+ UFS_WAPBL_END(mp);
}
#ifdef WAPBL
if ((mp->mnt_flag & MNT_LOG) == 0) {
error = ffs_wapbl_stop(mp, mp->mnt_flag & MNT_FORCE);
- if (error)
+ if (error) {
+ DPRINTF(("%s: ffs_wapbl_stop %d\n",
+ __func__, error));
return error;
+ }
}
#endif /* WAPBL */
@@ -521,8 +557,11 @@
if (mp->mnt_flag & MNT_RELOAD) {
error = ffs_reload(mp, l->l_cred, l);
- if (error)
- return (error);
+ if (error) {
+ DPRINTF(("%s: ffs_reload %d\n",
+ __func__, error));
+ return error;
+ }
}
if (fs->fs_ronly && (mp->mnt_iflag & IMNT_WANTRDWR)) {
@@ -536,6 +575,8 @@
mp->mnt_stat.f_mntonname,
(mp->mnt_flag & MNT_FORCE) ? "" :
", not mounting");
+ DPRINTF(("%s: ffs_quota2 %d\n",
+ __func__, EINVAL));
return EINVAL;
}
#endif
@@ -550,6 +591,8 @@
error = wapbl_replay_write(mp->mnt_wapbl_replay,
devvp);
if (error) {
+ DPRINTF(("%s: wapbl_replay_write %d\n",
+ __func__, error));
return error;
}
wapbl_replay_stop(mp->mnt_wapbl_replay);
@@ -562,14 +605,19 @@
#ifdef WAPBL
error = ffs_wapbl_start(mp);
- if (error)
+ if (error) {
+ DPRINTF(("%s: ffs_wapbl_start %d\n",
+ __func__, error));
return error;
+ }
#endif /* WAPBL */
#ifdef QUOTA2
if (!fs->fs_ronly) {
error = ffs_quota2_mount(mp);
if (error) {
+ DPRINTF(("%s: ffs_quota2_mount %d\n",
+ __func__, error));
return error;
}
}
@@ -587,6 +635,9 @@
if (error == 0)
(void)strncpy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname,
sizeof(fs->fs_fsmnt));
+ else {
+ DPRINTF(("%s: set_statvfs_info %d\n", __func__, error));
+ }
fs->fs_flags &= ~FS_DOSOFTDEP;
if (fs->fs_fmod != 0) { /* XXX */
int err;
@@ -877,8 +928,10 @@
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
error = vinvalbuf(devvp, V_SAVE, cred, l, 0, 0);
VOP_UNLOCK(devvp);
- if (error)
- return (error);
+ if (error) {
+ DPRINTF(("%s: vinvalbuf %d\n", __func__, error));
+ return error;
+ }
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
@@ -889,14 +942,18 @@
fstype = 0;
error = fstrans_mount(mp);
- if (error)
+ if (error) {
+ DPRINTF(("%s: fstrans_mount %d\n", __func__, error));
return error;
+ }
ump = kmem_zalloc(sizeof(*ump), KM_SLEEP);
mutex_init(&ump->um_lock, MUTEX_DEFAULT, IPL_NONE);
error = ffs_snapshot_init(ump);
- if (error)
+ if (error) {
+ DPRINTF(("%s: ffs_snapshot_init %d\n", __func__, error));
goto out;
+ }
ump->um_ops = &ffs_ufsops;
#ifdef WAPBL
@@ -911,18 +968,22 @@
bp = NULL;
}
if (sblock_try[i] == -1) {
+ DPRINTF(("%s: sblock_try\n", __func__));
error = EINVAL;
fs = NULL;
goto out;
}
- error = bread(devvp, sblock_try[i] / DEV_BSIZE, SBLOCKSIZE, cred,
- 0, &bp);
+ error = bread(devvp, sblock_try[i] / DEV_BSIZE, SBLOCKSIZE,
+ cred, 0, &bp);
if (error) {
+ DPRINTF(("%s: bread@0x%x %d\n", __func__,
+ sblock_try[i] / DEV_BSIZE, error));
fs = NULL;
goto out;
}
fs = (struct fs*)bp->b_data;
fsblockloc = sblockloc = sblock_try[i];
+ DPRINTF(("%s: fs_magic 0x%x\n", __func__, fs->fs_magic));
if (fs->fs_magic == FS_UFS1_MAGIC) {
sbsize = fs->fs_sbsize;
fstype = UFS1;
@@ -1003,8 +1064,11 @@
#ifdef WAPBL
if ((mp->mnt_wapbl_replay == 0) && (fs->fs_flags & FS_DOWAPBL)) {
error = ffs_wapbl_replay_start(mp, fs, devvp);
- if (error && (mp->mnt_flag & MNT_FORCE) == 0)
+ if (error && (mp->mnt_flag & MNT_FORCE) == 0) {
+ DPRINTF(("%s: ffs_wapbl_replay_start %d\n", __func__,
+ error));
goto out;
+ }
if (!error) {
Home |
Main Index |
Thread Index |
Old Index