Skip to content

Commit 2596366

Browse files
ukernelidryomov
authored andcommitted
ceph: don't check quota for snap inode
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]>
1 parent 1ab302a commit 2596366

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

fs/ceph/dir.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,8 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
936936
goto out;
937937
}
938938

939-
if (ceph_quota_is_max_files_exceeded(dir)) {
939+
if (op == CEPH_MDS_OP_MKDIR &&
940+
ceph_quota_is_max_files_exceeded(dir)) {
940941
err = -EDQUOT;
941942
goto out;
942943
}

fs/ceph/quota.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,15 @@ static struct ceph_snap_realm *get_quota_realm(struct ceph_mds_client *mdsc,
8686
struct ceph_vino vino;
8787
struct inode *in;
8888

89+
if (ceph_snap(inode) != CEPH_NOSNAP)
90+
return NULL;
91+
8992
realm = ceph_inode(inode)->i_snap_realm;
90-
ceph_get_snap_realm(mdsc, realm);
93+
if (realm)
94+
ceph_get_snap_realm(mdsc, realm);
95+
else
96+
pr_err_ratelimited("get_quota_realm: ino (%llx.%llx) "
97+
"null i_snap_realm\n", ceph_vinop(inode));
9198
while (realm) {
9299
vino.ino = realm->ino;
93100
vino.snap = CEPH_NOSNAP;
@@ -158,9 +165,16 @@ static bool check_quota_exceeded(struct inode *inode, enum quota_check_op op,
158165
bool is_root;
159166
bool exceeded = false;
160167

168+
if (ceph_snap(inode) != CEPH_NOSNAP)
169+
return false;
170+
161171
down_read(&mdsc->snap_rwsem);
162172
realm = ceph_inode(inode)->i_snap_realm;
163-
ceph_get_snap_realm(mdsc, realm);
173+
if (realm)
174+
ceph_get_snap_realm(mdsc, realm);
175+
else
176+
pr_err_ratelimited("check_quota_exceeded: ino (%llx.%llx) "
177+
"null i_snap_realm\n", ceph_vinop(inode));
164178
while (realm) {
165179
vino.ino = realm->ino;
166180
vino.snap = CEPH_NOSNAP;

0 commit comments

Comments
 (0)