pnfs/blocklayout: set PNFS_LAYOUTRETURN_ON_ERROR
authorBenjamin Coddington <bcodding@redhat.com>
Fri, 8 Dec 2017 17:52:57 +0000 (12:52 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 15 Jan 2018 04:06:29 +0000 (23:06 -0500)
If there's an error doing I/O to block device, and the client resends the
I/O to the MDS, the MDS must recall the layout from the client before
processing the I/O.  Let's preempt that exchange by returning the layout
before falling back to the MDS when there's an error.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/blocklayout/blocklayout.c
fs/nfs/pnfs.h

index ec110aa876341e6bace3a7666683b5c90baadc39..3345708886494df59fa9d804f4a92e37b60d859b 100644 (file)
@@ -887,6 +887,7 @@ static struct pnfs_layoutdriver_type blocklayout_type = {
        .name                           = "LAYOUT_BLOCK_VOLUME",
        .owner                          = THIS_MODULE,
        .flags                          = PNFS_LAYOUTRET_ON_SETATTR |
+                                         PNFS_LAYOUTRET_ON_ERROR |
                                          PNFS_READ_WHOLE_PAGE,
        .read_pagelist                  = bl_read_pagelist,
        .write_pagelist                 = bl_write_pagelist,
@@ -910,6 +911,7 @@ static struct pnfs_layoutdriver_type scsilayout_type = {
        .name                           = "LAYOUT_SCSI",
        .owner                          = THIS_MODULE,
        .flags                          = PNFS_LAYOUTRET_ON_SETATTR |
+                                         PNFS_LAYOUTRET_ON_ERROR |
                                          PNFS_READ_WHOLE_PAGE,
        .read_pagelist                  = bl_read_pagelist,
        .write_pagelist                 = bl_write_pagelist,
index 8d507c361d980dad0a0aed52bf5a5ed02203634b..29a19814e5380f2bd7f7a954067795f2c14e0d97 100644 (file)
@@ -524,8 +524,10 @@ static inline int pnfs_return_layout(struct inode *ino)
        struct nfs_inode *nfsi = NFS_I(ino);
        struct nfs_server *nfss = NFS_SERVER(ino);
 
-       if (pnfs_enabled_sb(nfss) && nfsi->layout)
+       if (pnfs_enabled_sb(nfss) && nfsi->layout) {
+               set_bit(NFS_LAYOUT_RETURN_REQUESTED, &nfsi->layout->plh_flags);
                return _pnfs_return_layout(ino);
+       }
 
        return 0;
 }