diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-15 15:02:01 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-11-04 14:43:39 -0500 |
commit | deed85e760c8c88cd984c5921dd8cb6b697b6134 (patch) | |
tree | 39f7e3261acf4c1c306d3e87c7f31957659488b4 /fs/nfs/write.c | |
parent | bc5a89b337ee4b2fa6f577e7e1220d8c1ece71fc (diff) |
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: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r-- | fs/nfs/write.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 9347ab7c9574..f5bc8e11713b 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -239,21 +239,18 @@ int nfs_congestion_kb; | |||
239 | #define NFS_CONGESTION_OFF_THRESH \ | 239 | #define NFS_CONGESTION_OFF_THRESH \ |
240 | (NFS_CONGESTION_ON_THRESH - (NFS_CONGESTION_ON_THRESH >> 2)) | 240 | (NFS_CONGESTION_ON_THRESH - (NFS_CONGESTION_ON_THRESH >> 2)) |
241 | 241 | ||
242 | static int nfs_set_page_writeback(struct page *page) | 242 | static void nfs_set_page_writeback(struct page *page) |
243 | { | 243 | { |
244 | struct nfs_server *nfss = NFS_SERVER(page_file_mapping(page)->host); | ||
244 | int ret = test_set_page_writeback(page); | 245 | int ret = test_set_page_writeback(page); |
245 | 246 | ||
246 | if (!ret) { | 247 | WARN_ON_ONCE(ret != 0); |
247 | struct inode *inode = page_file_mapping(page)->host; | ||
248 | struct nfs_server *nfss = NFS_SERVER(inode); | ||
249 | 248 | ||
250 | if (atomic_long_inc_return(&nfss->writeback) > | 249 | if (atomic_long_inc_return(&nfss->writeback) > |
251 | NFS_CONGESTION_ON_THRESH) { | 250 | NFS_CONGESTION_ON_THRESH) { |
252 | set_bdi_congested(&nfss->backing_dev_info, | 251 | set_bdi_congested(&nfss->backing_dev_info, |
253 | BLK_RW_ASYNC); | 252 | BLK_RW_ASYNC); |
254 | } | ||
255 | } | 253 | } |
256 | return ret; | ||
257 | } | 254 | } |
258 | 255 | ||
259 | static void nfs_end_page_writeback(struct page *page) | 256 | 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 | if (IS_ERR(req)) | 312 | if (IS_ERR(req)) |
316 | goto out; | 313 | goto out; |
317 | 314 | ||
318 | ret = nfs_set_page_writeback(page); | 315 | nfs_set_page_writeback(page); |
319 | BUG_ON(ret != 0); | 316 | WARN_ON_ONCE(test_bit(PG_CLEAN, &req->wb_flags)); |
320 | BUG_ON(test_bit(PG_CLEAN, &req->wb_flags)); | ||
321 | 317 | ||
318 | ret = 0; | ||
322 | if (!nfs_pageio_add_request(pgio, req)) { | 319 | if (!nfs_pageio_add_request(pgio, req)) { |
323 | nfs_redirty_request(req); | 320 | nfs_redirty_request(req); |
324 | ret = pgio->pg_error; | 321 | ret = pgio->pg_error; |
@@ -451,8 +448,6 @@ static void nfs_inode_remove_request(struct nfs_page *req) | |||
451 | struct inode *inode = req->wb_context->dentry->d_inode; | 448 | struct inode *inode = req->wb_context->dentry->d_inode; |
452 | struct nfs_inode *nfsi = NFS_I(inode); | 449 | struct nfs_inode *nfsi = NFS_I(inode); |
453 | 450 | ||
454 | BUG_ON (!NFS_WBACK_BUSY(req)); | ||
455 | |||
456 | spin_lock(&inode->i_lock); | 451 | spin_lock(&inode->i_lock); |
457 | if (likely(!PageSwapCache(req->wb_page))) { | 452 | if (likely(!PageSwapCache(req->wb_page))) { |
458 | set_page_private(req->wb_page, 0); | 453 | set_page_private(req->wb_page, 0); |
@@ -1727,7 +1722,6 @@ int nfs_wb_page_cancel(struct inode *inode, struct page *page) | |||
1727 | struct nfs_page *req; | 1722 | struct nfs_page *req; |
1728 | int ret = 0; | 1723 | int ret = 0; |
1729 | 1724 | ||
1730 | BUG_ON(!PageLocked(page)); | ||
1731 | for (;;) { | 1725 | for (;;) { |
1732 | wait_on_page_writeback(page); | 1726 | wait_on_page_writeback(page); |
1733 | req = nfs_page_find_request(page); | 1727 | req = nfs_page_find_request(page); |