The xattr inode will be alone in TNC and its' xattr entry cannot be found in TNC, when powercut in selinux or encryption scenario. 1. touch file (selinux enable) xattr entry, xattr inode, inode, dentry are fell on disk 2. open file 3. unlink file inode(nlink=0), xattr inode(nlink=1) are added into orphan list 4. commit write inode ino and xattr inode ino to orphan area 5. powercut 6. mount do_kill_orphans inode(nlink=0) is deleted from TNC by ubifs_tnc_remove_range, xattr entry is deleted too. xattr inode(nlink=1) is not deleted from TNC Finally, xattr inode is alone in TNC, its' xattr entry has been deleted.
Reproduce: 1. ./test.sh 1 2. Dump mtd image and do powercut when you see printing message "Execute powercut". 3. Reboot && ./test.sh [ 41.155062] UBIFS error (ubi0:0 pid 1093): dbg_check_filesystem [ubifs]: inode 66 nlink is 1, but calculated nlink is 0 [ 41.156438] UBIFS (ubi0:0): dump of the inode 66 sitting in LEB 12:2128 [ 41.156442] magic 0x6101831 [ 41.156901] crc 0xb205a6bc [ 41.157402] node_type 0 (inode node) [ 41.157935] group_type 1 (in node group) [ 41.158515] sqnum 12 [ 41.158887] len 197 [ 41.159322] key (66, inode) [ 41.159793] creat_sqnum 9 [ 41.160194] size 37 [ 41.160582] nlink 1 [ 41.160966] atime 1711779452.0 [ 41.161470] mtime 1711779452.0 [ 41.161969] ctime 1711779452.0 [ 41.162487] uid 0 [ 41.162877] gid 0 [ 41.163283] mode 33279 [ 41.163666] flags 0x20 [ 41.164112] xattr_cnt 0 [ 41.164488] xattr_size 0 [ 41.164861] xattr_names 0 [ 41.165265] compr_type 0x3 [ 41.165662] data len 37
(In reply to Zhihao Cheng from comment #1) > [ 41.160194] size 37 > [ 41.160582] nlink 1 > [ 41.163666] flags 0x20 # UBIFS_XATTR_FL > [ 41.164112] xattr_cnt 0 > [ 41.164488] xattr_size 0 > [ 41.164861] xattr_names 0 > [ 41.165265] compr_type 0x3 > [ 41.165662] data len 37
Created attachment 306060 [details] test.sh
Created attachment 306061 [details] a.c
Created attachment 306062 [details] test_userxattr.sh Actually, all kinds of xattr could trigger this problem.