Project

General

Profile

Actions

Bug #56180

closed

kclient: we always could write more data to the file than the quota limit

Added by Xiubo Li almost 2 years ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Crash signature (v1):
Crash signature (v2):

Description

Create a directory and set the quota and then write data to it, in some special case the write could succeed without any error:

$ mkdir testdir
$ setfattr -n ceph.quota.max_bytes -v 123 testdir

If the bs is larger than the quota value 123 it will fail:

$ dd if=/dev/zero of=testdir/myfile bs=125 count=1
dd: error writing 'testdir/myfile': Disk quota exceeded
1+0 records in
0+0 records out
0 bytes copied, 0.00203766 s, 0.0 kB/s

$ ll testdir/
total 0
-rw-r--r--. 1 root root 0 Jun 23 13:24 myfile

But if the bs is less than the quota value 123 it will succeed:

$ dd if=/dev/zero of=testdir2/myfile bs=120 count=10000
10000+0 records in
10000+0 records out
1200000 bytes (1.2 MB, 1.1 MiB) copied, 2.25494 s, 532 kB/s

$ ll testdir/
total 1172
-rw-r--r--. 1 root root 1200000 Jun 23 13:43 myfile
Actions #1

Updated by Xiubo Li almost 2 years ago

  • Status changed from New to In Progress
Actions #2

Updated by Xiubo Li almost 2 years ago

We need to flush the dirty caps without delaying when the quota is approaching after each write, but we still couldn't prevent the real size of the directory exceed the quota, but could prevent it as soon as possible:

[root@lxbceph1 kcephfs]# dd if=/dev/zero of=testdir/myfile2 bs=120 count=10000
dd: error writing 'testdir/myfile2': Disk quota exceeded
50+0 records in
49+0 records out
5880 bytes (5.9 kB, 5.7 KiB) copied, 0.0241355 s, 244 kB/s
[root@lxbceph1 kcephfs]# ll testdir/
total 6
-rw-r--r--. 1 root root 5880 Jun 23 17:14 myfile2
[root@lxbceph1 kcephfs]# dd if=/dev/zero of=testdir/myfile2 bs=120 count=10000
dd: error writing 'testdir/myfile2': Disk quota exceeded
64+0 records in
63+0 records out
7560 bytes (7.6 kB, 7.4 KiB) copied, 0.0281837 s, 268 kB/s
[root@lxbceph1 kcephfs]# ll testdir/
total 8
-rw-r--r--. 1 root root 7560 Jun 23 17:14 myfile2
[root@lxbceph1 kcephfs]# dd if=/dev/zero of=testdir/myfile2 bs=120 count=10000
dd: error writing 'testdir/myfile2': Disk quota exceeded
51+0 records in
50+0 records out
6000 bytes (6.0 kB, 5.9 KiB) copied, 0.029263 s, 205 kB/s
[root@lxbceph1 kcephfs]# ll testdir/
total 6
-rw-r--r--. 1 root root 6000 Jun 23 17:14 myfile2
[root@lxbceph1 kcephfs]# dd if=/dev/zero of=testdir/myfile2 bs=120 count=10000
dd: error writing 'testdir/myfile2': Disk quota exceeded
49+0 records in
48+0 records out
5760 bytes (5.8 kB, 5.6 KiB) copied, 0.0298516 s, 193 kB/s
[root@lxbceph1 kcephfs]# ll testdir/
total 6
-rw-r--r--. 1 root root 5760 Jun 23 17:14 myfile2
[root@lxbceph1 kcephfs]# dd if=/dev/zero of=testdir/myfile2 bs=120 count=10000
dd: error writing 'testdir/myfile2': Disk quota exceeded
8+0 records in
7+0 records out
840 bytes copied, 0.0319263 s, 26.3 kB/s
Actions #4

Updated by Xiubo Li almost 2 years ago

  • Status changed from In Progress to Fix Under Review
Actions #5

Updated by Xiubo Li over 1 year ago

  • Status changed from Fix Under Review to Resolved

Applied to the mainline and closing this tracker.

Actions

Also available in: Atom PDF