Bug 273792

Summary: KDE should mount USB sticks with the "flush" option
Product: [Unmaintained] solid Reporter: Christopher Martin <chrsmrtn>
Component: libsolid-udisksAssignee: Lukáš Tinkl <lukas>
Status: RESOLVED FIXED    
Severity: major CC: aidanamarks, andreas_nordal_4, anti.hoch, cesarg9, kamil.kuduk, lukas, magnus, martinzecher, olivier.keshavjee, orion, pdgiddie+kde, reflexing, sergio, sven.burmeister, ulilicht, wadlax, wilderkde
Priority: NOR Keywords: regression
Version: unspecified   
Target Milestone: ---   
Platform: Debian unstable   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Christopher Martin 2011-05-21 15:13:37 UTC
Version:           unspecified (using KDE 4.6.2) 
OS:                Linux

With KDE 4.6 (udisks back-end), USB sticks formatted with vfat are not mounted using the "flush" mount option. "Flush" tells the system to commit writes more-or-less immediately. Without it, few writes take place until eject, which takes time and often leads users to pull out the USB stick when they see the "can be safely removed" message, even though writing continues...

KDE mounted USB sticks with "flush" when it used HAL, so this feature really should be carried over to the udisks backend.

Thanks.

Reproducible: Always

Steps to Reproduce:
1. Insert vfat-formatted USB stick and mount with KDE 4.6's device notifier.

Actual Results:  
cat /etc/mtab

Note the absence of "flush" mount option, and observe how copying large files to the USB stick only seems to result in activity when you try to eject the stick.

Expected Results:  
KDE should tell udisks to mount USB sticks with "flush", permitting safer and less annoying file management.
Comment 1 Martti Laaksonen 2011-05-23 21:00:45 UTC
I, too, would like to see this fixed.

The lack of using sync (or flush) option when mounting USB flash device (a mobile phone in my case) has bitten me a couple of times when I've just copied some new music from my library to my phone. 

After clicking eject button in device notifier and getting the confirmation that the device can be removed, I disconnected it only to find out that only some of the files had actually been copied at that point, the rest showed size of 0 bytes.

At the moment I've resorted to run sync from a terminal a couple of times before clicking on eject button.

How come device notifier displays the safe to remove notification before all the data has been flushed to device?
Comment 2 Ulrich Lichtenegger 2011-08-15 08:18:59 UTC
hi, 

i really would like to see this fixed - this behaviour is verry annoying, 

especially in combination with this bug: 
https://bugs.kde.org/show_bug.cgi?id=270703

(when you remove a device, the device notifier tries to unmount it for 30 seconds. if the writeback takes longer, an error message is shown and the device is marked as unmounted even it is not. )

but nevertheless i would prefer to use external devices with the flush or sync option.
Comment 3 Andreas Nordal 2012-01-24 23:36:26 UTC
> especially in combination with bug 270703
+1

If data loss is your worry, vote for bug 270703.
If you want fast unmounting, vote for this.

sync  = no buffering
flush = write buffers back as fast as possible
async = keep buffers in memory for as long as possible (current behavior)

Sync just destroys flash memory formatted with FAT.
The excessive write buffering permitted by async causes long unmount time.
Flush is a good compromise made for the purpose of portable memory. Given that we trust the kernel devs, it takes an excuse not to use it.
Comment 4 S. Burmeister 2012-02-10 11:23:21 UTC
*** Bug 196015 has been marked as a duplicate of this bug. ***
Comment 5 Sérgio Basto 2012-04-22 16:10:17 UTC
Hi, yes mounting usb sticks with vfat without flush is bad.
I'd like know how I force flush option in udisks ? 
or an workaround 

Tks,
Comment 6 Ulrich Lichtenegger 2012-04-22 16:21:28 UTC
+1

