"Yan, Zheng" <ukernel@xxxxxxxxx> writes: ... >> + ret = ceph_get_caps(dst_ci, CEPH_CAP_FILE_WR, >> + CEPH_CAP_FILE_BUFFER, >> + endoff, &got, NULL); >> + if (ret < 0) >> + goto out; >> + > > Getting FILE_RD caps for src inode? I think adding another > ceph_get_caps() call here may cause deadlock (shouldn't hold any cap > while waiting). I thought about that initially, but since I'm using do_splice_direct for doing any manual copies I assumed that this would eventually be handled somewhere else. Because we don't really FILE_RD if we're doing only full (remote) object copies, do we? ... >> +out_caps: >> + ceph_put_cap_refs(dst_ci, got); >> +out: >> + ceph_free_cap_flush(prealloc_cf); >> + >> + return ret; >> +} > > There is no i_size check in above function. I think some corner cases > may not be handled properly Do you have any specific case in mind? I'm checking the EOF for the source file: + size = i_size_read(src_inode); + /* Don't copy beyond source file EOF */ + if (src_off + len > size) + len = (size - src_off); and the final destination file size: + size = i_size_read(dst_inode); + endoff = dst_off + len; + ret = inode_newsize_ok(dst_inode, endoff); + if (ret) + goto out; But maybe I misunderstood your question. Cheers, -- Luis