diff --git a/fs/cifs/file.c b/fs/cifs/file.c index eb61cecf42d6..eb9b34442b1d 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3877,6 +3877,15 @@ static ssize_t __cifs_readv( len = ctx->len; } + if (direct) { + rc = filemap_write_and_wait_range(file->f_inode->i_mapping, + offset, offset + len - 1); + if (rc) { + kref_put(&ctx->refcount, cifs_aio_ctx_release); + return -EAGAIN; + } + } + /* grab a lock here due to read response handlers can access ctx */ mutex_lock(&ctx->aio_mutex);