(In reply to comment #5)
> Hi, yes mounting usb sticks with vfat without flush is bad.
> I'd like know how I force flush option in udisks ? 
> or an workaround 
> 
> Tks,
Comment 7 Sérgio Basto 2012-04-22 22:41:18 UTC
https://bugs.kde.org/show_bug.cgi?id=202738 says that has been fixed for 4.3 branch and HAL !
Comment 8 Ulrich Lichtenegger 2012-04-22 22:49:36 UTC
without knowing anything about HAL or Device Kit - this bug exists for me on kubuntu 11.10. Maybe it has something todo with HAL beeing replaced by devicekit in ubuntu? 

can reproduce the bug with kde 4.8.2 on kubuntu oneiric
Comment 9 Andreas Nordal 2012-05-14 22:02:02 UTC
(In reply to comment #7)
> bug 202738 says that has been fixed for 4.3 branch and HAL !

…so the fix should have landed in KDE 4.6 by now, if this is not due to a new problem. So don't hold your breath. But your link makes this bug smell of regression. Nice finding.
Comment 10 Lukáš Tinkl 2012-06-12 10:28:57 UTC
Git commit 6f8a052881ac699ff2cc4917b32f4620c599a24f by Lukas Tinkl.
Committed on 12/06/2012 at 12:28.
Pushed by lukas into branch 'KDE/4.8'.

UDisks mount vfat filesystems with flush option

REVIEW:105224

M  +6    -1    solid/solid/backends/udisks/udisksstorageaccess.cpp

http://commits.kde.org/kdelibs/6f8a052881ac699ff2cc4917b32f4620c599a24f
Comment 11 Lukáš Tinkl 2012-06-12 11:40:58 UTC
Git commit ed48a828c095534d79727aa29f4d702ea251c84f by Lukas Tinkl.
Committed on 12/06/2012 at 13:39.
Pushed by lukas into branch 'frameworks'.

UDisks mount vfat filesystems with flush option

done on both udisks backends

M  +6    -1    tier1/solid/src/solid/backends/udisks/udisksstorageaccess.cpp
M  +5    -1    tier1/solid/src/solid/backends/udisks2/udisksstorageaccess.cpp

http://commits.kde.org/kdelibs/ed48a828c095534d79727aa29f4d702ea251c84f
Comment 12 S. Burmeister 2012-06-12 14:27:37 UTC
Thanks a lot! What KDE release will contain the fix?
Comment 13 Lukáš Tinkl 2012-06-12 14:45:31 UTC
Anything that comes after 4.8.4 (4.8.5? and/or 4.9)
Comment 14 Lukáš Tinkl 2012-08-17 21:18:39 UTC
Git commit 79066a6dd7b9046b5047bc6688d170dea4560380 by Lukas Tinkl.
Committed on 12/06/2012 at 13:39.
Pushed by nalvarez into branch 'KDE/4.10'.

UDisks mount vfat filesystems with flush option

done on both udisks backends

(commit extracted from ed48a828c095534d79727aa29f4d702ea251c84f)

M  +5    -1    solid/solid/backends/udisks2/udisksstorageaccess.cpp

http://commits.kde.org/kdelibs/79066a6dd7b9046b5047bc6688d170dea4560380
Comment 15 Ulrich Lichtenegger 2012-08-18 08:47:44 UTC
Thank you very much! fix already arrived in my distro/ppa (Kubuntu 12.04, Kde 4.9.0, Kubuntu-Backports Repository)
Comment 16 Martin Zecher 2012-08-18 17:28:25 UTC
Finally! Working fine in ArcLinux with KDE 4.9.0
Comment 17 Martin Zecher 2012-08-18 17:29:01 UTC
Finally! Working fine in ArchLinux with KDE 4.9.0
Comment 18 reflexing 2013-12-23 08:44:15 UTC
I think exfat should be mounted with flush option too. Maybe reopen the bug?
Comment 19 reflexing 2013-12-23 09:03:40 UTC
I see that Udisks has the property to check if device is removable:
org.freedesktop.UDisks2.Drive:    Removable:                  true

Maybe it's worth to mount all filesystems on removable drives with flush option? Or at least make it configurable somewhere via KCM?..
Comment 20 reflexing 2013-12-23 17:23:53 UTC
Looks like there are no flush option for exfat-fuse. Sorry for the noise.