summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-07-05 08:24:34 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-07-05 08:24:34 -0400
commitfaac9bd0e3ce7cb0572ec66e0a426cacf6afa970 (patch)
tree0300e043a01d1fd48e9157749da3bd10422c0e53
parentb0dd9308b703310e9a988df70f6ed3e87cb55655 (diff)
downloadtalos-obmc-linux-faac9bd0e3ce7cb0572ec66e0a426cacf6afa970.tar.gz
talos-obmc-linux-faac9bd0e3ce7cb0572ec66e0a426cacf6afa970.zip
[GFS2] Fix locking for Direct I/O reads
We need to hold i_mutex when doing direct i/o reads. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r--fs/gfs2/ops_address.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 26db3335d4b3..27ce30148e69 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -642,6 +642,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
struct inode *inode = file->f_mapping->host;
struct gfs2_inode *ip = GFS2_I(inode);
struct gfs2_sbd *sdp = GFS2_SB(inode);
+ int ret;
if (rw == WRITE)
return gfs2_direct_IO_write(iocb, iov, offset, nr_segs);
@@ -650,9 +651,12 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
gfs2_assert_warn(sdp, !gfs2_is_stuffed(ip)))
return -EINVAL;
- return __blockdev_direct_IO(READ, iocb, inode, inode->i_sb->s_bdev, iov,
- offset, nr_segs, gfs2_get_block, NULL,
- DIO_OWN_LOCKING);
+ mutex_lock(&inode->i_mutex);
+ ret = __blockdev_direct_IO(READ, iocb, inode, inode->i_sb->s_bdev, iov,
+ offset, nr_segs, gfs2_get_block, NULL,
+ DIO_OWN_LOCKING);
+ mutex_unlock(&inode->i_mutex);
+ return ret;
}
const struct address_space_operations gfs2_file_aops = {
OpenPOWER on IntegriCloud