⑨ lab ≡ ByteLabs

Plan9/FS—Resolve CWFS Checktag Issues

— Igor Böhm

On an unclean shutdown using cwfs, checktag issues might appear in /dev/kmesg upon bootup…

Symptom

% tail /dev/kmesg
checktag pc=203254 cw"/dev/sdD0/fscache"w"/dev/sdD0/fsworm"(17bf66) tag/path=Tfile/139963; expected Tfile/9885
checktag pc=202c79 cw"/dev/sdD0/fscache"w"/dev/sdD0/fsworm"(17bf62) tag/path=Tfile/139945; expected Tfile/19714

Potential Cause

Most likely an unclean shutdown yielded file system block inconsistencies.

Resolution

Find affected files (NOTE: the number after Tfile/… is the qid.path in decimal):

% mount /srv/boot /n/boot
% cd /n/boot
% walk -e qp | grep '^(269d|222bb|4d02|222a9)\.'

Next, use cwfs console clri <path> command to zap the files leaking their blocks (NOTE: simply deleting the files will cause more chaos as there will be duplicates in the freelist).

% con -C /srv/cwfs.cmd
clri /path/to/file/A
clri /path/to/file/B
clri /path/to/file/C
clri /path/to/file/D
Ctrl-\
>>> q

Alternatively, you can run “check tag” but during the check the fs will appear hung (see other cwfs commands in fs(8) manpage):

% con -C /srv/cwfs.cmd
checktag
Ctrl-\
>>> q

The clri <path> approach just affects a few files on a unclean shutdown, and it wont pause the file-system for a long time like the checktag command.

Credit: 9fans thread replied to by @cinap_lenrek.

#Plan9 #9front