mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-07 14:32:23 +00:00
NFS: Fix nfs_direct_dirty_pages()
We only need to dirty the pages that were actually read in. Also convert nfs_direct_dirty_pages() to call set_page_dirty() instead of set_page_dirty_lock(). A call to lock_page() is unacceptable in an rpciod callback function. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
749e146e01
commit
d4a8f3677f
@ -122,13 +122,19 @@ ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nfs_direct_dirty_pages(struct page **pages, unsigned int npages)
|
static void nfs_direct_dirty_pages(struct page **pages, unsigned int pgbase, size_t count)
|
||||||
{
|
{
|
||||||
|
unsigned int npages;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
if (count == 0)
|
||||||
|
return;
|
||||||
|
pages += (pgbase >> PAGE_SHIFT);
|
||||||
|
npages = (count + (pgbase & ~PAGE_MASK) + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||||
for (i = 0; i < npages; i++) {
|
for (i = 0; i < npages; i++) {
|
||||||
struct page *page = pages[i];
|
struct page *page = pages[i];
|
||||||
if (!PageCompound(page))
|
if (!PageCompound(page))
|
||||||
set_page_dirty_lock(page);
|
set_page_dirty(page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,17 +230,18 @@ static void nfs_direct_read_result(struct rpc_task *task, void *calldata)
|
|||||||
if (nfs_readpage_result(task, data) != 0)
|
if (nfs_readpage_result(task, data) != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nfs_direct_dirty_pages(data->pagevec, data->npages);
|
|
||||||
nfs_direct_release_pages(data->pagevec, data->npages);
|
|
||||||
|
|
||||||
spin_lock(&dreq->lock);
|
spin_lock(&dreq->lock);
|
||||||
|
if (unlikely(task->tk_status < 0)) {
|
||||||
if (likely(task->tk_status >= 0))
|
|
||||||
dreq->count += data->res.count;
|
|
||||||
else
|
|
||||||
dreq->error = task->tk_status;
|
dreq->error = task->tk_status;
|
||||||
|
spin_unlock(&dreq->lock);
|
||||||
spin_unlock(&dreq->lock);
|
} else {
|
||||||
|
dreq->count += data->res.count;
|
||||||
|
spin_unlock(&dreq->lock);
|
||||||
|
nfs_direct_dirty_pages(data->pagevec,
|
||||||
|
data->args.pgbase,
|
||||||
|
data->res.count);
|
||||||
|
}
|
||||||
|
nfs_direct_release_pages(data->pagevec, data->npages);
|
||||||
|
|
||||||
if (put_dreq(dreq))
|
if (put_dreq(dreq))
|
||||||
nfs_direct_complete(dreq);
|
nfs_direct_complete(dreq);
|
||||||
|
Loading…
Reference in New Issue
Block a user