reread-partition-table: take exclusive lock when requested
Beforeaa47d8ade1, we took an exclusive lock for the whole block device, but with the commit, a shared lock is taken. That causes, during we requesting the kernel to reread partition table, udev workers can process the block device or its partitions. Let's make udev workers not process block devices during rereading partition table again. Follow-up foraa47d8ade1.
This commit is contained in:
committed by
Lennart Poettering
parent
0885e4a6e7
commit
9011b1cfc0
@@ -259,7 +259,7 @@ static int reread_partition_table_full(sd_device *dev, int fd, RereadPartitionTa
|
||||
if (lock_fd < 0)
|
||||
return log_device_debug_errno(dev, r, "Failed top open lock fd for block device '%s': %m", p);
|
||||
|
||||
if (flock(lock_fd, LOCK_SH|LOCK_NB) < 0)
|
||||
if (flock(lock_fd, LOCK_EX|LOCK_NB) < 0)
|
||||
return log_device_debug_errno(dev, errno, "Failed to take BSD lock on block device '%s': %m", p);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user