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>
This commit is contained in:

committed by
Ilya Dryomov

parent
fb18a57568
commit
b7a2921765
@@ -402,7 +402,7 @@ int ceph_atomic_open(struct inode *dir, struct dentry *dentry,
|
||||
struct ceph_mds_request *req;
|
||||
struct dentry *dn;
|
||||
struct ceph_acls_info acls = {};
|
||||
int mask;
|
||||
int mask;
|
||||
int err;
|
||||
|
||||
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,
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
if (flags & O_CREAT) {
|
||||
if (ceph_quota_is_max_files_exceeded(dir))
|
||||
return -EDQUOT;
|
||||
err = ceph_pre_init_acls(dir, &mode, &acls);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
Reference in New Issue
Block a user