Project

General

Profile

Actions

Bug #1253

closed

mount -p reports bogus errors in chroot

Added by corecode almost 16 years ago. Updated almost 16 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

% mount -p
/dev/vinum/root / ufs rw 1 1
/dev/vinum/tmp /tmp ufs rw 2 2
/dev/vinum/var /var ufs rw 2 2
/dev/vinum/home /home ufs rw 2 2
/dev/vinum/usr /usr ufs rw 2 2
/dev/vinum/usrobj /usr/obj ufs rw 2 2
procfs /proc procfs rw 0 0
/dev/vinum/jail_serve /jail/serve ufs rw 2 2
/dev/vinum/jail_serve_repos /jail/serve/home/repos ufs rw,noatime 2 2
/dev/vinum/jail_serve_ftp /jail/serve/home/ftp ufs rw,noatime 2 2
/dev/vinum/jail_isobuild /jail/isobuild ufs rw,noatime 2 2
/dev/vinum/jail_isobuild_data /jail/isobuild/home/chroot ufs rw,noatime 2 2
/jail/serve/home/repos /jail/isobuild/home/repos null ro,noatime 0 0
/usr/pkgsrc /jail/isobuild/home/chroot/chroot/usr/release/root/usr/pkgsrc
null rw 0 0

% sudo chroot /jail/isobuild /bin/tcsh
  1. mount -p
    fstab: /etc/fstab:0: No such file or directory
    fstab: /etc/fstab:0: No such file or directory
    /dev/vinum/jail_isobuild / ufs rw,noatime 1 1
    fstab: /etc/fstab:0: No such file or directory
    fstab: /etc/fstab:0: No such file or directory
    /dev/vinum/jail_isobuild_data /home/chroot ufs rw,noatime 2 2
    fstab: /etc/fstab:0: No such file or directory
    fstab: /etc/fstab:0: No such file or directory
    /jail/serve/home/repos /home/repos null ro,noatime 0 0
    fstab: /etc/fstab:0: No such file or directory
    fstab: /etc/fstab:0: No such file or directory
    /usr/pkgsrc /home/chroot/chroot/usr/release/root/usr/pkgsrc null rw 0 0
  1. mount
    /dev/vinum/jail_isobuild on / (ufs, local, noatime, soft-updates)
    /dev/vinum/jail_isobuild_data on /home/chroot (ufs, local, noatime, soft-updates)
    /jail/serve/home/repos on /home/repos (null, local, noatime, read-only)
    /usr/pkgsrc on /home/chroot/chroot/usr/release/root/usr/pkgsrc (null, local)
Actions #1

Updated by Anonymous almost 16 years ago

jail(8) says that you must create an empty /etc/fstab to suppress the warnings:

"Create an empty /etc/fstab to quell startup warnings about missing fstab"

Indeed:
  1. mount -p
    fstab: /etc/fstab:0: No such file or directory
    fstab: /etc/fstab:0: No such file or directory
    /dev/ad0s3f / ufs rw 1 1
  2. touch /etc/fstab
  3. mount -p
    /dev/ad0s3f / ufs rw 1 1 #

sjg at #drafonflybsd suggested that a "fix" (if agree there is a need for one)
woule be to only check for fstab once; if it doesn't exist, print an error, and
fall back to the non- "p" case.

What do you think ?

Actions #2

Updated by corecode almost 16 years ago

I don't think it should print a warning at all. This is not the time and
place to print a totally unrelated warning.

cheers
simon

Actions #3

Updated by Anonymous almost 16 years ago

One could ask why mount -p needs /etc/fstab to list the already mounted
filesystems. This happens because device block name, mount point and mount flags
are stored inside the statfs structure (which is returned by getfsstat syscall),
but dump frequency and pass number of fsck are not. This means that mount -p
must open /etc/fstab, parse the lines and get the desired values for every
mounted filesystem.

Thats why simon you get 2 warnings for every mounted filesystem. One while
looking for freq and another one for passno.

The code path that interests us is I think the following:

for every mounted filesystem
---> putfsent
--------> getfsspec
--------------> setfsent [ opens etc/fstab, prints warning ]
--------> getfsfile
--------------> setfsent [ opens etc/fstab, prints warning ]

The reason that freq and passno values are printed, is that there are some
fallback values in the code.

Honestly I don't know how to fix this. The code is messy enough as it is and
adding more cornerstones would make it worse.

Regards,
Stathis

Actions #4

Updated by Anonymous almost 16 years ago

Alright, I am working on a patch. I'll let you know.

Actions #6

Updated by Anonymous almost 16 years ago

Updated patch, based on discussion with Simon in #dragonflybsd

http://stathisk.ath.cx/0001-Silent-mount-p-when-there-is-no-fstab-file.patch

Actions #7

Updated by dillon almost 16 years ago

:Stathis Kamperis <> added the comment:
:
:Updated patch, based on discussion with Simon in #dragonfly
:
:http://stathisk.ath.cx/0001-Silent-mount-p-when-there-is-no-fstab-file.patch

Looks reasonable, but please put in matching braces.  If either
part of an if statement sequence uses a braced block then both
parts should use a braced block. Just semantics but it makes the
code more readable.
-Matt
Matthew Dillon
&lt;&gt;
Actions #8

Updated by Anonymous almost 16 years ago

Thanks for the feedback.

Matching braces added. Updated patch in the same link as before.

Actions #9

Updated by dillon almost 16 years ago

:Stathis Kamperis <> added the comment:
:
:Updated patch, based on discussion with Simon in #dragonflybsd
:
:http://stathisk.ath.cx/0001-Silent-mount-p-when-there-is-no-fstab-file.patch

Looks good, I will commit it on Tuesday.
-Matt
Matthew Dillon
&lt;&gt;
Actions #10

Updated by corecode almost 16 years ago

committed as 3e5c58ea9fae3002473278841dec7b456daffe95

Actions

Also available in: Atom PDF