提交 a3d714c3 编写于 作者: Y Yan, Zheng 提交者: Ilya Dryomov

ceph: avoid updating directory inode's i_size accidentally

Directory inode's i_size is used by readdir cache.
Signed-off-by: NYan, Zheng <zyan@redhat.com>
上级 af5e5eb5
...@@ -549,6 +549,10 @@ int ceph_fill_file_size(struct inode *inode, int issued, ...@@ -549,6 +549,10 @@ int ceph_fill_file_size(struct inode *inode, int issued,
if (ceph_seq_cmp(truncate_seq, ci->i_truncate_seq) > 0 || if (ceph_seq_cmp(truncate_seq, ci->i_truncate_seq) > 0 ||
(truncate_seq == ci->i_truncate_seq && size > inode->i_size)) { (truncate_seq == ci->i_truncate_seq && size > inode->i_size)) {
dout("size %lld -> %llu\n", inode->i_size, size); dout("size %lld -> %llu\n", inode->i_size, size);
if (size > 0 && S_ISDIR(inode->i_mode)) {
pr_err("fill_file_size non-zero size for directory\n");
size = 0;
}
i_size_write(inode, size); i_size_write(inode, size);
inode->i_blocks = (size + (1<<9) - 1) >> 9; inode->i_blocks = (size + (1<<9) - 1) >> 9;
ci->i_reported_size = size; ci->i_reported_size = size;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册