diff options
-rw-r--r-- | fs/gfs2/ops_address.c | 10 |
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, | |||
642 | struct inode *inode = file->f_mapping->host; | 642 | struct inode *inode = file->f_mapping->host; |
643 | struct gfs2_inode *ip = GFS2_I(inode); | 643 | struct gfs2_inode *ip = GFS2_I(inode); |
644 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 644 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
645 | int ret; | ||
645 | 646 | ||
646 | if (rw == WRITE) | 647 | if (rw == WRITE) |
647 | return gfs2_direct_IO_write(iocb, iov, offset, nr_segs); | 648 | 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, | |||
650 | gfs2_assert_warn(sdp, !gfs2_is_stuffed(ip))) | 651 | gfs2_assert_warn(sdp, !gfs2_is_stuffed(ip))) |
651 | return -EINVAL; | 652 | return -EINVAL; |
652 | 653 | ||
653 | return __blockdev_direct_IO(READ, iocb, inode, inode->i_sb->s_bdev, iov, | 654 | mutex_lock(&inode->i_mutex); |
654 | offset, nr_segs, gfs2_get_block, NULL, | 655 | ret = __blockdev_direct_IO(READ, iocb, inode, inode->i_sb->s_bdev, iov, |
655 | DIO_OWN_LOCKING); | 656 | offset, nr_segs, gfs2_get_block, NULL, |
657 | DIO_OWN_LOCKING); | ||
658 | mutex_unlock(&inode->i_mutex); | ||
659 | return ret; | ||
656 | } | 660 | } |
657 | 661 | ||
658 | const struct address_space_operations gfs2_file_aops = { | 662 | const struct address_space_operations gfs2_file_aops = { |