Re: Re: [RFC PATCH 0/1] block: long udev open waits during cache teardown

From: 杨轶甄

Date: Thu Nov 26 2026 - 06:05:00 EST


Hi Christian,

> If that still reproduces on mainline it's a question
> about the bdev release locking.

I reproduced the long udev open wait on upstream Linux v6.6 and on
Linux v7.0.14. On both kernels, udev blocked while trying to open the
device as mkfs.ntfs was closing it after a full format.

Thanks for pointing out the impact on other openers. I agree that a
udev probe closing its own file could trigger writeback and evict
cache that another opener is still using. I'll drop the __fput()
proposal.

I'd like to understand the locking requirements in the block device
last-close path. In particular, why does kill_bdev() need to complete
while open_mutex is held? What state and ordering requirements does
the lock protect during this cleanup?

I'm asking because the device mapping can still contain a large
amount of clean page cache after the early sync. In my tests on the
vendor 6.6 kernel, about 805 GiB remained at final teardown, and
the truncate took roughly seven minutes while udev was waiting.
Could the release path be changed to reduce the time open_mutex is
held while preserving those requirements?

> And mkfs can just fsync() and POSIX_FADV_DONTNEED the device itself
> before it closes it.

I've submitted a patch to the ntfs-3g project that calls fsync()
and then posix_fadvise(..., POSIX_FADV_DONTNEED) in userspace
before closing the device.

Thanks,
Ethan

信息安全声明:本邮件包含信息归发件人所在组织所有,发件人所在组织对该邮件拥有所有权利。请接收者注意保密,未经发件人书面许可,不得向任何第三方组织和个人透露本邮件所含信息。
Information Security Notice: The information contained in this mail is solely property of the sender's organization.This mail communication is confidential.Recipients named above are obligated to maintain secrecy and are not permitted to disclose the contents of this communication to others.