|
@@ -500,16 +500,17 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
|
|
if (!count)
|
|
if (!count)
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
|
|
+ mutex_lock(&inode->i_mutex);
|
|
result = nfs_sync_mapping(mapping);
|
|
result = nfs_sync_mapping(mapping);
|
|
if (result)
|
|
if (result)
|
|
- goto out;
|
|
|
|
|
|
+ goto out_unlock;
|
|
|
|
|
|
task_io_account_read(count);
|
|
task_io_account_read(count);
|
|
|
|
|
|
result = -ENOMEM;
|
|
result = -ENOMEM;
|
|
dreq = nfs_direct_req_alloc();
|
|
dreq = nfs_direct_req_alloc();
|
|
if (dreq == NULL)
|
|
if (dreq == NULL)
|
|
- goto out;
|
|
|
|
|
|
+ goto out_unlock;
|
|
|
|
|
|
dreq->inode = inode;
|
|
dreq->inode = inode;
|
|
dreq->bytes_left = iov_length(iov, nr_segs);
|
|
dreq->bytes_left = iov_length(iov, nr_segs);
|
|
@@ -525,13 +526,22 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, const struct iovec *iov,
|
|
|
|
|
|
NFS_I(inode)->read_io += iov_length(iov, nr_segs);
|
|
NFS_I(inode)->read_io += iov_length(iov, nr_segs);
|
|
result = nfs_direct_read_schedule_iovec(dreq, iov, nr_segs, pos, uio);
|
|
result = nfs_direct_read_schedule_iovec(dreq, iov, nr_segs, pos, uio);
|
|
|
|
+
|
|
|
|
+ mutex_unlock(&inode->i_mutex);
|
|
|
|
+
|
|
if (!result) {
|
|
if (!result) {
|
|
result = nfs_direct_wait(dreq);
|
|
result = nfs_direct_wait(dreq);
|
|
if (result > 0)
|
|
if (result > 0)
|
|
iocb->ki_pos = pos + result;
|
|
iocb->ki_pos = pos + result;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ nfs_direct_req_release(dreq);
|
|
|
|
+ return result;
|
|
|
|
+
|
|
out_release:
|
|
out_release:
|
|
nfs_direct_req_release(dreq);
|
|
nfs_direct_req_release(dreq);
|
|
|
|
+out_unlock:
|
|
|
|
+ mutex_unlock(&inode->i_mutex);
|
|
out:
|
|
out:
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|