summaryrefslogtreecommitdiffstats
path: root/fs/ceph/addr.c
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2015-12-30 11:32:46 +0800
committerIlya Dryomov <idryomov@gmail.com>2016-01-21 19:36:08 +0100
commit99c88e6900fb05d267ae9f6d5e15dc7192ba6f8d (patch)
tree025263471172932f2c0b332979cf56c60ae836db /fs/ceph/addr.c
parent5be0389dac662995eade757ec678931f0be23d33 (diff)
downloadop-kernel-dev-99c88e6900fb05d267ae9f6d5e15dc7192ba6f8d.zip
op-kernel-dev-99c88e6900fb05d267ae9f6d5e15dc7192ba6f8d.tar.gz
ceph: use i_size_{read,write} to get/set i_size
Cap message from MDS can update i_size. In that case, we don't hold i_mutex. So it's unsafe to directly access inode->i_size while holding i_mutex. Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph/addr.c')
-rw-r--r--fs/ceph/addr.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 6dfff0b..c2221378 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -1108,7 +1108,7 @@ retry_locked:
return 0;
/* past end of file? */
- i_size = inode->i_size; /* caller holds i_mutex */
+ i_size = i_size_read(inode);
if (page_off >= i_size ||
(pos_in_page == 0 && (pos+len) >= i_size &&
@@ -1183,8 +1183,7 @@ static int ceph_write_end(struct file *file, struct address_space *mapping,
zero_user_segment(page, from+copied, len);
/* did file size increase? */
- /* (no need for i_size_read(); we caller holds i_mutex */
- if (pos+copied > inode->i_size)
+ if (pos+copied > i_size_read(inode))
check_cap = ceph_inode_set_size(inode, pos+copied);
if (!PageUptodate(page))
OpenPOWER on IntegriCloud