[SSI-devel] Fun with mount, pmount and eject.
Brought to you by:
brucewalker,
rogertsang
From: John H. <john@Calva.COM> - 2006-11-30 10:34:44
|
Being weird I'm using OpenSSI in an office-type situation. My nodes are on peoples desks and they use them for all the usual office stuff. Works pretty well, but I have some problems with people wanting access to their CD's. First try - make /media a cdsl: lrwxrwxrwx 1 root root 28 2006-07-26 13:26 /media -> /cluster/node{nodenum}/media Stick a line in /etc/fstab: /dev/cdrom /media/cdrom iso9660 users,ro,node=* 0 0 Now a user can try $ mount /dev/cdrom $ grep cdrom /etc/mtab /dev/10/cdrom /media/cdrom iso9660 ro,noexec,nosuid,nodev 0 0 $ grep cdrom /proc/mounts /dev/10/cdrom /cluster/node10/media/cdrom iso9660 ro,nosuid,nodev,noexec 0 0 Looks pretty good, but look at the difference between /etc/mtab and /proc/mounts, in mtab it says "/media/cdrom" while /proc/mounts has the cdsl expanded. What'll happen if two nodes mount a cdrom then one unmounts? Will it get the right entry in /etc/mntab? Turns out not - the algorithm in umount(1) is to remove the last entry for the filesystem being mounted, so if node 6 mounts a cdrom, then node 10 mounts one, then 6 unmounts it's the /etc/mtab entry for node 10 that gets zapped and when node 10 tries to unmount the mount can't be found and everyone is unhapppy. This is pretty easy to fix (patch in a later message), we just have to expand cdsl's when writing them to mtab (or drop mtab and use /proc/mounts - the mount(1) manpage says this causes problems, but I don't see them myself). Another little problem happens on umount: $ umount /media/cdrom Works, 'cos it finds /media/cdrom in mtab $ umount /dev/cdrom umount: /dev/cdrom is not mounted (according to mtab) Failed 'cos it's /dev/10/cdrom in mtab - seems like umount needs a little call to ssi_qualify_dev. Ok, how about pmount? That's sexier than mount and means we don't have to stick lines in /etc/fstab for any and all removeable devices we might want (usb flash & so on). $ pmount -d cdrom cdrom cannot be resolved to a proper device node trying to prepend '/dev/' to device argument, now /cluster/node1/dev/ide/host0/bus0/target0/lun0/cd Error: invalid device /cluster/node1/dev/ide/host0/bus0/target0/lun0/cd (must be in /dev/) Ugly. It's trying to expand the dev symlink itself (with realpath(3)) and getting it pretty badly wrong. Looks like we need some kind of ssi_realpath. And, finaly, what about eject? Nice to unmount and eject the cdrom in one go: $ eject -v eject: using default device `cdrom' eject: device name is `cdrom' eject: expanded name is `/dev/cdrom' eject: `/dev/cdrom' is a link to `/cluster/node1/dev/ide/host0/bus0/target0/lun0/cd' eject: `/dev/10/cdrom' is mounted at `/media/cdrom' eject: unmounting device `/dev/10/cdrom' from `/media/cdrom' Error: invalid device /cluster/node1/media/cdrom (must be in /dev/) eject: unmount of `/media/cdrom' failed Looks like we have some cdsl/ssi_qualify_dev problems here to. I'm working on some patches for these problems, which follow in a later message. |