Bug 201973

Summary: File Size
Product: File System Reporter: ghasem keshavarz (ghasemsystem)
Component: XFSAssignee: FileSystem/XFS Default Virtual Assignee (filesystem_xfs)
Status: RESOLVED INVALID    
Severity: normal CC: sandeen
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.10.0-862.el7.x86_64 Subsystem:
Regression: No Bisected commit-id:
Attachments: file size

Description ghasem keshavarz 2018-12-12 09:28:47 UTC
Created attachment 279965 [details]
file size

hi
when my log file is used by program and i truncate it, file size is release on disk but ll/ls command show old size of file, but du command work correctly

good luck
Comment 1 Eric Sandeen 2018-12-12 15:31:59 UTC
Hi, this is the upstream kernel bug tracker, and 3.10.0-862.el7.x86_64 is not an upstream kernel.  This is not the appropriate bug tracker for distribution kernels.

Also, you've not provided any reproducer steps, just a screenshot of du & ls which shows no problem.

There is no expectation that du should match ls.  One reflects the maximum offset in a file, the other reflects the amount of space allocated to the file.  They are two different quantities.  Observe:

# fallocate -l 161m output.out
# truncate --size 18g output.out

# du -h output.out
161M	output.out

# ls -lh output.out
-rw-r--r--. 1 root root 18G Dec 12 10:30 output.out