/proc/mounts: still fixed

bs_s641@kingston.ac.uk
Fri, 23 Feb 1996 19:40:56 +0100


Dear Linux Kernel Developers,

I understood now that one should ALWAYS include subject line because not
all people may have enough patience to read all 300-400 messages a day (like
I do.) So here is my third (slightly edited) attempt:

Hi,

I have enclosed the message which I was trying to send during last couple of
days with a trivial patch to fix /proc/mounts problem. I did not quite
understand why it did not make in into linux-kernel mailing list. Is there
such a thing as "moderated" mailing list? Well, that is not the main question.
The question is - is my fix technically wrong? If you have time - please
read the rest of this message. If you are even so kind as to reply that would
be absolutely great!

Thanks alot,
Tigran (bs_s641@ceres.king.ac.uk).

Hi guys,

I have reported to linux-kernel recently a bug which I noticed in 1.3.66
(and is still present in 1.3.68) which made the output from
cat /proc/mounts | grep cdrom look like this:

/dev/hdd /cdrom iso9660 rw 0 0

As you see, /cdrom appears to be mounted rw which is not true. After having
a look in /usr/src/linux/fs/proc/array.c I discovered that the /proc/mounts
is filled in by the results from get_filesystem_info() from fs/super.c. So,
having a look there one can follow all the way to the vfsmntlist being
initialised by add_vfsmnt() which is called by do_mount() which is, in turn,
called by sys_mount() (mount(2) system call). Ok, I patched do_mount() just
a tiny bit: (file fs/super.c, function do_mount(), line 640 )

vfsmnt = add_vfsmnt(dev, dev_name, dir_name);
vfsmnt->mnt_sb = sb;
+ vfsmnt->mnt_flags = flags; /* added to fix /proc/mounts (Tigran) */
sb->s_covered = dir_i;
dir_i->i_mount = sb->s_mounted;

and the /proc/mounts works now ie it shows correct mount flags for cdrom
(and for the rest :) ).

Anyway, please correct me if I am wrong because it all seemed too simple and
whenever something seems too trivial I suspect that I do not have the whole
picture (and therefore, need more learning before presenting my results).

Thanks for your time,
Tigran (bs_s641@ceres.king.ac.uk)