[frameworks-solid] [Bug 467751] Unmounting certain SD cards can triggers an immediate remount when using "automount on attach" setting

2023-06-21 Thread David Edmundson
https://bugs.kde.org/show_bug.cgi?id=467751

--- Comment #12 from David Edmundson  ---
Git commit 41eaa14d3375e303e68e0d2f39090f5ed4f48c82 by David Edmundson.
Committed on 21/06/2023 at 10:45.
Pushed by davidedmundson into branch 'master'.

Expose StorageDevice timeDetected/timeMediaDetected

For automounting purposes it's useful to know when a drive appeared in
relation to when StorageVolumes appear.

Rather than adding tracking in front-end code we can make use of udisk's
existing information.

M  +10   -0src/solid/devices/backends/fakehw/fakestorage.cpp
M  +3-0src/solid/devices/backends/fakehw/fakestorage.h
M  +20   -0src/solid/devices/backends/udisks2/udisksstoragedrive.cpp
M  +3-0src/solid/devices/backends/udisks2/udisksstoragedrive.h
M  +12   -0src/solid/devices/frontend/storagedrive.cpp
M  +21   -0src/solid/devices/frontend/storagedrive.h
M  +10   -0src/solid/devices/ifaces/storagedrive.cpp
M  +12   -0src/solid/devices/ifaces/storagedrive.h

https://invent.kde.org/frameworks/solid/-/commit/41eaa14d3375e303e68e0d2f39090f5ed4f48c82

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-solid] [Bug 467751] Unmounting certain SD cards can triggers an immediate remount when using "automount on attach" setting

2023-04-12 Thread Alberto Garcia
https://bugs.kde.org/show_bug.cgi?id=467751

--- Comment #11 from Alberto Garcia  ---
There's one more thing to take into account with the "5 seconds since plugged"
heuristic: the case when the volume was present at coldplug (i.e. it was
already there when the session started).

Related links for the GNOME implementation:

https://gitlab.gnome.org/GNOME/gvfs/-/commit/e30a67f3215d829e95ee7e358c67af7d67635fe8

https://bugzilla.redhat.com/show_bug.cgi?id=813069

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-solid] [Bug 467751] Unmounting certain SD cards can triggers an immediate remount when using "automount on attach" setting

2023-03-31 Thread Alberto Garcia
https://bugs.kde.org/show_bug.cgi?id=467751

--- Comment #10 from Alberto Garcia  ---
(In reply to Stefan Brüns from comment #9)
> According to the strace output, the drive supports none of the four
> attempted methods of eject, i.e. the ioctl's 'CDROM_LOCKDOOR', 'SG_IO(...)',
> 'FDEJECT' and 'MTIOCTOP'.

FWIW the same happens with QEMU's virtual SD card reader (the strace output I
attached earlier is from actual hardware).

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-solid] [Bug 467751] Unmounting certain SD cards can triggers an immediate remount when using "automount on attach" setting

2023-03-31 Thread Stefan Brüns
https://bugs.kde.org/show_bug.cgi?id=467751

--- Comment #9 from Stefan Brüns  ---
According to the strace output, the drive supports none of the four attempted
methods of eject, i.e. the ioctl's 'CDROM_LOCKDOOR', 'SG_IO(...)', 'FDEJECT'
and 'MTIOCTOP'.

I can confirm the behavior by issuing e.g. 'eject -f ...', as FDEJECT is not
supported by my card reader (it supports the SCSI ioctl) I also get the UDEV
REMOVED/CHANGED/ADDED sequence.

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-solid] [Bug 467751] Unmounting certain SD cards can triggers an immediate remount when using "automount on attach" setting

2023-03-31 Thread Alberto Garcia
https://bugs.kde.org/show_bug.cgi?id=467751

--- Comment #8 from Alberto Garcia  ---
Created attachment 157742
  --> https://bugs.kde.org/attachment.cgi?id=157742=edit
strace output

The strace output is attached. Here's the output of the eject and monitor
commands:

# /usr/bin/eject /dev/mmcblk0; echo $? 
eject: unable to eject
1


# udisksctl monitor
Monitoring the udisks daemon. Press Ctrl+C to exit.
15:43:49.633: The udisks-daemon is running (name-owner :1.29).
15:43:50.504: Removed /org/freedesktop/UDisks2/block_devices/mmcblk0p1
15:43:50.538: /org/freedesktop/UDisks2/block_devices/mmcblk0:
org.freedesktop.UDisks2.PartitionTable: Properties Changed
  Partitions:   
15:43:50.629: Added /org/freedesktop/UDisks2/block_devices/mmcblk0p1
  org.freedesktop.UDisks2.Block:
Configuration:  []
CryptoBackingDevice:'/'
Device: /dev/mmcblk0p1
DeviceNumber:   45825
Drive: 
'/org/freedesktop/UDisks2/drives/SL16G_0x8c9ed258'
HintAuto:   true
HintIconName:   
HintIgnore: false
HintName:   
HintPartitionable:  true
HintSymbolicIconName:   
HintSystem: false
Id: by-uuid-9019398f-1e38-4f69-bca4-6feb56d98ed7
IdLabel:SD_CARD
IdType: ext4
IdUUID: 9019398f-1e38-4f69-bca4-6feb56d98ed7
IdUsage:filesystem
IdVersion:  1.0
MDRaid: '/'
MDRaidMember:   '/'
PreferredDevice:/dev/mmcblk0p1
ReadOnly:   false
Size:   15929966592
Symlinks:   /dev/disk/by-id/mmc-SL16G_0x8c9ed258-part1
/dev/disk/by-label/SD_CARD
/dev/disk/by-partlabel/primary
   
