Skip to content

Commit

Permalink
ceph: don't check quota for snap inode
Browse files Browse the repository at this point in the history
snap inode's i_snap_realm is not pointing to ceph_snap_realm.

Signed-off-by: "Yan, Zheng" <[email protected]>
Signed-off-by: Ilya Dryomov <[email protected]>
  • Loading branch information
ukernel authored and idryomov committed Apr 2, 2018
1 parent 1ab302a commit 2596366
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 2 additions & 1 deletion fs/ceph/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,8 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
goto out;
}

if (ceph_quota_is_max_files_exceeded(dir)) {
if (op == CEPH_MDS_OP_MKDIR &&
ceph_quota_is_max_files_exceeded(dir)) {
err = -EDQUOT;
goto out;
}
Expand Down
18 changes: 16 additions & 2 deletions fs/ceph/quota.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,15 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,
struct ceph_vino vino;
struct inode *in;

if (ceph_snap(inode) != CEPH_NOSNAP)
return NULL;

realm = ceph_inode(inode)->i_snap_realm;
ceph_get_snap_realm(mdsc, realm);
if (realm)
ceph_get_snap_realm(mdsc, realm);
else
pr_err_ratelimited("get_quota_realm: ino (%llx.%llx) "
"null i_snap_realm\n", ceph_vinop(inode));
while (realm) {
vino.ino = realm->ino;
vino.snap = CEPH_NOSNAP;
Expand Down Expand Up @@ -158,9 +165,16 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
bool is_root;
bool exceeded = false;

if (ceph_snap(inode) != CEPH_NOSNAP)
return false;

down_read(&mdsc->snap_rwsem);
realm = ceph_inode(inode)->i_snap_realm;
ceph_get_snap_realm(mdsc, realm);
if (realm)
ceph_get_snap_realm(mdsc, realm);
else
pr_err_ratelimited("check_quota_exceeded: ino (%llx.%llx) "
"null i_snap_realm\n", ceph_vinop(inode));
while (realm) {
vino.ino = realm->ino;
vino.snap = CEPH_NOSNAP;
Expand Down

0 comments on commit 2596366

Please sign in to comment.