Skip to contentSkip to conversation

Ocassional dropping of uevent of loop device (possible race)

DISCUSSION Petr Vorel 2 participants 2 messages Oct 27, 2020 Block layer

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

Hi

commit 716ad0986cbd ("loop: Switch to set_capacity_revalidate_and_notify()") from v5.8-rc1 caused occasional dropping of uevent of attached or detached loop device (not sure which one). The only difference is that set_capacity_revalidate_and_notify() has condition:
if (capacity != size && capacity != 0 && size != 0)
thus notification is not triggered here but in a different part of code.

It was found with LTP test uevent01 [1]:

# i=0; while true; do i=$((i+1)); echo "== $i =="; rmmod -f loop; ./uevent01 || break; done

It looks to be a race. Usually ~ 10 loops is enough.

Kind regards,
Petr

#1 lore raw

Hi!

Quoted 7 lines

commit 716ad0986cbd ("loop: Switch to set_capacity_revalidate_and_notify()") from v5.8-rc1 caused occasional dropping of uevent of attached or detached loop device (not sure which one). The only difference is that set_capacity_revalidate_and_notify() has condition:
if (capacity != size && capacity != 0 && size != 0)
thus notification is not triggered here but in a different part of code.

Quoted 5 lines

It was found with LTP test uevent01 [1]:

# i=0; while true; do i=$((i+1)); echo "== $i =="; rmmod -f loop; ./uevent01 || break; done

It looks to be a race. Usually ~ 10 loops is enough.

Looks like the link to test source is missing and should have been:

[1] https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/uevents/uevent01.c

Signature · 2 lines
Cyril Hrubis
[email protected]