]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
NFS: Pass error information to the pgio error cleanup routine
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 13 Feb 2019 15:39:39 +0000 (10:39 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 20 Feb 2019 20:14:20 +0000 (15:14 -0500)
Allow the caller to pass error information when cleaning up a failed
I/O request so that we can conditionally take action to cancel the
request altogether if the error turned out to be fatal.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/direct.c
fs/nfs/pagelist.c
fs/nfs/read.c
fs/nfs/write.c
include/linux/nfs_xdr.h

index 1377ee20ecf91383e0239930a0cb60317a94726b..0fd811ac08b525d2a5962a168402557a1e01843b 100644 (file)
@@ -428,7 +428,7 @@ out_put:
        hdr->release(hdr);
 }
 
-static void nfs_read_sync_pgio_error(struct list_head *head)
+static void nfs_read_sync_pgio_error(struct list_head *head, int error)
 {
        struct nfs_page *req;
 
@@ -820,7 +820,7 @@ out_put:
        hdr->release(hdr);
 }
 
-static void nfs_write_sync_pgio_error(struct list_head *head)
+static void nfs_write_sync_pgio_error(struct list_head *head, int error)
 {
        struct nfs_page *req;
 
index 9cbfdb979992ccdf497d18d7c7cf4e2306662845..695afb7de3a7e124fe7dcb900b321a74f7121cdb 100644 (file)
@@ -993,7 +993,7 @@ nfs_pageio_cleanup_request(struct nfs_pageio_descriptor *desc,
        LIST_HEAD(head);
 
        nfs_list_move_request(req, &head);
-       desc->pg_completion_ops->error_cleanup(&head);
+       desc->pg_completion_ops->error_cleanup(&head, desc->pg_error);
 }
 
 /**
@@ -1129,7 +1129,8 @@ static void nfs_pageio_error_cleanup(struct nfs_pageio_descriptor *desc)
 
        for (midx = 0; midx < desc->pg_mirror_count; midx++) {
                mirror = &desc->pg_mirrors[midx];
-               desc->pg_completion_ops->error_cleanup(&mirror->pg_list);
+               desc->pg_completion_ops->error_cleanup(&mirror->pg_list,
+                               desc->pg_error);
        }
 }
 
index f9f19784db8279e2cdd6f17cbc6c7bd39d5ad332..1d95a60b2586aede52c7a55b00fe76e921fdf7fe 100644 (file)
@@ -205,7 +205,7 @@ static void nfs_initiate_read(struct nfs_pgio_header *hdr,
 }
 
 static void
-nfs_async_read_error(struct list_head *head)
+nfs_async_read_error(struct list_head *head, int error)
 {
        struct nfs_page *req;
 
index d09c9f878141a5c4213aef1faccb85b979bf4793..11df9f03245fb99dc4b1aeaad46e1d52b9629db2 100644 (file)
@@ -1412,20 +1412,27 @@ static void nfs_redirty_request(struct nfs_page *req)
        nfs_release_request(req);
 }
 
-static void nfs_async_write_error(struct list_head *head)
+static void nfs_async_write_error(struct list_head *head, int error)
 {
        struct nfs_page *req;
 
        while (!list_empty(head)) {
                req = nfs_list_entry(head->next);
                nfs_list_remove_request(req);
+               if (nfs_error_is_fatal(error)) {
+                       nfs_context_set_write_error(req->wb_context, error);
+                       if (nfs_error_is_fatal_on_server(error)) {
+                               nfs_write_error_remove_page(req);
+                               continue;
+                       }
+               }
                nfs_redirty_request(req);
        }
 }
 
 static void nfs_async_write_reschedule_io(struct nfs_pgio_header *hdr)
 {
-       nfs_async_write_error(&hdr->pages);
+       nfs_async_write_error(&hdr->pages, 0);
        filemap_fdatawrite_range(hdr->inode->i_mapping, hdr->args.offset,
                        hdr->args.offset + hdr->args.count - 1);
 }
index 441a93ebcac045132113cf0314f22acd4da755d0..b4bd2bf5f5857b8a78a853bfdc913c6a891bf394 100644 (file)
@@ -1549,7 +1549,7 @@ struct nfs_commit_data {
 };
 
 struct nfs_pgio_completion_ops {
-       void    (*error_cleanup)(struct list_head *head);
+       void    (*error_cleanup)(struct list_head *head, int);
        void    (*init_hdr)(struct nfs_pgio_header *hdr);
        void    (*completion)(struct nfs_pgio_header *hdr);
        void    (*reschedule_io)(struct nfs_pgio_header *hdr);