All of lore.kernel.org
 help / color / mirror / Atom feed
* sysfs: cannot create duplicate filename
@ 2022-02-13  9:21 Robin Peiremans
  2022-02-14 18:08 ` Jason Gunthorpe
  0 siblings, 1 reply; 38+ messages in thread
From: Robin Peiremans @ 2022-02-13  9:21 UTC (permalink / raw)
  To: linux-rdma

Hi

I ran into this error when upgrading to kernel 5.14 (it works
pre-5.14). The driver gets loaded (verified via lsmod), but the ib
utils don't show any ports.

There's a bugreport on elrepo
(https://elrepo.org/bugs/view.php?id=1176) that looks pretty much
identical, but it looks stalled.
I've bisected the kernel and commit
4a7aaf88c89f12f8048137e274ce0d40fe1056b2 seems to be the culprit.
Since I'm absolutely no dev, I'm hoping someone here can figure out
what exactly is going wrong. Latest mainline kernel still has the same
behavior.

Relevant output and logs below.

$ sudo lspci -s 04:00.0 -vv
04:00.0 InfiniBand: QLogic Corp. IBA7322 QDR InfiniBand HCA (rev 02)
Subsystem: QLogic Corp. IBA7322 QDR InfiniBand HCA
Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr-
Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Interrupt: pin A routed to IRQ 39
IOMMU group: 22
Region 0: Memory at fbc00000 (64-bit, non-prefetchable) [size=4M]
Expansion ROM at fc000000 [disabled] [size=128K]
Capabilities: [40] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [70] Express (v2) Endpoint, MSI 00
DevCap: MaxPayload 512 bytes, PhantFunc 0, Latency L0s <64ns, L1 <1us
ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset- SlotPowerLimit 0.000W
DevCtl: CorrErr+ NonFatalErr+ FatalErr+ UnsupReq+
RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop-
MaxPayload 128 bytes, MaxReadReq 512 bytes
DevSta: CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr- TransPend-
LnkCap: Port #0, Speed 5GT/s, Width x8, ASPM L0s, Exit Latency L0s <4us
ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp-
LnkCtl: ASPM Disabled; RCB 64 bytes, Disabled- CommClk+
ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
LnkSta: Speed 5GT/s (ok), Width x4 (downgraded)
TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
DevCap2: Completion Timeout: Not Supported, TimeoutDis+ NROPrPrP- LTR-
10BitTagComp- 10BitTagReq- OBFF Not Supported, ExtFmt- EETLPPrefix-
EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit-
FRS- TPHComp- ExtTPHComp-
AtomicOpsCap: 32bit- 64bit- 128bitCAS-
DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR- OBFF Disabled,
AtomicOpsCtl: ReqEn-
LnkCtl2: Target Link Speed: 5GT/s, EnterCompliance- SpeedDis-
Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
Compliance De-emphasis: -6dB
LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-
EqualizationPhase1-
EqualizationPhase2- EqualizationPhase3- LinkEqualizationRequest-
Retimer- 2Retimers- CrosslinkRes: unsupported
Capabilities: [b0] MSI-X: Enable- Count=32 Masked-
Vector table: BAR=0 offset=00008000
PBA: BAR=0 offset=00009000
Capabilities: [100 v1] Advanced Error Reporting
UESta: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
UEMsk: DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF-
MalfTLP- ECRC- UnsupReq- ACSViol-
UESvrt: DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+
MalfTLP+ ECRC- UnsupReq- ACSViol-
CESta: RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
CEMsk: RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr+
AERCap: First Error Pointer: 00, ECRCGenCap+ ECRCGenEn- ECRCChkCap+ ECRCChkEn-
MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap-
HeaderLog: 00000000 00000000 00000000 00000000
Kernel modules: ib_qib

Relevant /var/log/messages section:
Feb 13 09:43:29 localhost kernel: ib_qib 0000:04:00.0: qib0: Reserving
QPNs from 0x656b78 to 0x656b78 for non-verbs use
Feb 13 09:43:29 localhost kernel: sysfs: cannot create duplicate
filename '/devices/pci0000:00/0000:00:01.2/0000:01:00.0/0000:02:02.0/0000:04:00.0/infiniband/qib0/ports/1/linkcontrol'
Feb 13 09:43:29 localhost kernel: CPU: 15 PID: 1118 Comm: modprobe
Tainted: G           OE     5.17.0-rc3-robin+ #20
Feb 13 09:43:29 localhost kernel: Hardware name: ASUS System Product
Name/TUF GAMING X570-PRO (WI-FI), BIOS 3001 12/04/2020
Feb 13 09:43:29 localhost kernel: Call Trace:
Feb 13 09:43:29 localhost kernel: <TASK>
Feb 13 09:43:29 localhost kernel: dump_stack_lvl+0x48/0x5e
Feb 13 09:43:29 localhost kernel: sysfs_warn_dup.cold+0x17/0x24
Feb 13 09:43:29 localhost kernel: internal_create_group+0x348/0x350
Feb 13 09:43:29 localhost kernel: internal_create_groups.part.0+0x3d/0xa0
Feb 13 09:43:29 localhost kernel: setup_port+0x370/0x680 [ib_core]
Feb 13 09:43:29 localhost kernel: ? kobject_add+0x6e/0x90
Feb 13 09:43:29 localhost kernel: ib_setup_port_attrs+0x88/0x220 [ib_core]
Feb 13 09:43:29 localhost kernel: ib_register_device+0x576/0x650 [ib_core]
Feb 13 09:43:29 localhost kernel: ? __vmalloc_node+0x4a/0x70
Feb 13 09:43:29 localhost kernel: rvt_register_device+0x10c/0x270 [rdmavt]
Feb 13 09:43:29 localhost kernel: qib_register_ib_device+0x5f8/0x7a0 [ib_qib]
Feb 13 09:43:29 localhost kernel: qib_init_one+0x17f/0x470 [ib_qib]
Feb 13 09:43:29 localhost kernel: local_pci_probe+0x45/0x80
Feb 13 09:43:29 localhost kernel: ? pci_match_device+0xd7/0x130
Feb 13 09:43:29 localhost kernel: pci_device_probe+0xaa/0x1a0
Feb 13 09:43:29 localhost kernel: really_probe+0x1f5/0x3d0
Feb 13 09:43:29 localhost kernel: __driver_probe_device+0xfe/0x180
Feb 13 09:43:29 localhost kernel: driver_probe_device+0x1e/0x90
Feb 13 09:43:29 localhost kernel: __driver_attach+0xc0/0x1c0
Feb 13 09:43:29 localhost kernel: ? __device_attach_driver+0xe0/0xe0
Feb 13 09:43:29 localhost kernel: ? __device_attach_driver+0xe0/0xe0
Feb 13 09:43:29 localhost kernel: bus_for_each_dev+0x64/0x90
Feb 13 09:43:29 localhost kernel: bus_add_driver+0x149/0x1e0
Feb 13 09:43:29 localhost kernel: driver_register+0x8f/0xe0
Feb 13 09:43:29 localhost kernel: ? qib_init_qibfs+0x11/0x11 [ib_qib]
Feb 13 09:43:29 localhost kernel: qib_ib_init+0x3e/0xf62 [ib_qib]
Feb 13 09:43:29 localhost kernel: do_one_initcall+0x44/0x200
Feb 13 09:43:29 localhost kernel: ? kmem_cache_alloc_trace+0x163/0x2c0
Feb 13 09:43:29 localhost kernel: do_init_module+0x4c/0x260
Feb 13 09:43:29 localhost kernel: __do_sys_finit_module+0x9b/0xf0
Feb 13 09:43:29 localhost kernel: do_syscall_64+0x3b/0x90
Feb 13 09:43:29 localhost kernel: entry_SYSCALL_64_after_hwframe+0x44/0xae
Feb 13 09:43:29 localhost kernel: RIP: 0033:0x7fae66bf5ecd
Feb 13 09:43:29 localhost kernel: Code: 5b 41 5c c3 66 0f 1f 84 00 00
00 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d
89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 2b ef
0e 00 f7 d8 64 89 01 48
Feb 13 09:43:29 localhost kernel: RSP: 002b:00007ffdb7beb198 EFLAGS:
00000246 ORIG_RAX: 0000000000000139
Feb 13 09:43:29 localhost kernel: RAX: ffffffffffffffda RBX:
00007fae677c8c80 RCX: 00007fae66bf5ecd
Feb 13 09:43:29 localhost kernel: RDX: 0000000000000000 RSI:
00007fae67173a2a RDI: 0000000000000003
Feb 13 09:43:29 localhost kernel: RBP: 0000000000040004 R08:
0000000000000000 R09: 0000000000000000
Feb 13 09:43:29 localhost kernel: R10: 0000000000000003 R11:
0000000000000246 R12: 00007fae67173a2a
Feb 13 09:43:29 localhost kernel: R13: 00007fae677c8ed0 R14:
00007fae677c8c80 R15: 00007fae677c9980
Feb 13 09:43:29 localhost kernel: </TASK>
Feb 13 09:43:29 localhost kernel: infiniband qib0: Couldn't register
device with driver model
Feb 13 09:43:33 localhost kernel: ib_qib 0000:04:00.0: qib0: Failed to
register driver with ib core.
Feb 13 09:43:33 localhost kernel: ib_qib 0000:04:00.0: qib0: cannot
register verbs: 17!
Feb 13 09:43:33 localhost kernel: ib_qib 0000:04:00.0: Disabling
notifier on HCA 0 irq 140
Feb 13 09:43:33 localhost kernel: ib_qib 0000:04:00.0: Disabling
notifier on HCA 0 irq 141
Feb 13 09:43:33 localhost kernel: ib_qib 0000:04:00.0: Disabling
notifier on HCA 0 irq 142
Feb 13 09:43:33 localhost kernel: ib_qib 0000:04:00.0: Disabling
notifier on HCA 0 irq 144
Feb 13 09:43:33 localhost kernel: ib_qib: probe of 0000:04:00.0 failed
with error -17

$ ibstatus
Fatal error:  device '*': sys files not found (/sys/class/infiniband/*/ports)

$ git bisect bad
4a7aaf88c89f12f8048137e274ce0d40fe1056b2 is the first bad commit
commit 4a7aaf88c89f12f8048137e274ce0d40fe1056b2
Author: Jason Gunthorpe <jgg@nvidia.com>
Date:   Fri Jun 11 19:00:30 2021 +0300

    RDMA/qib: Use attributes for the port sysfs

    qib should not be creating a mess of kobjects to attach to the port
    kobject - this is all attributes. The proper API is to create an
    attribute_group list and create it against the port's kobject.

    Link: https://lore.kernel.org/r/911e0031e1ed495b0006e8a6efec7b67a702cd5e.1623427137.git.leonro@nvidia.com
    Tested-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

 drivers/infiniband/hw/qib/qib.h       |   4 -
 drivers/infiniband/hw/qib/qib_sysfs.c | 606 ++++++++++++++--------------------
 2 files changed, 254 insertions(+), 356 deletions(-)


Cheers
Robin

^ permalink raw reply	[flat|nested] 38+ messages in thread
* sysfs: cannot create duplicate filename
@ 2013-03-02 18:03 Andre Heider
       [not found] ` <CAHsu+b-cG+ED6TX5evRTBjR-LwHugW+8-9hnHXAz5DnAioJnUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 38+ messages in thread
