Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Apr 2005 06:38:22 -0700 (PDT)
From:      "ALeine" <aleine@austrosearch.net>
To:        andrit@ukr.net
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: ext2 drives under 5.3 not umounting on reboots 
Message-ID:  <200504181338.j3IDcMWf029681@marlena.vvi.at>

next in thread | raw e-mail | index | archive | help
andrit@ukr.net wrote: 

> I've had the same problem on 5.3.
> now on my FreeBSD 5.4-RC2 #0: Fri Apr 15 11:28:48 EEST 2005 i386
> it seems that problem gone.
> 
> On Sunday 17 April 2005 00:07, c0ldbyte wrote:
> > On Sat, 16 Apr 2005, M. Parsons wrote:
> > 
> > > I have a ext2 linux partition mounted under /linux via the
> > > fstab line:
> > >
> > > /dev/ad2s1	     /linux	     ext2fs  rw 	     1	   2
> > >
> > > It will automount on bootup, but if I do a reboot or shutdown
> > > -h now, it doesnt get umounted properly.  In fact, if this /linux
> > > is mounted, then /, /usr, /var, and /tmp (all seperate ufs slices
> > > on another hard drive) also get tainted during a reboot.

A couple of weeks ago I saw what I believe to be the same problem, but
on 4.10-STABLE. My attempt to umount an ext2 volume resulted in failure
with the "unknown mount type" error message. I then resorted to using
umount -t ext2fs /linux and the volume was unmounted properly,
so as a workaround you could specify umount -t ext2fs explicitly
in rc.shutdown or similar.

I checked the sources in an attempt to find the cause and here is what
I found out:

In src/sbin/umount.c:

RELENG_5:
In umountall():
               /* Ignore unknown file system types. */
               if (getvfsbyname(fs->fs_vfstype, &vfc) == -1)
                       continue;
               if (checkvfsname(fs->fs_vfstype, typelist))
                       continue;
               ...
               rval = umountall(typelist);
               rval = checkname(cp, typelist) || rval;
               free(cp);
               return (rval);
        } while ((fs = getfsent()) != NULL);
        return (0);
}

In checkname():
        if (sfs == NULL) {
                warnx("%s: unknown file system", name);
                return (1);
        }
        if (checkvfsname(sfs->f_fstypename, typelist))
                return (1);
        return (umountfs(sfs));
}

RELENG4:
In umountall():
                /* If an unknown file system type, complain. */
                if (getvfsbyname(fs->fs_vfstype, &vfc) == -1) {
                        warnx("%s: unknown mount type", fs->fs_vfstype);
                        continue;
                }
                if (checkvfsname(fs->fs_vfstype, typelist))
                        continue;
                ...
                rval = umountall(typelist);
                rval = umountfs(cp, typelist) || rval;
                free(cp);
                return (rval);
        } while ((fs = getfsent()) != NULL);
        return (0);
}

As you can see, the RELENG_5 code was changed to call a separate
function named checkname() instead of checking and reporting name
problems directly, but in that process a new check is introduced
in a way that makes it possible for umount(8) to fail without
reporting the reason for failure.

Neither getvfsbyname(3) in src/lib/libc/gen/getvfsbyname.c nor
checkvfsname() in src/sbin/mount/vfslist.c have changed in
significant ways that would indicate they could be at fault,
however there might be a problem with keeping track of filesystem
modules, specifically, fs_vfstype (struct fstab) on RELENG_{4,5}
and/or f_fstypename (struct statfs) on RELENG_5. Any clues?

ALeine
___________________________________________________________________
WebMail FREE http://mail.austrosearch.net 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200504181338.j3IDcMWf029681>