[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#255128: cdrom-detect: Bad handling of mount error



Hi,

Now this patch should be even better.

On Sat, Jun 19, 2004 at 10:15:14AM +1000, Vincent McIntyre wrote:
> thanks for that careful analysis, Osamu.
> I have very similar hardware and it appears the problem may also be
> avoidable by configuring the kernel to not use DMA on cdroms.
> See bugs #250323 (and referenced therein #222939.b)
> Your solution is probably the least intrusive however.
> If this patch is applied I would be happy to try it out as well.

This prompted me to look in what really happening in stage 1 phase
when CDROM is mounted.

After couple learning experience, I now can build CD with modified
initrd :-)  (See http://people.debian.org/~osamu/hackdi/ )

I changed cdrom-detect.postinst as:

--- cdrom-detect.postinst.org	1970-01-01 01:00:00.000000000 +0100
+++ cdrom-detect.postinst	2004-06-22 23:11:21.000000000 +0200
@@ -40,11 +40,28 @@
     fi
     for device in $devices
     do
-        if mount -t iso9660 -o ro,exec $device /cdrom 2>/dev/null
+        if mount -v -t iso9660 -o ro,exec $device /cdrom >>error.log 2>&1
         then
             mounted=1
 	    db_set cdrom-detect/cdrom_device $device
             break
+        else
+            echo "ERROR_1=$?" >>/error.log
+            umount -v /cdrom >>/error.log 2>&1 || true
+            echo "=== UMOUNT 1 finished ===" >>/error.log
+            echo "=== SLEEP 1 ===" >>/error.log
+            sleep 1 >>/error.log || true
+            echo "=== SLEEP OVER ===" >>/error.log
+            if mount -v -t iso9660 -o ro,exec $device /cdrom >>/error.log 2>&1
+            then
+                mounted=1
+	        db_set cdrom-detect/cdrom_device $device
+                break
+            else
+            echo "ERROR_2=$?" >>/error.log
+            umount -v /cdrom >>/error.log 2>&1 || true
+            echo "=== UMOUNT 2 finished ===" >>/error.log
+            fi
         fi
     done
 
-------------

Idea was to read error output as much and any DMA error which trigger
kernel to reset CDROM Disk IO as PIO mode should automatically fix
issues.  I added 1 second just be sure that kernel reset is complete.

Alas, this worked without flaw.  Here is the error.log file:
--------------
mount: Mounting /dev/cdroms/cdrom0 on /cdrom failed: Not a directory
ERROR_1=1
umount: /cdrom: Invalid argument
=== UMOUNT 1 finished ===
=== SLEEP 1 ===
=== SLEEP OVER ===
----------------

I guess first read action produce error in Kernel and mount complain.
Second try succeed since it is in PIO mode.

ERROR=1 means incorrect invocation or permissions

Applying above patch should give releaf to many old DELL users. Of
course we should do some code clean up such as redirecting output to
/dev/null instead.

Osamu

Attachment: signature.asc
Description: Digital signature


Reply to: