Bug 208405 - 【ubifs】A potential space leak problem while linking tmpfile
Summary: 【ubifs】A potential space leak problem while linking tmpfile
Status: NEW
Alias: None
Product: File System
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: fs_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-01 08:42 UTC by Zhihao Cheng
Modified: 2020-07-28 16:21 UTC (History)
1 user (show)

See Also:
Kernel Version: 5.8
Tree: Mainline
Regression: No


Attachments
reproduce.patch (3.49 KB, patch)
2020-07-01 08:42 UTC, Zhihao Cheng
Details | Diff
a.c (689 bytes, text/x-csrc)
2020-07-01 08:42 UTC, Zhihao Cheng
Details

Description Zhihao Cheng 2020-07-01 08:42:07 UTC
There is a potential space leak problem while linking tmpfile, in which case, inode node(with nlink=0) is valid in tnc (on flash), which leads to space leak. Meanwhile, the corresponding data nodes won't be released from tnc.

The reproducer:
Step 1. Apply reproduce.patch
Step 2. mount **fresh** ubifs on '/root/temp'
Step 3. gcc -o aa a.c
Step 4. ./aa && dmesg
[ 3810.325408] NOT FOUND
[ 3811.215275] COMMIT START
[ 3811.216363] orphan commit orpahns 1
[ 3811.217532] commmit noorphan 0
[ 3811.218545] COMMIT END
[ 3811.222095] total orphans 0
[ 3811.223224] COMMIT START
[ 3811.224177] orphan commit orpahns 0
[ 3811.225450] commmit noorphan 1
[ 3811.226586] COMMIT END
[ 3811.227350] delete 65 from orphan
Step 5. Manually powercut when see 'delete 65 from orphan' in dmesg
Step 6. mount ubifs
[ 3863.152517] COMMIT START
[ 3863.152901] orphan commit orpahns 0
[ 3863.153491] commmit noorphan 1
[ 3863.153920] COMMIT END
[ 3863.154256] UBIFS (ubi0:0): recovery completed
[ 3863.154455] Found 65 0              # Find inode 65, nlink=0
Comment 1 Zhihao Cheng 2020-07-01 08:42:28 UTC
Created attachment 290021 [details]
reproduce.patch
Comment 2 Zhihao Cheng 2020-07-01 08:42:38 UTC
Created attachment 290023 [details]
a.c

Note You need to log in before you can comment on or make changes to this bug.