Skip to content

Commit 234cddc

Browse files
committed
ceph: flush the dirty caps immediatelly when quota is approaching
jira LE-1907 Rebuild_History Non-Buildable kernel-5.14.0-427.18.1.el9_4 commit-author Xiubo Li <xiubli@redhat.com> commit e027ddb When the quota is approaching we need to notify it to the MDS as soon as possible, or the client could write to the directory more than expected. This will flush the dirty caps without delaying after each write, though this couldn't prevent the real size of a directory exceed the quota but could prevent it as soon as possible. Link: https://tracker.ceph.com/issues/56180 Signed-off-by: Xiubo Li <xiubli@redhat.com> Reviewed-by: Luís Henriques <lhenriques@suse.de> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> (cherry picked from commit e027ddb) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent cb3c722 commit 234cddc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

fs/ceph/caps.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,14 +1984,15 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags,
19841984
}
19851985

19861986
dout("check_caps %llx.%llx file_want %s used %s dirty %s flushing %s"
1987-
" issued %s revoking %s retain %s %s%s\n", ceph_vinop(inode),
1987+
" issued %s revoking %s retain %s %s%s%s\n", ceph_vinop(inode),
19881988
ceph_cap_string(file_wanted),
19891989
ceph_cap_string(used), ceph_cap_string(ci->i_dirty_caps),
19901990
ceph_cap_string(ci->i_flushing_caps),
19911991
ceph_cap_string(issued), ceph_cap_string(revoking),
19921992
ceph_cap_string(retain),
19931993
(flags & CHECK_CAPS_AUTHONLY) ? " AUTHONLY" : "",
1994-
(flags & CHECK_CAPS_FLUSH) ? " FLUSH" : "");
1994+
(flags & CHECK_CAPS_FLUSH) ? " FLUSH" : "",
1995+
(flags & CHECK_CAPS_NOINVAL) ? " NOINVAL" : "");
19951996

19961997
/*
19971998
* If we no longer need to hold onto old our caps, and we may

fs/ceph/file.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,7 +1908,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
19081908
if (dirty)
19091909
__mark_inode_dirty(inode, dirty);
19101910
if (ceph_quota_is_max_bytes_approaching(inode, iocb->ki_pos))
1911-
ceph_check_caps(ci, 0, NULL);
1911+
ceph_check_caps(ci, CHECK_CAPS_FLUSH, NULL);
19121912
}
19131913

19141914
dout("aio_write %p %llx.%llx %llu~%u dropping cap refs on %s\n",
@@ -2534,7 +2534,8 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off,
25342534
/* Let the MDS know about dst file size change */
25352535
if (ceph_inode_set_size(dst_inode, dst_off) ||
25362536
ceph_quota_is_max_bytes_approaching(dst_inode, dst_off))
2537-
ceph_check_caps(dst_ci, CHECK_CAPS_AUTHONLY, NULL);
2537+
ceph_check_caps(dst_ci, CHECK_CAPS_AUTHONLY | CHECK_CAPS_FLUSH,
2538+
NULL);
25382539
}
25392540
/* Mark Fw dirty */
25402541
spin_lock(&dst_ci->i_ceph_lock);

0 commit comments

Comments
 (0)