Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:acdc:sp5-rebuild
s390-tools.17667
dasdfmt-retry-BIODASDINFO-if-device-is-busy.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File dasdfmt-retry-BIODASDINFO-if-device-is-busy.patch of Package s390-tools.17667
From 943e577440d74ad7f8787af2590c8ab4579a459b Mon Sep 17 00:00:00 2001 From: Hannes Reinecke <hare@suse.de> Date: Thu, 5 Nov 2015 10:57:38 +0100 Subject: [PATCH] dasdfmt: retry BIODASDINFO if device is busy Modern udev have the wonderful 'feature' to sending a 'change' event whenever a device opened with O_RDWR is closed again. The reasoning is that the said program _might_ have changed the partition table and hence we _might_ have missed a partition update. But in doing so it not only generated tons of pointless events but also confused the hell out of other programs. Idiots. References: bsc#937340 Signed-off-by: Hannes Reinecke <hare@suse.de> --- dasdfmt/dasdfmt.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/dasdfmt/dasdfmt.c b/dasdfmt/dasdfmt.c index e1877ac..f03cbad 100644 --- a/dasdfmt/dasdfmt.c +++ b/dasdfmt/dasdfmt.c @@ -580,7 +580,7 @@ */ static void check_disk(dasdfmt_info_t *info, char *devname) { - int err; + int err, index = 0 ; bool ro; err = dasd_is_ro(devname, &ro); @@ -593,9 +593,27 @@ if (ro) ERRMSG_EXIT(EXIT_FAILURE, "Disk is read only!\n"); - if (!info->force) + if (!info->force) { + /* + * udev strikes again. + * Modern udev will issue a 'change' event whenever + * a device opened with O_RDWR is closed again. + * On the grounds that program _might_ have changed + * the partition table. + * And confusing the hell out ouf anyone else. + * Bah. + */ + for ( index = 0 ; index < 6 ; index++ ) { + if (info->dasd_info.open_count > 1) { + dasd_get_info(dev_filename, &info->dasd_info); + sleep(1); + } + else break; + + } if (info->dasd_info.open_count > 1) ERRMSG_EXIT(EXIT_BUSY, "Disk in use!\n"); + } if (strncmp(info->dasd_info.type, "ECKD", 4) != 0) { ERRMSG_EXIT(EXIT_FAILURE, -- 1.8.4.5
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor