Bug #24897
client: writes rejected by quota may truncate/zero parts of file
0%
Description
I found a BUg as below:
First:setfattr -n ceph.quota.max_bytes -v 5 /nas/cephfs/abc
Second:echo "abc" > /nas/cephfs/abc/test.log
Third:cat /nas/cephfs/abc/test.log
[root@node1 abc]# cat test.log
abc
Next i run the command:echo "abcdefg" > /nas/cephfs/abc/test.log
[root@node1 abc]# echo "abcdefg" > test.log
-bash: echo: write error: Disk quota exceeded
then i found my file data is gone.
[root@node1 abc]# cat test.log
History
#1 Updated by Greg Farnum over 5 years ago
- Project changed from Ceph to CephFS
#2 Updated by Patrick Donnelly over 5 years ago
- Subject changed from ll_write in Client.cc drop data to client: writes rejected by quota may truncate/zero parts of file
- Category set to Correctness/Safety
- Priority changed from Normal to Urgent
- Target version set to v14.0.0
- Source set to Community (user)
- Backport set to mimic
- Severity changed from 3 - minor to 2 - major
- Component(FS) Client added
- Labels (FS) quotas, task(medium) added
#3 Updated by Jeff Layton over 5 years ago
I think this is probably NOTABUG. The shell redirect will end up opening the destination file with O_TRUNC which will clean out the data. After that, the write is (correctly) rejected since it would overrun the quota. But, by then it's too late to save the data that was in the file before.
To correctly test this, you'd need to open the file without O_TRUNC, and then overwrite the data that's there. I'm not sure if that's possible with a shell redirect.
#4 Updated by Patrick Donnelly over 5 years ago
- Status changed from New to Rejected