mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +08:00
ceph: don't get the inline data for new creating files
If the 'i_inline_version' is 1, that means the file is just new created and there shouldn't have any inline data in it, we should skip retrieving the inline data from MDS. This also could help reduce possiblity of dead lock issue introduce by the inline data and Fcr caps. Gradually we will remove the inline feature from kclient after ceph's scrub too have support to unline the inline data, currently this could help reduce the teuthology test failures. This is possiblly could also fix a bug that for some old clients if they couldn't explictly uninline the inline data when writing, the inline version will keep as 1 always. We may always reading non-exist data from inline data. Signed-off-by: Xiubo Li <xiubli@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
0006164589
commit
4849077604
@ -313,8 +313,7 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
|
||||
int err = 0;
|
||||
u64 len = subreq->len;
|
||||
|
||||
if (ci->i_inline_version != CEPH_INLINE_NONE &&
|
||||
ceph_netfs_issue_op_inline(subreq))
|
||||
if (ceph_has_inline_data(ci) && ceph_netfs_issue_op_inline(subreq))
|
||||
return;
|
||||
|
||||
req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, vino, subreq->start, &len,
|
||||
@ -1439,7 +1438,7 @@ static vm_fault_t ceph_filemap_fault(struct vm_fault *vmf)
|
||||
inode, off, ceph_cap_string(got));
|
||||
|
||||
if ((got & (CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_LAZYIO)) ||
|
||||
ci->i_inline_version == CEPH_INLINE_NONE) {
|
||||
!ceph_has_inline_data(ci)) {
|
||||
CEPH_DEFINE_RW_CONTEXT(rw_ctx, got);
|
||||
ceph_add_rw_context(fi, &rw_ctx);
|
||||
ret = filemap_fault(vmf);
|
||||
|
@ -3005,7 +3005,7 @@ int ceph_get_caps(struct file *filp, int need, int want, loff_t endoff, int *got
|
||||
}
|
||||
|
||||
if (S_ISREG(ci->netfs.inode.i_mode) &&
|
||||
ci->i_inline_version != CEPH_INLINE_NONE &&
|
||||
ceph_has_inline_data(ci) &&
|
||||
(_got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) &&
|
||||
i_size_read(inode) > 0) {
|
||||
struct page *page =
|
||||
|
@ -241,8 +241,7 @@ static int ceph_init_file_info(struct inode *inode, struct file *file,
|
||||
INIT_LIST_HEAD(&fi->rw_contexts);
|
||||
fi->filp_gen = READ_ONCE(ceph_inode_to_client(inode)->filp_gen);
|
||||
|
||||
if ((file->f_mode & FMODE_WRITE) &&
|
||||
ci->i_inline_version != CEPH_INLINE_NONE) {
|
||||
if ((file->f_mode & FMODE_WRITE) && ceph_has_inline_data(ci)) {
|
||||
ret = ceph_uninline_data(file);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
@ -1650,7 +1649,7 @@ again:
|
||||
inode, ceph_vinop(inode), iocb->ki_pos, (unsigned)len,
|
||||
ceph_cap_string(got));
|
||||
|
||||
if (ci->i_inline_version == CEPH_INLINE_NONE) {
|
||||
if (!ceph_has_inline_data(ci)) {
|
||||
if (!retry_op && (iocb->ki_flags & IOCB_DIRECT)) {
|
||||
ret = ceph_direct_read_write(iocb, to,
|
||||
NULL, NULL);
|
||||
|
@ -1049,7 +1049,7 @@ int ceph_fill_inode(struct inode *inode, struct page *locked_page,
|
||||
iinfo->inline_version >= ci->i_inline_version) {
|
||||
int cache_caps = CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_LAZYIO;
|
||||
ci->i_inline_version = iinfo->inline_version;
|
||||
if (ci->i_inline_version != CEPH_INLINE_NONE &&
|
||||
if (ceph_has_inline_data(ci) &&
|
||||
(locked_page || (info_caps & cache_caps)))
|
||||
fill_inline = true;
|
||||
}
|
||||
@ -2327,7 +2327,8 @@ int __ceph_do_getattr(struct inode *inode, struct page *locked_page,
|
||||
if (inline_version == 0) {
|
||||
/* the reply is supposed to contain inline data */
|
||||
err = -EINVAL;
|
||||
} else if (inline_version == CEPH_INLINE_NONE) {
|
||||
} else if (inline_version == CEPH_INLINE_NONE ||
|
||||
inline_version == 1) {
|
||||
err = -ENODATA;
|
||||
} else {
|
||||
err = req->r_reply_info.targeti.inline_len;
|
||||
|
@ -1231,6 +1231,14 @@ extern int ceph_pool_perm_check(struct inode *inode, int need);
|
||||
extern void ceph_pool_perm_destroy(struct ceph_mds_client* mdsc);
|
||||
int ceph_purge_inode_cap(struct inode *inode, struct ceph_cap *cap, bool *invalidate);
|
||||
|
||||
static inline bool ceph_has_inline_data(struct ceph_inode_info *ci)
|
||||
{
|
||||
if (ci->i_inline_version == CEPH_INLINE_NONE ||
|
||||
ci->i_inline_version == 1) /* initial version, no data */
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* file.c */
|
||||
extern const struct file_operations ceph_file_fops;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user