diff options
author | Fred Isaman <fred.isaman@gmail.com> | 2016-10-04 15:26:41 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-05-31 15:03:11 -0400 |
commit | 6e01260ceeca299b82d466660935534c5c909d54 (patch) | |
tree | 16852b84a1595fbb2bd4b64cbdc085d3b91cd16c | |
parent | 78746a384c88c6405594cd07cae11b3b3caffb9b (diff) |
pnfs: Stop attempting LAYOUTGET on OPEN on failure
Signed-off-by: Fred Isaman <fred.isaman@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 4 | ||||
-rw-r--r-- | fs/nfs/pnfs.c | 19 | ||||
-rw-r--r-- | include/linux/nfs_fs_sb.h | 1 |
3 files changed, 22 insertions, 2 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 0e6db190a874..05454cbc473d 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -9465,7 +9465,8 @@ static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = { | |||
9465 | | NFS_CAP_ATOMIC_OPEN | 9465 | | NFS_CAP_ATOMIC_OPEN |
9466 | | NFS_CAP_POSIX_LOCK | 9466 | | NFS_CAP_POSIX_LOCK |
9467 | | NFS_CAP_STATEID_NFSV41 | 9467 | | NFS_CAP_STATEID_NFSV41 |
9468 | | NFS_CAP_ATOMIC_OPEN_V1, | 9468 | | NFS_CAP_ATOMIC_OPEN_V1 |
9469 | | NFS_CAP_LGOPEN, | ||
9469 | .init_client = nfs41_init_client, | 9470 | .init_client = nfs41_init_client, |
9470 | .shutdown_client = nfs41_shutdown_client, | 9471 | .shutdown_client = nfs41_shutdown_client, |
9471 | .match_stateid = nfs41_match_stateid, | 9472 | .match_stateid = nfs41_match_stateid, |
@@ -9490,6 +9491,7 @@ static const struct nfs4_minor_version_ops nfs_v4_2_minor_ops = { | |||
9490 | | NFS_CAP_POSIX_LOCK | 9491 | | NFS_CAP_POSIX_LOCK |
9491 | | NFS_CAP_STATEID_NFSV41 | 9492 | | NFS_CAP_STATEID_NFSV41 |
9492 | | NFS_CAP_ATOMIC_OPEN_V1 | 9493 | | NFS_CAP_ATOMIC_OPEN_V1 |
9494 | | NFS_CAP_LGOPEN | ||
9493 | | NFS_CAP_ALLOCATE | 9495 | | NFS_CAP_ALLOCATE |
9494 | | NFS_CAP_COPY | 9496 | | NFS_CAP_COPY |
9495 | | NFS_CAP_DEALLOCATE | 9497 | | NFS_CAP_DEALLOCATE |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index a6fe8132e944..3dfe9fa264a5 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -2088,6 +2088,8 @@ void pnfs_lgopen_prepare(struct nfs4_opendata *data, | |||
2088 | server->pnfs_curr_ld->flags & PNFS_LAYOUTGET_ON_OPEN)) | 2088 | server->pnfs_curr_ld->flags & PNFS_LAYOUTGET_ON_OPEN)) |
2089 | return; | 2089 | return; |
2090 | /* Could check on max_ops, but currently hardcoded high enough */ | 2090 | /* Could check on max_ops, but currently hardcoded high enough */ |
2091 | if (!nfs_server_capable(data->dir->d_inode, NFS_CAP_LGOPEN)) | ||
2092 | return; | ||
2091 | if (data->state) | 2093 | if (data->state) |
2092 | _lgopen_prepare_attached(data, ctx); | 2094 | _lgopen_prepare_attached(data, ctx); |
2093 | else | 2095 | else |
@@ -2101,8 +2103,23 @@ void pnfs_parse_lgopen(struct inode *ino, struct nfs4_layoutget *lgp, | |||
2101 | struct pnfs_layout_segment *lseg; | 2103 | struct pnfs_layout_segment *lseg; |
2102 | u32 iomode; | 2104 | u32 iomode; |
2103 | 2105 | ||
2104 | if (!lgp || lgp->res.layoutp->len == 0) | 2106 | if (!lgp) |
2105 | return; | 2107 | return; |
2108 | dprintk("%s: entered with status %i\n", __func__, lgp->res.status); | ||
2109 | if (lgp->res.status) { | ||
2110 | switch (lgp->res.status) { | ||
2111 | case -NFS4ERR_DELAY: | ||
2112 | case -NFS4ERR_GRACE: | ||
2113 | case -NFS4ERR_LAYOUTTRYLATER: | ||
2114 | break; | ||
2115 | default: | ||
2116 | /* FIXME - Any error not listed above permanently | ||
2117 | * halts lgopen attempts. | ||
2118 | */ | ||
2119 | NFS_SERVER(ino)->caps &= ~NFS_CAP_LGOPEN; | ||
2120 | } | ||
2121 | return; | ||
2122 | } | ||
2106 | if (!lgp->args.inode) { | 2123 | if (!lgp->args.inode) { |
2107 | lo = _pnfs_grab_empty_layout(ino, ctx); | 2124 | lo = _pnfs_grab_empty_layout(ino, ctx); |
2108 | if (!lo) | 2125 | if (!lo) |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 4e735be53e70..2c18d618604e 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -235,6 +235,7 @@ struct nfs_server { | |||
235 | #define NFS_CAP_ACLS (1U << 3) | 235 | #define NFS_CAP_ACLS (1U << 3) |
236 | #define NFS_CAP_ATOMIC_OPEN (1U << 4) | 236 | #define NFS_CAP_ATOMIC_OPEN (1U << 4) |
237 | /* #define NFS_CAP_CHANGE_ATTR (1U << 5) */ | 237 | /* #define NFS_CAP_CHANGE_ATTR (1U << 5) */ |
238 | #define NFS_CAP_LGOPEN (1U << 5) | ||
238 | #define NFS_CAP_FILEID (1U << 6) | 239 | #define NFS_CAP_FILEID (1U << 6) |
239 | #define NFS_CAP_MODE (1U << 7) | 240 | #define NFS_CAP_MODE (1U << 7) |
240 | #define NFS_CAP_NLINK (1U << 8) | 241 | #define NFS_CAP_NLINK (1U << 8) |