summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2006-05-05 19:04:35 -0700
committerMark Fasheh <mark.fasheh@oracle.com>2006-05-17 14:38:47 -0700
commitc4374f8a6093fbee42ac4368b3ca180d1d0c7c6d (patch)
tree6e52cb1f85a5e769bd9f23e0e59d266767e25dcf /fs
parent53013cba4118a5cfe8f7c7ea5e5bc1c48b160f76 (diff)
downloadop-kernel-dev-c4374f8a6093fbee42ac4368b3ca180d1d0c7c6d.zip
op-kernel-dev-c4374f8a6093fbee42ac4368b3ca180d1d0c7c6d.tar.gz
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: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/file.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 20fffeed..a9559c8 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1168,6 +1168,22 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *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);
if (ret == -EINVAL)
mlog(ML_ERROR, "generic_file_aio_read returned -EINVAL\n");
OpenPOWER on IntegriCloud