From: Andre Heider @ 2013-03-02 18:03 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA

Hi,

After a BIOS update I get this in dmesg:

[    0.581554] EFI Variables Facility v0.08 2004-May-17
[    0.584914] ------------[ cut here ]------------
[    0.585639] WARNING: at /home/andre/linux/fs/sysfs/dir.c:536 sysfs_add_one+0x
d4/0x100()
[    0.586381] Hardware name: To be filled by O.E.M.
[    0.587123] sysfs: cannot create duplicate filename '/firmware/efi/vars/SbAsl
BufferPtrVar-01f33c25-764d-43ea-aeea-6b5a41f3f3e8'
[    0.588694] Modules linked in:
[    0.589484] Pid: 1, comm: swapper/0 Not tainted 3.8.0+ #7
[    0.590280] Call Trace:
[    0.591066]  [<ffffffff81208954>] ? sysfs_add_one+0xd4/0x100
[    0.591861]  [<ffffffff810587bf>] warn_slowpath_common+0x7f/0xc0
[    0.592650]  [<ffffffff810588bc>] warn_slowpath_fmt+0x4c/0x50
[    0.593429]  [<ffffffff8134dd85>] ? strlcat+0x65/0x80
[    0.594203]  [<ffffffff81208954>] sysfs_add_one+0xd4/0x100
[    0.594979]  [<ffffffff81208b78>] create_dir+0x78/0xd0
[    0.595753]  [<ffffffff81208ec6>] sysfs_create_dir+0x86/0xe0
[    0.596532]  [<ffffffff81347e4c>] kobject_add_internal+0x9c/0x220
[    0.597310]  [<ffffffff81348307>] kobject_init_and_add+0x67/0x90
[    0.598083]  [<ffffffff81584a71>] ? efivar_create_sysfs_entry+0x61/0x1c0
[    0.598859]  [<ffffffff81584b2b>] efivar_create_sysfs_entry+0x11b/0x1c0
[    0.599631]  [<ffffffff8158517e>] register_efivars+0xde/0x420
[    0.600395]  [<ffffffff81d430a7>] ? edd_init+0x2f5/0x2f5
[    0.601150]  [<ffffffff81d4315f>] efivars_init+0xb8/0x104
[    0.601903]  [<ffffffff8100215a>] do_one_initcall+0x12a/0x180
[    0.602659]  [<ffffffff81d05d80>] kernel_init_freeable+0x13e/0x1c6
[    0.603418]  [<ffffffff81d05586>] ? loglevel+0x31/0x31
[    0.604183]  [<ffffffff816a6530>] ? rest_init+0x80/0x80
[    0.604936]  [<ffffffff816a653e>] kernel_init+0xe/0xf0
[    0.605681]  [<ffffffff816ce7ec>] ret_from_fork+0x7c/0xb0
[    0.606414]  [<ffffffff816a6530>] ? rest_init+0x80/0x80
[    0.607143] ---[ end trace 1609741ab737eb29 ]---
[    0.607869] ------------[ cut here ]------------
[    0.608589] WARNING: at /home/andre/linux/lib/kobject.c:196
kobject_add_internal+0x204/0x220()
[    0.609342] Hardware name: To be filled by O.E.M.
[    0.610093] kobject_add_internal failed for
SbAslBufferPtrVar-01f33c25-764d-43ea-aeea-6b5a41f3f3e8 with -EEXIST,
don't try to register things with the same name in the same directory.
[    0.611703] Modules linked in:
[    0.612497] Pid: 1, comm: swapper/0 Tainted: G        W    3.8.0+ #7
[    0.613312] Call Trace:
[    0.614112]  [<ffffffff81347fb4>] ? kobject_add_internal+0x204/0x220
[    0.614931]  [<ffffffff810587bf>] warn_slowpath_common+0x7f/0xc0
[    0.615753]  [<ffffffff810588bc>] warn_slowpath_fmt+0x4c/0x50
[    0.616559]  [<ffffffff81347fb4>] kobject_add_internal+0x204/0x220
[    0.617362]  [<ffffffff81348307>] kobject_init_and_add+0x67/0x90
[    0.618152]  [<ffffffff81584a71>] ? efivar_create_sysfs_entry+0x61/0x1c0
[    0.618936]  [<ffffffff81584b2b>] efivar_create_sysfs_entry+0x11b/0x1c0
[    0.619732]  [<ffffffff8158517e>] register_efivars+0xde/0x420
[    0.620518]  [<ffffffff81d430a7>] ? edd_init+0x2f5/0x2f5
[    0.621297]  [<ffffffff81d4315f>] efivars_init+0xb8/0x104
[    0.622072]  [<ffffffff8100215a>] do_one_initcall+0x12a/0x180
[    0.622836]  [<ffffffff81d05d80>] kernel_init_freeable+0x13e/0x1c6
[    0.623590]  [<ffffffff81d05586>] ? loglevel+0x31/0x31
[    0.624314]  [<ffffffff816a6530>] ? rest_init+0x80/0x80
[    0.625010]  [<ffffffff816a653e>] kernel_init+0xe/0xf0
[    0.625703]  [<ffffffff816ce7ec>] ret_from_fork+0x7c/0xb0
[    0.626393]  [<ffffffff816a6530>] ? rest_init+0x80/0x80
[    0.627078] ---[ end trace 1609741ab737eb2a ]---

