GNOME Bugzilla – Bug 135302
can't burn CDRW when they are already mounted
Last modified: 2004-12-22 21:47:04 UTC
This is a follow-up of Mdk bug http://qa.mandrakesoft.com/show_bug.cgi?id=8071 -get an already burned CDRW -mount it (or have it automouted by magicdev) -try to use ncb to burn on it => ncd complains about invalid media because drive is mounted. Suggestion : grab mount/unmount code from nautilus and unmount drive before starting burning (and remount after burn is done, if medium wasn't ejected)
It seems you need to unmount the CD ONLY with kernel 2.6.x. With kernel 2.4.x, ncb is able to sense media when it is already mounted..
Frederic, it's normal, your 2.4.x kernel tree doesn't have the O_SYNC patch for CD-Rom access. Use a Red Hat-provided 2.4.x kernel, and it will behave just like the 2.6.x kernel. Is umounting the CD before poking it a good idea by you, Alex?
Unmounting might be a good idea. For e.g. the re-write case. It might cause stangeness though, so we need to test it on a few systems first.
Please attach a patch to this report so we can test this out - or point me to where in the code I should hack.
in wait_for_insertion() in nautilus-cd-burner.c, check if the media type is "BUSY", if it is busy, and we're supposed to blank the CD, umount the CD and check again, otherwise through out an error and ask for a blank media (like now).
*** Bug 141467 has been marked as a duplicate of this bug. ***
Created attachment 27532 [details] [review] Patch to do the unmount/mount shuffle for CDRW media This patch does the following: 1) If the 'Erase CD' checkbox is checked, and the CD is busy, unmount the CD drive and try guessing the media type again. 2) If the media was unmounted prior to the burn ('Erase CD' checked), it is re-mounted after the burn completes (either successfully or unsuccessfully). The upshot of this is that if the disc in the drive is not a CDRW, but 'erase cd' is checked, if the user doesn't abort the CD burning, the newly created CDRW will be mounted after the burn finishes. Whether this situation is desirable is questionable, but it is definitely better than the current situation of having to unmount prior to starting the burn. Anyone listening - please test.
Comments on the patch: A lot of spaces before paranthesis in function calls are missing. CD_FLAG_DO_SET and CD_FLAG_DO_CLEAR aren't really necessary, I prefer explicit boolean ops. Also, defining them like that with the brackets can cause problems with nested ifs. (You should wrap with G_STMT_START/G_STMT_END if you need macros like these.) The unmount_disc code looks quite fragile and complicated. There isn't a great way to do this, but a better one than what the patch does would be to compare stat()->st_dev on the device path and the path of the listed volumes. We already have the st_dev for all volumes stored internally in gnome-vfs, so Ideally we should be able to use that.
This is fixed in cvs.
*** Bug 155932 has been marked as a duplicate of this bug. ***