Commit c4374f8a authored by Mark Fasheh's avatar Mark Fasheh

ocfs2: take meta data lock in ocfs2_file_aio_read()

Temporarily take the meta data lock in ocfs2_file_aio_read() to allow us to
update our inode fields.
Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
parent 53013cba
...@@ -1168,6 +1168,22 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, ...@@ -1168,6 +1168,22 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
ocfs2_iocb_set_rw_locked(iocb); ocfs2_iocb_set_rw_locked(iocb);
} }
/*
* We're fine letting folks race truncates and extending
* writes with read across the cluster, just like they can
* locally. Hence no rw_lock during read.
*
* Take and drop the meta data lock to update inode fields
* like i_size. This allows the checks down below
* generic_file_aio_read() a chance of actually working.
*/
ret = ocfs2_meta_lock(inode, NULL, NULL, 0);
if (ret < 0) {
mlog_errno(ret);
goto bail;
}
ocfs2_meta_unlock(inode, 0);
ret = generic_file_aio_read(iocb, buf, count, iocb->ki_pos); ret = generic_file_aio_read(iocb, buf, count, iocb->ki_pos);
if (ret == -EINVAL) if (ret == -EINVAL)
mlog(ML_ERROR, "generic_file_aio_read returned -EINVAL\n"); mlog(ML_ERROR, "generic_file_aio_read returned -EINVAL\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment