Bug 1481085
Summary: | LVM metadata archives ( /etc/lvm/archive) expiry / retention misbehaves after index #100,000. | ||||||
---|---|---|---|---|---|---|---|
Product: | [Community] LVM and device-mapper | Reporter: | Mark Mielke <mark> | ||||
Component: | lvm2 | Assignee: | Peter Rajnoha <prajnoha> | ||||
lvm2 sub component: | Metadata | QA Contact: | cluster-qe <cluster-qe> | ||||
Status: | CLOSED UPSTREAM | Docs Contact: | Alasdair Kergon <agk> | ||||
Severity: | low | ||||||
Priority: | unspecified | CC: | agk, heinzm, jan.skarvall, jbrassow, kmoradha, msnitzer, noriyuki.shiota, prajnoha, zkabelac | ||||
Version: | unspecified | Flags: | rule-engine:
lvm-technical-solution?
rule-engine: lvm-test-coverage? |
||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | 2.02.178 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2019-03-20 11:37:42 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Attachments: |
|
Description
Mark Mielke
2017-08-14 03:48:05 UTC
Created attachment 1392022 [details]
Patch to fix bug when inserting at the end of non-empty list
I've fixed this problem.
The list of archive files is sorted by index in descending order.
But, _insert_archive_file () adds the element with the smallest index to the beginning of the list. This patch fixes sorting.
With this patch, the problem is not reproduced in my environment. Perhaps it will not be necessary to include random numbers in file names.
What about something like this? --- a/lib/format_text/archive.c +++ b/lib/format_text/archive.c @@ -137,7 +137,7 @@ static struct dm_list *_scan_archive(struct dm_pool *mem, dm_list_init(results); /* Sort fails beyond 5-digit indexes */ - if ((count = scandir(dir, &dirent, NULL, alphasort)) < 0) { + if ((count = scandir(dir, &dirent, NULL, versionsort)) < 0) { log_error("Couldn't scan the archive directory (%s).", dir); return 0; } https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1b6d0346a37d34394471080ec2aff55cea1bdafe;hp=d6cabbbc53de615fe92ff6372a570285704b59d2 https://www.redhat.com/archives/lvm-devel/2018-February/msg00016.html I wonder if this fix will eventually purge all those archive files with index 100000, or if I will have to manually delete those, and if so, how. I also wonder how the next index is chosen. Is it continously increasing? If so, is there a way to start over from a low index? It should clean them up automatically once the fix is in, yes. And to start from a low index, just remove all the older files and rename the ones you want to keep to low numbers. (It just looks for the highest number and adds one to find the next number to use.) |