Problem with buildstats when building on a btrfs volume
Hello All,
I've encountered a problem when building (with TMPDIR residing) on a btrfs volume.
It does not matter what is being built: starting clean, bitbake discoveres that pseudo needs to be built, it does so successfully but then gets an exception when doing the buildstats.
ERROR: Execution of event handler 'run_buildstats' failed
Traceback (most recent call last):
File "run_buildstats(e)", line 18, in run_buildstats(e=<bb.event.BuildStarted object at 0x5e33710>) File "buildstats.bbclass", line 21, in set_device(e=<bb.event.BuildStarted object at 0x5e33710>)
UnboundLocalError: local variable 'rdev' referenced before assignment
The problem is related to the fact that btrfs reports a fake device id by stat(2) in st_dev.
See there for more information:
https://bugzilla.redhat.com/show_bug.cgi?id=711881
http://permalink.gmane.org/gmane.comp.file-systems.btrfs/3509
OE core uses stat on tmpdir to find out the major/minor device ids when collecting the build statistics, see function set_device in buildstats.bbclass. If the (fake) device id can't be found in /proc/diskstats, rdev is never set, but still used two lines later (this case should be detected and handled gracefully anyhow, IMHO, e.g. relinquishing buildstats).
I don't know how to reliably solve this problem. /proc/self/mountinfo can't be used either, as the listed device id there is still different from what is reported by stat (see the first link above). One possible solution would be to match on the device name (third field in /proc/diskstats), but this information is not returned by stat so the actual mount point needs to be found as prefix of the TMPDIR path, then symlinks in the device name would need to be resolved as well (which is common, if LVM and the device mapper are used).
I'm not good at python, otherwise I'd have proposed a patch...
have a nice day,
-wolfi
Signature · 13 lines
Wolfram Stering (Entwicklung) HALE electronic GmbH Eugen-Müller-Straße 18, 5020 Salzburg, Austria Tel: +43 (662) 439011 550 Fax: +43 (662) 439011 9 http://www.hale.at/ Firmenbuchnummer: FN 66801m HG Salzburg -- Scanned by MailScanner.