1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-10-21 15:33:18 +03:00

scan: add a dev to bcache before each read to handle write path

This is a temporary hacky workaround to the problem of
reads going through bcache and writes not using bcache.
The write path wants to read parts of data that it is
incrementally writing to disk, but the reads (using
bcache) don't work because the writes are not in the
bcache.  For now, add a dev to bcache before each attempt
to read it in case it's being used on the write path.
This commit is contained in:
David Teigland
2018-02-13 12:50:44 -06:00
parent 6c67c7557c
commit 9d2add1361
3 changed files with 25 additions and 0 deletions

View File

@@ -786,3 +786,21 @@ int label_read_sector(struct device *dev, struct label **labelp, uint64_t scan_s
return label_read(dev, labelp, 0);
}
/*
* FIXME: remove this. It should not be needed once writes are going through
* bcache. As it is now, the write path involves multiple writes to a device,
* and later writes want to read previous writes from disk. They do these
* reads using the standard read paths which require the devs to be in bcache,
* but the bcache reads do not find the dev because the writes have gone around
* bcache. To work around this for now, check if each dev is in bcache before
* reading it, and if not add it first.
*/
void label_scan_confirm(struct device *dev)
{
if (!_in_bcache(dev)) {
log_warn("add dev %s to bcache", dev_name(dev));
label_read(dev, NULL, 0);
}
}