[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

PATCH: do not unnecessarily open partition device nodes (and make udev h

From: Hans de Goede
Subject: PATCH: do not unnecessarily open partition device nodes (and make udev hate us)
Date: Thu, 27 Aug 2009 20:11:35 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20090806 Fedora/3.0-3.7.b3.fc12 Thunderbird/3.0b3


After patching parted with my do not use BLKPG patch, I started to get EBUSY
errors on commit_to_os. Note this is not caused by the do not use BLKPG patch,
this was already happening, but instead of parted silently ignoring the errors
(and the kernel not knowing about the changes, which is bad). The error now
actually gets reported.

The problem turns out to be in:
libparted/arch/linux.c: _flush_cache()

Which walks all the partitions of the disk and does
BLKFLSBUF calls on them. This causes the following:

commit_to_os -> device_open -> fd = open /dev/sda ->
_flush_cache -> for each /dev/sda# open, ioctl, close
-> ioctl(fd, BLKRRPART) -> EBUSY

What is happening here is that the:
for each /dev/sda# open, ioctl, close

Is causing udev change events for all the /dev/sda#
nodes, which causes udev to call blkid on all these nodes
(on systems which use DeviceKit), so blkid has /dev/sda# nodes
open while BLKRRPART gets called on /dev/sda -> EBUSY.

I've checked with 2 independend storage subsystem kernel developers,
and /dev/sda and /dev/sda#, guarantee cache coherency now a days. So there is
no need to do this for 2.6, which also eliminates the need to call
_flush_cache() on device open at all.

I've attached a patch which implements this.



Attachment: parted-1.9.0-dont-touch-part-nodes.patch
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]