mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
scan: invalidate bcache for dev after errors
If there are errors reading or writing dev, invalidate bcache for it.
This commit is contained in:
parent
4331182964
commit
da2b155a9d
@ -871,11 +871,16 @@ bool dev_read_bytes(struct device *dev, off_t start, size_t len, void *data)
|
||||
}
|
||||
|
||||
if (dev->bcache_fd <= 0) {
|
||||
log_error("dev_read_bytes %s with invalid bcache_fd", dev_name(dev));
|
||||
log_error("dev_read_bytes %s with invalid fd %d", dev_name(dev), dev->bcache_fd);
|
||||
return false;
|
||||
}
|
||||
|
||||
return bcache_read_bytes(scan_bcache, dev->bcache_fd, start, len, data);
|
||||
if (!bcache_read_bytes(scan_bcache, dev->bcache_fd, start, len, data)) {
|
||||
label_scan_invalidate(dev);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool dev_write_bytes(struct device *dev, off_t start, size_t len, void *data)
|
||||
@ -895,11 +900,15 @@ bool dev_write_bytes(struct device *dev, off_t start, size_t len, void *data)
|
||||
}
|
||||
|
||||
if (dev->bcache_fd <= 0) {
|
||||
log_error("dev_write_bytes %s with invalid bcache_fd", dev_name(dev));
|
||||
log_error("dev_write_bytes %s with invalid fd %d", dev_name(dev), dev->bcache_fd);
|
||||
return false;
|
||||
}
|
||||
|
||||
return bcache_write_bytes(scan_bcache, dev->bcache_fd, start, len, data);
|
||||
if (!bcache_write_bytes(scan_bcache, dev->bcache_fd, start, len, data)) {
|
||||
label_scan_invalidate(dev);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dev_write_zeros(struct device *dev, off_t start, size_t len)
|
||||
@ -919,10 +928,14 @@ bool dev_write_zeros(struct device *dev, off_t start, size_t len)
|
||||
}
|
||||
|
||||
if (dev->bcache_fd <= 0) {
|
||||
log_error("dev_write_bytes %s with invalid bcache_fd", dev_name(dev));
|
||||
log_error("dev_write_bytes %s with invalid fd %d", dev_name(dev), dev->bcache_fd);
|
||||
return false;
|
||||
}
|
||||
|
||||
return bcache_write_zeros(scan_bcache, dev->bcache_fd, start, len);
|
||||
if (!bcache_write_zeros(scan_bcache, dev->bcache_fd, start, len)) {
|
||||
label_scan_invalidate(dev);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user