diff options
author | Yan, Zheng <zyan@redhat.com> | 2015-12-30 11:32:46 +0800 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2016-01-21 19:36:08 +0100 |
commit | 99c88e6900fb05d267ae9f6d5e15dc7192ba6f8d (patch) | |
tree | 025263471172932f2c0b332979cf56c60ae836db /fs/ceph/addr.c | |
parent | 5be0389dac662995eade757ec678931f0be23d33 (diff) |
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.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 6dfff0ba4d98..c22213789090 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)) |