/dev/disk/by-partuuid/679ecb89-c2df-4e55-ac6a-e8be61e2709d
   
/dev/disk/by-uuid/9019398f-1e38-4f69-bca4-6feb56d98ed7
UserspaceMountOptions:  
  org.freedesktop.UDisks2.Filesystem:
MountPoints:
Size:   15929966592
  org.freedesktop.UDisks2.Partition:
Flags:  0
IsContained:false
IsContainer:false
Name:   primary
Number: 1
Offset: 1048576
Size:   15929966592
Table:  '/org/freedesktop/UDisks2/block_devices/mmcblk0'
Type:   0fc63daf-8483-4772-8e79-3d69d8477de4
UUID:   679ecb89-c2df-4e55-ac6a-e8be61e2709d
15:43:50.629: /org/freedesktop/UDisks2/block_devices/mmcblk0:
org.freedesktop.UDisks2.PartitionTable: Properties Changed
  Partitions:   /org/freedesktop/UDisks2/block_devices/mmcblk0p1

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-solid] [Bug 467751] Unmounting certain SD cards can triggers an immediate remount when using "automount on attach" setting

2023-03-31 Thread Stefan Brüns
https://bugs.kde.org/show_bug.cgi?id=467751

--- Comment #7 from Stefan Brüns  ---
(You likely have to run "eject" as root, e.g. via sudo. In case eject returns
with a non-zero exit code, stracing it may reveal further information - "sudo
strace -s 200 eject /dev/mmcblk0".)

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-solid] [Bug 467751] Unmounting certain SD cards can triggers an immediate remount when using "automount on attach" setting

2023-03-31 Thread Stefan Brüns
https://bugs.kde.org/show_bug.cgi?id=467751

Stefan Brüns  changed:

   What|Removed |Added

 CC||stefan.bruens@rwth-aachen.d
   ||e

--- Comment #6 from Stefan Brüns  ---
"eject"  in this context forces the card reader/drive to flush any pending
operations from its caches.

The timestamp based heuristic does not work in all cases, as a card reader will
have a constant "TimeDetected" timestamp, and plugging a card into it will
result in a significantly later  "TimeMediaDetected".


@ Alberto:

Can you please provide the output of "udisctl monitor", when you run
"/usr/bin/eject /dev/mmcblk0; echo $? "?.

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-solid] [Bug 467751] Unmounting certain SD cards can triggers an immediate remount when using "automount on attach" setting

2023-03-31 Thread Bug Janitor Service
https://bugs.kde.org/show_bug.cgi?id=467751

Bug Janitor Service  changed:

   What|Removed |Added

 Status|CONFIRMED   |ASSIGNED

--- Comment #5 from Bug Janitor Service  ---
A possibly relevant merge request was started @
https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/1454

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-solid] [Bug 467751] Unmounting certain SD cards can triggers an immediate remount when using "automount on attach" setting

2023-03-30 Thread Bug Janitor Service
https://bugs.kde.org/show_bug.cgi?id=467751

--- Comment #4 from Bug Janitor Service  ---
A possibly relevant merge request was started @
https://invent.kde.org/frameworks/solid/-/merge_requests/128

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-solid] [Bug 467751] Unmounting certain SD cards can triggers an immediate remount when using "automount on attach" setting

2023-03-29 Thread Alberto Garcia
https://bugs.kde.org/show_bug.cgi?id=467751

--- Comment #3 from Alberto Garcia  ---
In case you want to give it a try with QEMU, here's a very simple test case:

1) Boot a VM with a virtual SD card reader, like this: -device sdhci-pci
-device sd-card,drive=mmc0 -drive if=none,file=card.qcow2,id=mmc0
2) Add a partition to the SD card, no need to format it (you can use GPT or
DOS/MBR, it doesn't matter).
3) Run `udevadm monitor` and in a different terminal run `eject /dev/mmcblk0`

This is enough to see the udev events I mentioned earlier.

The check that you describe seems fine (assuming that timeout is not too
small). Thanks!

-- 
You are receiving this mail because:
You are watching all bug changes.

[frameworks-solid] [Bug 467751] Unmounting certain SD cards can triggers an immediate remount when using "automount on attach" setting

2023-03-28 Thread Nate Graham
https://bugs.kde.org/show_bug.cgi?id=467751

Nate Graham  changed:

   What|Removed |Added

 CC||n...@kde.org
 Status|REPORTED|CONFIRMED
 Ever confirmed|0   |1
Summary|Unmounting an SD card   |Unmounting certain SD cards
   |triggers a remount  |can triggers an immediate
   ||remount when using
   ||"automount on attach"
   ||setting

--- Comment #2 from Nate Graham  ---
Can't reproduce with my card and card reader, FWIW. So I think it depends on
the hardware's adherence to the spec, which underscores the flakiness here.

Perhaps Solid can grow the ability to check for  whether an unmounted volume
immediately gets an "add" event from udisks, and ignore it if it's under a
certain timeout. Say, 100ms.

-- 
You are receiving this mail because:
You are watching all bug changes.