Sounds like yet another BIOS issue, and I guess the answer is
"complain to the manufacturer"... But we know how well that works, so
can this be a warning instead of a scary backtrace? :)

(this is: Gigabyte Technology Co., Ltd. To be filled by
O.E.M./Z77X-UD3H, BIOS F19e 11/21/2012)"

Thanks,
Andre

^ permalink raw reply	[flat|nested] 38+ messages in thread
* sysfs: cannot create duplicate filename
@ 2011-04-11 14:04 Sebastian Ott
  2011-04-11 14:13 ` Greg KH
  0 siblings, 1 reply; 38+ messages in thread
From: Sebastian Ott @ 2011-04-11 14:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel

Hi,

i've seen this warning which looks to be caused by a race between device_add
and driver_register

[   80.893594] sysfs: cannot create duplicate filename '/bus/ccw/drivers/qeth/0.0.b57d'
[   80.893611] ------------[ cut here ]------------
[   80.893614] WARNING: at /home/autobuild/BUILD/linux-2.6.38.2-20110404/fs/sysfs/dir.c:455
[   80.893617] Modules linked in: qeth ccwgroup
[   80.893623] Modules linked in: qeth ccwgroup
[   80.893629] CPU: 1 Not tainted 2.6.38.2-48.x.20110404-s390xdefault #1
[   80.893632] Process kworker/u:1 (pid: 25, task: 000000007e6c5a40, ksp: 000000007e6cb980)
[   80.893635] Krnl PSW : 0704000180000000 00000000002b676c (sysfs_add_one+0xd0/0xe8)
[   80.893643]            R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:0 PM:0 EA:3
[   80.893647] Krnl GPRS: 00000000000000bd 0000000000000000 000000000000005e 0000000000000001
[   80.893651]            0000000000589daa 00000000005a1248 0000000000000000 0000000000000000
[   80.893654]            0000000000000000 0000000000000001 000000007865c000 000000007e6cbbd8
[   80.893657]            000000007c704398 00000000ffffffef 00000000002b6768 000000007e6cbb00
[   80.893668] Krnl Code: 00000000002b675c: c0200020041d        larl    %r2,6b6f96
[   80.893672]            00000000002b6762: c0e500169afb        brasl   %r14,589d58
[   80.893676]            00000000002b6768: a7f40001            brc     15,2b676a
[   80.893680]           >00000000002b676c: b904002a            lgr     %r2,%r10
[   80.893684]            00000000002b6770: c0e5fffb6236        brasl   %r14,222bdc
[   80.893687]            00000000002b6776: a7f4ffad            brc     15,2b66d0
[   80.893692]            00000000002b677a: e320c0480004        lg      %r2,72(%r12)
[   80.893695]            00000000002b6780: a7f4ffec            brc     15,2b6758
[   80.893699] Call Trace:
[   80.893701] ([<00000000002b6768>] sysfs_add_one+0xcc/0xe8)
[   80.893705]  [<00000000002b7046>] sysfs_do_create_link+0xda/0x268
[   80.893708]  [<0000000000409f26>] driver_sysfs_add+0x66/0xcc
[   80.893713]  [<000000000040a0a2>] device_bind_driver+0x26/0x48
[   80.893717]  [<000000000040a110>] device_attach+0x4c/0xd4
[   80.893720]  [<0000000000409734>] bus_probe_device+0x4c/0x5c
[   80.893724]  [<0000000000406c52>] device_add+0x61e/0x73c
[   80.893728]  [<00000000004631a6>] ccw_device_todo+0x31a/0x380
[   80.893733]  [<000000000015f5b6>] process_one_work+0x1f6/0x4f0
[   80.893739]  [<0000000000163358>] worker_thread+0x17c/0x370
[   80.893742]  [<00000000001690ca>] kthread+0xa6/0xb0
[   80.893747]  [<000000000058f5f2>] kernel_thread_starter+0x6/0xc
[   80.893752]  [<000000000058f5ec>] kernel_thread_starter+0x0/0xc
[   80.893756] 4 locks held by kworker/u:1/25:
[   80.893758]  #0:  (cio){++++.+}, at: [<000000000015f524>] process_one_work+0x164/0x4f0
[   80.893766]  #1:  ((&cdev->private->todo_work)){+.+.+.}, at: [<000000000015f524>] process_one_work+0x164/0x4f0
[   80.893773]  #2:  (&__lockdep_no_validate__){+.+.+.}, at: [<000000000040a0fc>] device_attach+0x38/0xd4
[   80.893780]  #3:  (sysfs_mutex){+.+.+.}, at: [<00000000002b7030>] sysfs_do_create_link+0xc4/0x268
[   80.893787] Last Breaking-Event-Address:
[   80.893790]  [<00000000002b6768>] sysfs_add_one+0xcc/0xe8
[   80.893795] ---[ end trace ded2f91fcf2c6165 ]---


* device_add attached the device to the bus /*break*/
* driver_register walks the list of devices and tries to bind
  unbound devices
* /*continue*/ device_add calls device_attach which gets confused
  that the device is already bound to a driver

to fix this we could:
* hold the device lock in device_add (from bus_add_device to
  bus_probe_device)  ..but this means we have to extract the lock
  from the inside of some of these functions and i'm not sure about
  holding the lock while the blocking_notifier_call_chain thing..

* add a bus mutex, preventing concurrent registrations of devices
  and drivers to a bus

* change device_attach to detect an already bound device..something
  like the following:

regards,
Sebastian
-----

Add a check to device_attach to identify an already bound device.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
---
 drivers/base/dd.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -245,6 +245,10 @@ int device_attach(struct device *dev)
 
 	device_lock(dev);
 	if (dev->driver) {
+		if (klist_node_attached(&dev->p->knode_driver)) {
+			ret = 1;
+			goto out_unlock;
+		}
 		ret = device_bind_driver(dev);
 		if (ret == 0)
 			ret = 1;
@@ -257,6 +261,7 @@ int device_attach(struct device *dev)
 		ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
 		pm_runtime_put_sync(dev);
 	}
+out_unlock:
 	device_unlock(dev);
 	return ret;
 }

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2022-02-17 15:35 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-13  9:21 sysfs: cannot create duplicate filename Robin Peiremans
2022-02-14 18:08 ` Jason Gunthorpe
2022-02-17 13:37   ` Dennis Dalessandro
2022-02-17 14:29     ` Marciniszyn, Mike
2022-02-17 15:35       ` Robin Peiremans
  -- strict thread matches above, loose matches on Subject: below --
2013-03-02 18:03 Andre Heider
     [not found] ` <CAHsu+b-cG+ED6TX5evRTBjR-LwHugW+8-9hnHXAz5DnAioJnUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-05  9:39   ` Lingzhu Xiang
     [not found]     ` <5135BD66.1030005-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-06 13:19       ` Matt Fleming
     [not found]         ` <1362575941.15011.56.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-03-06 13:35           ` shea-yfkUTty7RcRWk0Htik3J/w
     [not found]             ` <bd0c3451a7342302623c09cac09bcbfc-yfkUTty7RcRWk0Htik3J/w@public.gmane.org>
