I have reported to linux-kernel recently a bug which I noticed in 1.3.66
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 nonsence. 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 :) ).
Oh please, dont tell me it was already fixed - it was the first attempt to fix
a kernel bug in my life :)
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)