Bug 202738 - Mounting removable media without flush option
Summary: Mounting removable media without flush option
Status: RESOLVED FIXED
Alias: None
Product: solid
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Kevin Ottens
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-06 02:37 UTC by Denis Falqueto
Modified: 2009-08-12 01:36 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Falqueto 2009-08-06 02:37:11 UTC
Version:            (using KDE 4.3.0)
Compiler:          GCC 4.4.1 
OS:                Linux
Installed from:    Unlisted Binary Package

When I mount my usb drive, which is formatted with vfat, KDE doesn't mount it with the option flush, even though hal is configured to inform that option. The hal version I'm using is 0.5.13 and the stock configuration file /usr/share/hal/fdi/policy/10osvender/20-storage-methods.fdi indicates that at line 191. 

The flush option allows a better handling for removable media, because it doesn't use so much the disk cache and the umounting is faster.
Comment 1 Denis Falqueto 2009-08-06 06:03:14 UTC
I got a solution (two, in fact...)

In kdelibs/solid/solid/backends/hal/halstorageaccess.cpp, the function StorageAccess::callHalVolumeMount() is responsible to fetch the options from hal and submit the dbus method call to the hal service that really mounts the device.

That function has the following logic: fetch the volume.mount.valid_options from hal; trat some special options and put them in a variable called options; call the dbus method with the options variable, instead of the halOptions, which came from hal configuration.

So, there're two possibilities for the solution:

1. instead of creating a separated list (variable options), we could just update the halOptions to change the special cases. 

2. add another special case just for the flush option if it is present in halOptions.

I think the ideal solution would be 1, _BUT_ I toke the time to implement it and, for my surprise, it doesn't work because hal refuses to mount the devices with the stock options that it supplies :). It kept claiming that it was not possible to remount the device because it was not already mounted. In fact, theres an valid_options entry that says to put a remove option, but the hal code that implements the mounting refuses to remount it if is not mounted. Fair enough, but the stock configuration should be more smart...

I tested the second solution and it works very well, in spite of being very narrow minded. I just put

	if (halOptions.contains("flush"))
	    options<<"flush";

just below the lines 

    if (fstype=="vfat" || fstype=="ntfs" || fstype=="iso9660" || fstype=="udf" ) {
        if (halOptions.contains("utf8"))
            options<<"utf8";
        else if (halOptions.contains("iocharset="))
            options<<"iocharset=utf8";
        if (halOptions.contains("shortname="))
            options<<"shortname=mixed";

so that it does the job and calls it a day. The result is very pleasing, because the task progress doesn't stop before the actual transfer to/from the pendrive stops.

Maybe a solution in betwen would be to use halOptinos from the hal configuration, treat the special cases and remove the remount option. I didn't test that solution, but I think it would be very balanced, so we could use the hal configuration to get flexibility and would not be plagued by that crazy option. Or a best solution would be to get in touch with the hal developers and ask them to make a better configuration.

What do you think?
Comment 2 Kevin Ottens 2009-08-11 17:09:24 UTC
SVN commit 1010071 by ervin:

Add the flush option for mounting devices when supported.

BUG: 202738


 M  +2 -0      halstorageaccess.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1010071
Comment 3 Kevin Ottens 2009-08-11 17:11:16 UTC
SVN commit 1010073 by ervin:

Add the flush option for mounting devices when supported.

(Backport from r1010071, seems harmless enough to go into
4.3 branch as well).

CCBUG: 202738


 M  +2 -0      halstorageaccess.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1010073