Commit deed85e7 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Remove BUG_ON() calls from the generic writeback code

...and ensure that we set the return value for nfs_page_async_flush()
to zero! (Reported-by: Dros Adamson)
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent bc5a89b3
...@@ -239,21 +239,18 @@ int nfs_congestion_kb; ...@@ -239,21 +239,18 @@ int nfs_congestion_kb;
#define NFS_CONGESTION_OFF_THRESH \ #define NFS_CONGESTION_OFF_THRESH \
(NFS_CONGESTION_ON_THRESH - (NFS_CONGESTION_ON_THRESH >> 2)) (NFS_CONGESTION_ON_THRESH - (NFS_CONGESTION_ON_THRESH >> 2))
static int nfs_set_page_writeback(struct page *page) static void nfs_set_page_writeback(struct page *page)
{ {
struct nfs_server *nfss = NFS_SERVER(page_file_mapping(page)->host);
int ret = test_set_page_writeback(page); int ret = test_set_page_writeback(page);
if (!ret) { WARN_ON_ONCE(ret != 0);
struct inode *inode = page_file_mapping(page)->host;
struct nfs_server *nfss = NFS_SERVER(inode);
if (atomic_long_inc_return(&nfss->writeback) > if (atomic_long_inc_return(&nfss->writeback) >
NFS_CONGESTION_ON_THRESH) { NFS_CONGESTION_ON_THRESH) {
set_bdi_congested(&nfss->backing_dev_info, set_bdi_congested(&nfss->backing_dev_info,
BLK_RW_ASYNC); BLK_RW_ASYNC);
}
} }
return ret;
} }
static void nfs_end_page_writeback(struct page *page) static void nfs_end_page_writeback(struct page *page)
...@@ -315,10 +312,10 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, ...@@ -315,10 +312,10 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
if (IS_ERR(req)) if (IS_ERR(req))
goto out; goto out;
ret = nfs_set_page_writeback(page); nfs_set_page_writeback(page);
BUG_ON(ret != 0); WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags));
BUG_ON(test_bit(PG_CLEAN, &req->wb_flags));
ret = 0;
if (!nfs_pageio_add_request(pgio, req)) { if (!nfs_pageio_add_request(pgio, req)) {
nfs_redirty_request(req); nfs_redirty_request(req);
ret = pgio->pg_error; ret = pgio->pg_error;
...@@ -451,8 +448,6 @@ static void nfs_inode_remove_request(struct nfs_page *req) ...@@ -451,8 +448,6 @@ static void nfs_inode_remove_request(struct nfs_page *req)
struct inode *inode = req->wb_context->dentry->d_inode; struct inode *inode = req->wb_context->dentry->d_inode;
struct nfs_inode *nfsi = NFS_I(inode); struct nfs_inode *nfsi = NFS_I(inode);
BUG_ON (!NFS_WBACK_BUSY(req));
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
if (likely(!PageSwapCache(req->wb_page))) { if (likely(!PageSwapCache(req->wb_page))) {
set_page_private(req->wb_page, 0); set_page_private(req->wb_page, 0);
...@@ -1727,7 +1722,6 @@ int nfs_wb_page_cancel(struct inode *inode, struct page *page) ...@@ -1727,7 +1722,6 @@ int nfs_wb_page_cancel(struct inode *inode, struct page *page)
struct nfs_page *req; struct nfs_page *req;
int ret = 0; int ret = 0;
BUG_ON(!PageLocked(page));
for (;;) { for (;;) {
wait_on_page_writeback(page); wait_on_page_writeback(page);
req = nfs_page_find_request(page); req = nfs_page_find_request(page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment