[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>
This commit is contained in:
parent
b0dd9308b7
commit
faac9bd0e3
@ -642,6 +642,7 @@ static ssize_t gfs2_direct_IO(int rw, struct kiocb *iocb,
|
|||||||
struct inode *inode = file->f_mapping->host;
|
struct inode *inode = file->f_mapping->host;
|
||||||
struct gfs2_inode *ip = GFS2_I(inode);
|
struct gfs2_inode *ip = GFS2_I(inode);
|
||||||
struct gfs2_sbd *sdp = GFS2_SB(inode);
|
struct gfs2_sbd *sdp = GFS2_SB(inode);
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (rw == WRITE)
|
if (rw == WRITE)
|
||||||
return gfs2_direct_IO_write(iocb, iov, offset, nr_segs);
|
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)))
|
gfs2_assert_warn(sdp, !gfs2_is_stuffed(ip)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
return __blockdev_direct_IO(READ, iocb, inode, inode->i_sb->s_bdev, iov,
|
mutex_lock(&inode->i_mutex);
|
||||||
offset, nr_segs, gfs2_get_block, NULL,
|
ret = __blockdev_direct_IO(READ, iocb, inode, inode->i_sb->s_bdev, iov,
|
||||||
DIO_OWN_LOCKING);
|
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 = {
|
const struct address_space_operations gfs2_file_aops = {
|
||||||
|
Loading…
Reference in New Issue
Block a user