[Feedback on issues] Switchable USB stick mounted read-only gives false damage warning
deepin 25 26 views · 0 replies ·
w***f@pozinski.ru
deepin
20 hours ago
Author
dde-file-manager shows a "possible damage" warning for a stick that mounted fine
Summary
Plugging in a read-only USB stick produces a scary warning from the file manager
that the device may be damaged. The device mounted successfully and needs no
repair. The warning is the visible end of a mount race inside Deepin: the file
manager's own mount request loses to the one udisks performs a fraction of a
second earlier, and the "failure" is reported to the user as a fault.
Device: generic 512 MB USB stick, sdb, one vfat partition sdb1
The stick has a hardware write-protect switch; in this test it was on, so udisksctl info -b /dev/sdb1 reports ReadOnly: true - correct, expected
behaviour, not a fault
Steps to reproduce
Insert a USB stick that something else will auto-mount (read-only stick shown
here, but the race is not read-only specific).
Watch the journal.
Observed
21:40:08.670 udisksd: block_devices/sdb: PartitionTable Properties Changed
21:40:08.745 udisksd: block_devices/sdb1 Filesystem: MountPoints=/media/wulf/60B7-D419
21:40:08.769 udisksd: UserspaceMountOptions=uhelper=udisks2
21:40:08.944 udisksd: Device /dev/sdb1 is already mounted at `/media/wulf/60B7-D419'
21:40:08.954 dde-file-manager-daemon: Block device mount failed -
device "/org/freedesktop/UDisks2/block_devices/sdb1",
error code dfmmount::DeviceError::kUDisksErrorAlreadyMounted,
message "GDBus.Error:org.freedesktop.UDisks2.Error.AlreadyMounted:
Device /dev/sdb1 is already mounted at `/media/wulf/60B7-D419'."
The user sees a warning implying possible device damage. The mount is fine: lsblk shows sdb1 mounted at /media/wulf/60B7-D419, and udisks reports the
block device ReadOnly: true because of the switch.
Expected
AlreadyMounted should be treated as success by the mount path, or suppressed
silently - the user asked for a mount and a mount exists.
If a device really is read-only, the message should say so ("the device is
write-protected"), not imply damage.
A device that is damaged should be distinguishable from an AlreadyMounted race; at present both end up as "may be damaged".
Notes
The race is reproducible on every insert of this stick; whether the warning
dialog is actually shown varies, but the failed mount is always logged.
Two mount initiators are involved: udisks2 completes the mount ~200 ms before
the file manager's request, which then fails with AlreadyMounted.
The same stick mounted read-write (switch off) reports cleanly; so does a
USB hard disk. Read-only media make it obvious because the resulting
warning is even more alarming than a plain "failed to mount".
Suggestion
Treat org.freedesktop.UDisks2.Error.AlreadyMounted as a success in dfmmount, and when a mount genuinely fails because the device is read-only,
report that specific condition rather than the generic damage warning.
dde-file-manager shows a "possible damage" warning for a stick that mounted fine
Summary
Plugging in a read-only USB stick produces a scary warning from the file manager
that the device may be damaged. The device mounted successfully and needs no
repair. The warning is the visible end of a mount race inside Deepin: the file
manager's own mount request loses to the one udisks performs a fraction of a
second earlier, and the "failure" is reported to the user as a fault.
Environment
sdb, onevfatpartitionsdb1udisksctl info -b /dev/sdb1reportsReadOnly: true- correct, expectedbehaviour, not a fault
Steps to reproduce
here, but the race is not read-only specific).
Observed
The user sees a warning implying possible device damage. The mount is fine:
lsblkshowssdb1mounted at/media/wulf/60B7-D419, and udisks reports theblock device
ReadOnly: truebecause of the switch.Expected
AlreadyMountedshould be treated as success by the mount path, or suppressedsilently - the user asked for a mount and a mount exists.
write-protected"), not imply damage.
AlreadyMountedrace; at present both end up as "may be damaged".Notes
dialog is actually shown varies, but the failed mount is always logged.
the file manager's request, which then fails with
AlreadyMounted.USB hard disk. Read-only media make it obvious because the resulting
warning is even more alarming than a plain "failed to mount".
Suggestion
Treat
org.freedesktop.UDisks2.Error.AlreadyMountedas a success indfmmount, and when a mount genuinely fails because the device is read-only,report that specific condition rather than the generic damage warning.