diff options
author | Alex Shi <alex.shi@linaro.org> | 2017-11-26 12:03:43 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2017-11-26 12:03:43 +0800 |
commit | 2af79bd1142d88667c40bb5cc65a3cd91db5a6c0 (patch) | |
tree | 73f57f5a9c57b0ab22fa456bc6926467c94e9099 /fs/ocfs2/file.c | |
parent | d5aff662273133ff050acb8cac683d5f73c5fbf3 (diff) | |
parent | 133e6ccf46f1704a4a680ef45565e970ac9a7f9c (diff) |
Merge tag 'v4.9.65' into linux-linaro-lsk-v4.9lsk-v4.9-17.11
This is the 4.9.65 stable release
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 0db6f83fdea1..05a0fb9854f9 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, |