help-hurd
[Top][All Lists]
Advanced

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

e2fsck problem


From: Moritz Schulte
Subject: e2fsck problem
Date: 08 Jun 2001 14:32:47 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi,

i think, i've found the problem in e2fsck from e2fsprogs-1.20, which
doesn't detect the mount state correctly. e2fsck thinks filesystems
are already mounted, though they are not...

There's an additional check, which checks wether the filesystem
('file') is the root filesystem. This check succeeds and the
filesystem is marked as mounted.

Ok, here the problematic code from
e2fsprogs-1.20/lib/ext2fs/ismounted.c:check_mntent_file():

if (mnt == 0) {
        struct stat st_root, st_file;
        /*
         * Do an extra check to see if this is the root device.  We
         * can't trust /etc/fstab, and /proc/mounts will only list
         * /dev/root for the root filesystem.  Argh.  Instead we
         * check if the given device has the same major/minor number
         * as the device that the root directory is on.
         */
        if (stat("/", &st_root) == 0 && stat(file, &st_file) == 0) {
------->        if (st_root.st_dev == st_file.st_rdev) {
this
succeedes
                        *mount_flags = EXT2_MF_MOUNTED;
                        if (mtpt)
                                strncpy(mtpt, "/", mtlen);
                        goto is_root;
                }
        }
        endmntent (f);
        return 0;
}

So, is this broken code or is stat() doing something wrong?  (should
st_rdev be 0?) I'll later look more into this...

HTH, bye,
                moritz
-- 
Moritz Schulte <moritz@chaosdorf.de> http://www.chaosdorf.de/moritz/
Debian/GNU supporter - http://www.debian.org/ http://www.gnu.org/
GPG fingerprint = 3A14 3923 15BE FD57 FC06  B501 0841 2D7B 6F98 4199



reply via email to

[Prev in Thread] Current Thread [Next in Thread]