Opened 12 years ago

Closed 12 years ago

#4455 closed defect (fixed)

isMount() bug in MediaMonitor

Reported by: stuartm Owned by:
Priority: minor Milestone: unknown
Component: mythtv Version: head
Severity: high Keywords:
Cc: Ticket locked: no

Description

MythMediaDevice::isMounted compares the device name for our mount against the list in the mounts file. However it doesn't account for symlinks between devices.

/dev/cdrom is symlinked to /dev/hdc /dev/cdrom is mounted to /mnt/cdrom, but the mounts file shows /dev/hdc => /mnt/cdrom

isMounted() looks for /dev/cdrom and can't find it, so fails. The MediaMonitor? then gets stuck in a loop trying but constantly failing to mount the device.

Change History (6)

comment:1 Changed 12 years ago by Nigel

Owner: changed from Isaac Richards to Nigel
Status: newaccepted

Amazing - I have been testing hard for a few days, but haven't seen that one yet!
Looks simple enough. Hopefully I can fix it without breaking too much else :-) There are a few other places where device symlinks should be followed, so I will add something to the base object.

comment:2 Changed 12 years ago by Nigel

(In [15412]) Remove un-needed setBlah() methods, whitespace/line-wrap/Doxygen changes, device path symlink stuff. See #4455

comment:3 Changed 12 years ago by Nigel

(In [15415]) Use media device object's symlink for looking up drive model (fixes un-noticed bug for /dev/cdrom -> hdc). See #4455. Also adds -v media to list initial drive list in Unix/Win? media monitors

comment:4 Changed 12 years ago by Nigel

Owner: Nigel deleted
Status: acceptednew

I haven't reproduced the original problem yet. My test machine does:

% ls -l /dev/cdrom
lrwxrwxrwx 1 root root 3 Jan  8 13:18 /dev/cdrom -> hdc

% mount /dev/cdrom

% egrep cd /proc/mounts
/dev/cdrom /cdrom iso9660 ro,nosuid,nodev,noexec 0 0

but that is different from the described behavior (/dev/hdc in mounts).
As far as I can tell, isMounted() does process symlinks (and put them into an unneeded variable deviceNames). Sorry Stuart, I might need some -v media output, fstab, /proc/mounts before and during mythfrontend, et c.

comment:5 Changed 12 years ago by Nigel

With a manual mount command line, can reproduce:

% sudo mount /dev/hdc /media 
mount: block device /dev/hdc is write-protected, mounting read-only

% egrep cdrom /proc/mounts
/dev/hdc /cdrom iso9660 ro,nosuid,nodev,noexec 0 0

but that doesn't cause any looping, because mythfrontend will just create a second mount which corresponds to the paths in /etc/fstab. I will add some extra symlink checking in isMounted(). but I have no idea if this fixes the reported problem.

comment:6 Changed 12 years ago by Nigel

Resolution: fixed
Status: newclosed

(In [15446]) More isMounted() tweaking - check if device or its symlink matches the current mounts or their symlink (hopefully Closes #4455), other tiny code reorgs

Note: See TracTickets for help on using tickets.