diff options
author | Alex Shi <alex.shi@linaro.org> | 2017-11-30 12:02:52 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2017-11-30 12:02:52 +0800 |
commit | f83b09c3edc03ebcb59e65d6c37bc1bdb49b8210 (patch) | |
tree | 4617c279cb52c31774284c0bde1ab4fce7efb482 /fs/ocfs2/file.c | |
parent | c19848defd4890f84d733c14b73dcbc87ea180a4 (diff) | |
parent | eddc563b9850ce692c6040ef0f4575aea2396d33 (diff) |
Merge remote-tracking branch 'rt-stable/v4.4-rt' into linux-linaro-lsk-v4.4-rtlsk-v4.4-17.11-rt
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r-- | fs/ocfs2/file.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 1d738723a41a..501ecc4a1ac4 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -1166,6 +1166,13 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) } size_change = S_ISREG(inode->i_mode) && attr->ia_valid & ATTR_SIZE; if (size_change) { + /* + * Here we should wait dio to finish before inode lock + * to avoid a deadlock between ocfs2_setattr() and + * ocfs2_dio_end_io_write() + */ + inode_dio_wait(inode); + status = ocfs2_rw_lock(inode, 1); if (status < 0) { mlog_errno(status); @@ -1186,8 +1193,6 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) if (status) goto bail_unlock; - inode_dio_wait(inode); - if (i_size_read(inode) >= attr->ia_size) { if (ocfs2_should_order_data(inode)) { status = ocfs2_begin_ordered_truncate(inode, |