Bug 215594

Summary: Unable to transfer big files to Nokia N9 and Jolla phone
Product: Drivers Reporter: Paul Menzel (pmenzel+bugzilla.kernel.org)
Component: BluetoothAssignee: linux-bluetooth (linux-bluetooth)
Status: NEW ---    
Severity: normal CC: luiz.dentz, pmenzel+bugzilla.kernel.org, tedd.an
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.16-rc1 Subsystem:
Regression: No Bisected commit-id:
Attachments: Output of `btmon --write /dev/shm/btmon-trace.log`
Output of `btmon --write /dev/shm/btmon-trace-small-file.log`
Output of `/usr/libexec/bluetooth/obexd -dn`

Description Paul Menzel 2022-02-11 16:03:42 UTC
Created attachment 300440 [details]
Output of `btmon --write /dev/shm/btmon-trace.log`

Report: https://lore.kernel.org/linux-bluetooth/def03073-3fab-3b34-6ffc-702bb1b3758f@leemhuis.info/T/#m04445e920610d42a9510d0f6d97afa5376e4a3ca

Created Bugzilla issue to upload log files.

Unfortunately, I do not know, how to capture `obexd` logs. `obexd -d` did not print any messages to the terminal. `obexctl --monitor` also did not get it more verbose.
Comment 1 Luiz Von Dentz 2022-02-11 23:59:29 UTC
> ACL Data RX: Handle 256 flags 0x02 dlen 15                                   
>                                                                      #102
> [hci0] 40.702432
      Channel: 65 len 11 [PSM 3 mode Basic (0x00)] {chan 0}
      RFCOMM: Unnumbered Info with Header Check (UIH) (0xef)
         Address: 0x49 cr 0 dlci 0x12
         Control: 0xef poll/final 0
         Length: 7
         FCS: 0x14
        a0 00 07 10 00 7f ff 14                          ........        
= obexctl: [^A^BNEW^A^B] Session /org/bluez/obex/client/session0 [default]                                                                                40.703445
= obexctl: [^A^BNEW^A^B] ObjectPush /org/bluez/obex/client/session0                                                                                       40.703761
= obexctl: Connection successful                                                                                                                                 40.703803
= obexctl: send /lib/systemd/systemd                                                                                                                             46.405464
= obexctl: Attempting to send /lib/systemd/systemd to /org/bluez/obex/client/session0                                                                            46.405516
= obexctl: [^A^BNEW^A^B] Transfer /org/bluez/obex/client/session0/transfer0                                                                               46.407098
= obexctl: Transfer /org/bluez/obex/client/session0/transfer0                                                                                                    46.407161
= obexctl:      Status: queued                                                                                                                                       46.40>
= obexctl:      Name: systemd                                                                                                                                        46.40>
= obexctl:      Size: 1845808                                                                                                                                        46.40>
= obexctl:      Filename: /lib/systemd/systemd                                                                                                                       46.40>
= obexctl:      Session: /org/bluez/obex/client/session0                                                                                                             46.40>
= obexctl: [^A^BCHG^A^B] Transfer /org/bluez/obex/client/session0/transfer0 Status: active                                                                47.629711
= obexctl: [^A^BCHG^A^B] Transfer /org/bluez/obex/client/session0/transfer0 Transferred: 32737 (@32KB/s 00:55)                                            47.630411
= obexctl: [^A^BCHG^A^B] Transfer /org/bluez/obex/client/session0/transfer0 Status: error                                                                106.630035
= obexctl: [^A^BDEL^A^B] Transfer /org/bluez/obex/client/session0/transfer0 

So the transfer apparently didn't even start, with what system are you traying to communicate to?
Comment 2 Paul Menzel 2022-02-12 06:34:31 UTC
Thank you for looking into this.

> So the transfer apparently didn't even start, with what system are you
> traying to communicate to?

Nokia N9 (MeeGo/Harmattan)
Comment 3 Paul Menzel 2022-02-12 06:56:01 UTC
Just to also document it here, commit 81be03e026dc (Bluetooth: RFCOMM: Replace use of memcpy_from_msg with bt_skb_sendmmsg) introduced that regression, and reverting this fixes the issue.

[1]: https://lore.kernel.org/linux-bluetooth/def03073-3fab-3b34-6ffc-702bb1b3758f@leemhuis.info/T/#m04445e920610d42a9510d0f6d97afa5376e4a3ca
[2]: https://lore.kernel.org/linux-bluetooth/20220208221911.57058-1-pmenzel@molgen.mpg.de/
Comment 4 Paul Menzel 2022-02-12 06:57:35 UTC
Created attachment 300441 [details]
Output of `btmon --write /dev/shm/btmon-trace-small-file.log`

btmon log, when sending a small file (3 bytes):

    $ more test.txt
    bt
Comment 5 Tedd An 2022-02-12 18:39:12 UTC
I tested with latest BlueZ(HEAD: https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=002c0c9eda0052a834ddd4b63026f534b7d52f14) without reverting the commits in #3(https://bugzilla.kernel.org/show_bug.cgi?id=215594#c3) and RFCOMM worked fine.
I tested both Windows 10 and MAC OS and was able to send and receive the files.

Please try it with the latest BlueZ and see if it makes any difference.
Comment 6 Paul Menzel 2022-02-12 22:26:22 UTC
Thank you for looking into this. Did you test with MeeGo/Harmattan or Sailfish OS?

Also, it wouldn’t make a difference, as Linux’ no-regression-policy requires, that the everything keeps working with the existing user space.
Comment 7 Paul Menzel 2022-02-12 22:29:19 UTC
(As written in the mailing list thread, with the Android phone Galaly M32 the file transfer succeeded.)
Comment 8 Luiz Von Dentz 2022-02-14 18:19:19 UTC
(In reply to Paul Menzel from comment #6)
> Thank you for looking into this. Did you test with MeeGo/Harmattan or
> Sailfish OS?
> 
> Also, it wouldn’t make a difference, as Linux’ no-regression-policy
> requires, that the everything keeps working with the existing user space.

How about getting some logs from obexd then? Stop obexd.service and start with obexd/src/obexd -dn
Comment 9 Paul Menzel 2022-02-15 06:47:30 UTC
Created attachment 300461 [details]
Output of `/usr/libexec/bluetooth/obexd -dn`