2013-03-06 14:29               ` Matt Fleming
2013-03-08 15:11       ` Matt Fleming
     [not found]         ` <1362755479.15011.238.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-03-08 18:17           ` Lingzhu Xiang
     [not found]             ` <513A2B29.8090705-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-12 10:08               ` Matt Fleming
     [not found]                 ` <1363082900.15011.257.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-03-12 10:45                   ` Lingzhu Xiang
     [not found]                     ` <513F0734.80600-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-12 16:35                       ` Matt Fleming
     [not found]                         ` <1363106125.15011.263.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-03-12 17:51                           ` Seiji Aguchi
2013-03-13 10:47                           ` Lingzhu Xiang
     [not found]                             ` <51405943.2000601-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-14 16:33                               ` Matt Fleming
     [not found]                                 ` <1363278817.15011.316.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-03-14 19:31                                   ` Seiji Aguchi
     [not found]                                     ` <A5ED84D3BB3A384992CBB9C77DEDA4D41AF68807-ohthHghroY0jroPwUH3sq+6wyyQG6/Uh@public.gmane.org>
2013-03-18 14:51                                       ` Matt Fleming
     [not found]                                         ` <1363618261.14988.4.camel-ZqTwcBeJ+wsBof6jY8KHXm7IUlhRatedral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-03-19 10:14                                           ` Lingzhu Xiang
     [not found]                                             ` <51483A88.6060509-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-19 14:25                                               ` Seiji Aguchi
     [not found]                                                 ` <A5ED84D3BB3A384992CBB9C77DEDA4D41AF6E1F9-ohthHghroY0jroPwUH3sq+6wyyQG6/Uh@public.gmane.org>
2013-03-19 15:26                                                   ` Matt Fleming
     [not found]                                                     ` <514883B7.1010602-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-03-19 15:46                                                       ` Seiji Aguchi
2013-03-19 16:00                                                   ` Lingzhu Xiang
2013-03-21  7:22                                           ` Lingzhu Xiang
     [not found]                                             ` <514AB534.8080209-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-21  7:44                                               ` Matt Fleming
2013-03-12 13:20                   ` Andre Heider
2011-04-11 14:04 Sebastian Ott
2011-04-11 14:13 ` Greg KH
2011-04-11 14:33   ` Sebastian Ott
2011-04-11 14:49     ` Greg KH
2011-04-11 15:05       ` Sebastian Ott
2011-04-11 15:19         ` Greg KH
2011-04-11 17:50           ` Sebastian Ott
2011-04-11 17:56             ` Greg KH
2011-04-12 14:39               ` Sebastian Ott
2011-04-12 16:02                 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.