diff options
author | Luis Henriques <lhenriques@suse.com> | 2018-01-05 05:47:19 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2018-04-02 05:17:51 -0400 |
commit | b7a2921765cf796280baf653a52b22b52e0ba266 (patch) | |
tree | a7c6aad0d8aac1da1789b09c37a1852ef65c9c5c /fs/ceph/file.c | |
parent | fb18a57568c2b84cd611e242c0f6fa97b45e4907 (diff) |
ceph: quota: support for ceph.quota.max_files
This patch adds support for the max_files quota. It hooks into all the
ceph functions that add new filesystem objects that need to be checked
against the quota limits. When these limits are hit, -EDQUOT is returned.
Note that we're not checking quotas on ceph_link(). ceph_link doesn't
really create a new inode, and since the MDS doesn't update the directory
statistics when a new (hard) link is created (only with symlinks), they
are not accounted as a new file.
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/file.c')
-rw-r--r-- | fs/ceph/file.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 4a92acba1e9c..c3042330e0e9 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -402,7 +402,7 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry, | |||
402 | struct ceph_mds_request *req; | 402 | struct ceph_mds_request *req; |
403 | struct dentry *dn; | 403 | struct dentry *dn; |
404 | struct ceph_acls_info acls = {}; | 404 | struct ceph_acls_info acls = {}; |
405 | int mask; | 405 | int mask; |
406 | int err; | 406 | int err; |
407 | 407 | ||
408 | dout("atomic_open %p dentry %p '%pd' %s flags %d mode 0%o\n", | 408 | dout("atomic_open %p dentry %p '%pd' %s flags %d mode 0%o\n", |
@@ -413,6 +413,8 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry, | |||
413 | return -ENAMETOOLONG; | 413 | return -ENAMETOOLONG; |
414 | 414 | ||
415 | if (flags & O_CREAT) { | 415 | if (flags & O_CREAT) { |
416 | if (ceph_quota_is_max_files_exceeded(dir)) | ||
417 | return -EDQUOT; | ||
416 | err = ceph_pre_init_acls(dir, &mode, &acls); | 418 | err = ceph_pre_init_acls(dir, &mode, &acls); |
417 | if (err < 0) | 419 | if (err < 0) |
418 | return err; | 420 | return err; |