NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/38448: ffs_vfsops.c:ffs_mount() returns EINVAL in some cases, causing an extra reboot via /etc/rc.d/fsck



>Number:         38448
>Category:       kern
>Synopsis:       ffs_vfsops.c:ffs_mount() returns EINVAL in some cases, causing 
>an extra reboot via /etc/rc.d/fsck
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 16 20:10:00 +0000 2008
>Originator:     Juan RP
>Release:        Latest -current
>Organization:
>Environment:
>Description:
Starting from 1 or 2 months ago (can't remember exactly), the fsck_ffs(8)
binary was changed to return appropiates return codes and then
the /etc/rc.d/fsck continues doing some action.

The problem comes with the following code available in fsck_ffs/main.c:

        if (hotroot()) {
                struct statvfs stfs_buf;
                /*
                 * We modified the root.  Do a mount update on
                 * it, unless it is read-write, so we can continue.
                 */
                if (statvfs("/", &stfs_buf) == 0) {
                        long flags = stfs_buf.f_flag;
                        struct ufs_args args;

                        if (flags & MNT_RDONLY) {
                                args.fspec = 0;
                                flags |= MNT_UPDATE | MNT_RELOAD;
                                if (mount(MOUNT_FFS, "/", flags,
                                    &args, sizeof args) == 0)
                                        return FSCK_EXIT_OK;
                        }
                }
                if (!preen)
                        pwarn("\n***** REBOOT NOW *****\n");
                sync();
                return FSCK_EXIT_ROOT_CHANGED;
        }

The mount(2) syscall returns EINVAL and FSCK_EXIT_ROOT_CHANGED is
returned, then /etc/rc.d/fsck will interpret this as necessary to
issue a reboot(2) call every time the root filesystem is fsck'ed.

The last trace I got from the code is from ffs_vfsops.c:ffs_mount(),
but couldn't track it down due to ENOTIME.


>How-To-Repeat:
1) Push the reset button in your computer
2) Wait until fsck completes checking the root filesystem
3) Your system will be rebooted gratuitously and the other filesystems
   will be checked afterwards.
>Fix:
Dunno, but I'd like to have this fixed... it's very annoying to have
this bug for months and nobody noticed.



Home | Main Index | Thread Index | Old Index