summaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-11-07 02:51:00 -0500
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2017-11-17 16:43:50 -0500
commit0671d8f108762efc51ca893dbf8f0ba72f655c3d (patch)
treeec6b213e1bbd724aad9601c09f09b3dc2dfac6ed /fs/nfs/write.c
parentfcd8843c406b46433857ae45e5e9d84b01a7d20b (diff)
nfs/write: Use common error handling code in nfs_lock_and_join_requests()
Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index babebbccae2a..5b5f464f6f2a 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -487,10 +487,8 @@ try_again:
487 } 487 }
488 488
489 ret = nfs_page_group_lock(head); 489 ret = nfs_page_group_lock(head);
490 if (ret < 0) { 490 if (ret < 0)
491 nfs_unlock_and_release_request(head); 491 goto release_request;
492 return ERR_PTR(ret);
493 }
494 492
495 /* lock each request in the page group */ 493 /* lock each request in the page group */
496 total_bytes = head->wb_bytes; 494 total_bytes = head->wb_bytes;
@@ -515,8 +513,7 @@ try_again:
515 if (ret < 0) { 513 if (ret < 0) {
516 nfs_unroll_locks(inode, head, subreq); 514 nfs_unroll_locks(inode, head, subreq);
517 nfs_release_request(subreq); 515 nfs_release_request(subreq);
518 nfs_unlock_and_release_request(head); 516 goto release_request;
519 return ERR_PTR(ret);
520 } 517 }
521 } 518 }
522 /* 519 /*
@@ -532,8 +529,8 @@ try_again:
532 nfs_page_group_unlock(head); 529 nfs_page_group_unlock(head);
533 nfs_unroll_locks(inode, head, subreq); 530 nfs_unroll_locks(inode, head, subreq);
534 nfs_unlock_and_release_request(subreq); 531 nfs_unlock_and_release_request(subreq);
535 nfs_unlock_and_release_request(head); 532 ret = -EIO;
536 return ERR_PTR(-EIO); 533 goto release_request;
537 } 534 }
538 } 535 }
539 536
@@ -576,6 +573,10 @@ try_again:
576 /* still holds ref on head from nfs_page_find_head_request 573 /* still holds ref on head from nfs_page_find_head_request
577 * and still has lock on head from lock loop */ 574 * and still has lock on head from lock loop */
578 return head; 575 return head;
576
577release_request:
578 nfs_unlock_and_release_request(head);
579 return ERR_PTR(ret);
579} 580}
580 581
581static void nfs_write_error_remove_page(struct nfs_page *req) 582static void nfs_write_error_remove_page(struct nfs_page *req)