[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    ceph: avoid updating directory inode's i_size accidentally
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2016-03-26 23:04:44
Message-ID: 20160326230444.CCBE7660FAF () gitolite ! kernel ! org
[Download RAW message or body]

Web:        https://git.kernel.org/torvalds/c/a3d714c33632ef6bfdfaacc74ae6ba297b4c5820
Commit:     a3d714c33632ef6bfdfaacc74ae6ba297b4c5820
Parent:     af5e5eb574776cdf1b756a27cc437bff257e22fe
Refname:    refs/heads/master
Author:     Yan, Zheng <zyan@redhat.com>
AuthorDate: Fri Feb 26 17:16:32 2016 +0800
Committer:  Ilya Dryomov <idryomov@gmail.com>
CommitDate: Fri Mar 25 18:51:53 2016 +0100

    ceph: avoid updating directory inode's i_size accidentally
    
    Directory inode's i_size is used by readdir cache.
    
    Signed-off-by: Yan, Zheng <zyan@redhat.com>
---
 fs/ceph/inode.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 495decf..66edef1 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -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 ||
 	    (truncate_seq == ci->i_truncate_seq && size > inode->i_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);
 		inode->i_blocks = (size + (1<<9) - 1) >> 9;
 		ci->i_reported_size = size;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic