-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
udevd stop my HDD from spinning down #32769
Comments
These lines are relevant:
So udev watches block devices via inotify for IN_CLOSE_WRITE events: i.e. whenever a block device that was opened by userspace for writing is closed, we'll retrigger the device so that the partition table is reread and similar things. hence, figure out what tool is responsible for opening the block device writable. udev itself never opens a block device writable, it just probes it in read-only mode. Hence it must be some other component of your OS. Once you fix that, then udev won't do a thing anymore either. Closing, since this isn't a systemd problem, but some other tool is triggering this. |
This device is not mounted, and this is a headless server with no such userspace program which would open the block device in write mode (except
Fortunately, I opened an issue in sg3_utils asking if it's possible to make |
Can you check which command run by udev actually causes the call to
Right. Looking at it this way, runningn
udevd's close-after-write behavior is documented, although not very prominently. Search for This is not the only use case in which udev's watch mechanism is causing unexpected effects. But there are only very few reports of this kind, so it doesn't seem to be a big problem for most users. OTOH, it makes sure that the OS notices partition table changes, which is a nice feature that would be thoroughly missed by users if it didn't exist. |
Last time I checked via kernel ftrace, userland process was |
Yeah, we should check if the disk is stopped before running scsi_id or blkid. But how? |
I disagree that we should change the behavior of ata_id / scsi_id / blkid when the disk is stopped. I am not aware of reliable ways to detect disk spinning status. IMHO nothing could be done on I'm fine with the workaround |
systemd-udevd opens the device in the |
systemd version the issue has been seen with
255
Used distribution
Arch Linux
Linux kernel version used
6.8.9-arch1-2
CPU architectures issue was seen on
None
Component
systemd-udevd
Expected behaviour you didn't see
I could spin-down my SAS HDD and then remove it safely.
Unexpected behaviour you saw
After spin-down my SAS HDD, it starts spinning again immediately.
Steps to reproduce the problem
# sg_start --stop /dev/sdd
then
dmesg
showsThe
Spinning up disk...
message comes from kernel.The call stack is
sd_open -> sd_revalidate_disk -> sd_spinup_disk
.It's
systemd-udevd
who is triggering this.Additional program output to the terminal or log subsystem illustrating the issue
The text was updated successfully, but these errors were encountered: