@@ -177,8 +177,8 @@
return;
}
if (cmpp->size != mpp->size) {
- mpp->action = ACT_RELOAD;
- condlog(3, "%s: set ACT_RELOAD (size change)",
+ mpp->action = ACT_RESIZE;
+ condlog(3, "%s: set ACT_RESIZE (size change)",
mpp->alias);
return;
}
@@ -463,6 +463,7 @@
strerror(errno));
return -1;
}
+ close(fd);
if (lock.l_type == F_UNLCK)
return 0;
return 1;
@@ -162,6 +162,19 @@
return r;
}
+int
+check_sysfs_dir(char *sysfs_path, char * dev)
+{
+ char dev_dir[SYSFS_PATH_SIZE];
+ struct stat stats;
+
+ if (sysfs_path && safe_sprintf(dev_dir, "%s/block/%s", sysfs_path, dev))
+ return 1;
+ if (stat(dev_dir, &stats) != 0)
+ return 1;
+ return 0;
+}
+
/*
* the daemon can race udev upon path add,
* not multipath(8), ran by udev
@@ -171,11 +184,11 @@
#define WAIT_LOOP_PER_SECOND 5
static int
-wait_for_file (char * filename)
+wait_for_file (char * filename, char * sysfs_path, char * dev)
{
int loop;
struct stat stats;
-
+
loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND;
while (--loop) {
@@ -185,13 +198,16 @@
if (errno != ENOENT)
return 1;
+ if (sysfs_path && check_sysfs_dir(sysfs_path, dev) != 0)
+ return 1;
+
usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND);
}
return 1;
}
#else
static int
-wait_for_file (char * filename)
+wait_for_file (char * filename, char * sysfs_path, char * dev)
{
return 0;
}
@@ -207,7 +223,7 @@
if (safe_sprintf(attr_path, fmt, sysfs_path, dev)) \
return 1; \
\
- if (dowait && wait_for_file(attr_path)) \
+ if (dowait && wait_for_file(attr_path, sysfs_path, dev)) \
return 1; \
\
if (!(attr = sysfs_open_attribute(attr_path))) \
@@ -320,7 +336,7 @@
return -1;
}
- if (wait_for_file(devpath)) {
+ if (wait_for_file(devpath, NULL, NULL)) {
condlog(3, "failed to open %s", devpath);
return -1;
}
@@ -857,6 +873,8 @@
get_prio(pp);
#ifndef DAEMON
+ if (checker_selected(&pp->checker))
+ checker_put(&pp->checker);
close(pp->fd);
pp->fd = -1;
#endif
@@ -24,6 +24,7 @@
#define SCSI_COMMAND_TERMINATED 0x22
#define SG_ERR_DRIVER_SENSE 0x08
+int check_sysfs_dir(char *sysfs_path, char * dev);
int device_ok_to_add(char *devname);
int sysfs_get_vendor (char * sysfs_path, char * dev, char * buff, int len);
int sysfs_get_model (char * sysfs_path, char * dev, char * buff, int len);
@@ -378,8 +378,7 @@
* see if path is in sysfs
*/
if (!(*pp->dev) ||
- sysfs_get_dev(sysfs_path, pp->dev, pp->dev_t,
- BLK_DEV_SIZE)) {
+ check_sysfs_dir(sysfs_path, pp->dev)) {
if (!(*pp->dev))
condlog(3,
"%s: removing path %s with no devname",
@@ -411,8 +411,8 @@
if (adopt_paths(vecs->pathvec, mpp))
return 1; /* leave path added to pathvec */
- verify_paths(mpp, vecs, NULL);
mpp->hwe = pp->hwe;
+ verify_paths(mpp, vecs, NULL);
mpp->flush_on_last_del = FLUSH_UNDEF;
mpp->action = ACT_RELOAD;
}