* [PATCH 0/5] Optimisations for state management
@ 2016-11-10 21:41 Trond Myklebust
2016-11-10 21:41 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state Trond Myklebust
0 siblings, 1 reply; 9+ messages in thread
From: Trond Myklebust @ 2016-11-10 21:41 UTC (permalink / raw)
To: linux-nfs
The following patches constitute a grab bag of minor optimisations when
the NFS client is managing its state.
Trond Myklebust (5):
NFSv4: Don't check file access when reclaiming state
NFSv4: Don't ask for the change attribute when reclaiming state
NFSv4: Don't request a GETATTR on open_downgrade.
NFSv4: Don't request close-to-open attribute when holding a delegation
NFSv4: Optimise away forced revalidation when we know the attributes
are OK
fs/nfs/delegation.c | 4 ----
fs/nfs/inode.c | 2 +-
fs/nfs/nfs4proc.c | 23 +++++++++++++++++------
fs/nfs/nfs4xdr.c | 7 ++-----
4 files changed, 20 insertions(+), 16 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/5] NFSv4: Don't check file access when reclaiming state 2016-11-10 21:41 [PATCH 0/5] Optimisations for state management Trond Myklebust @ 2016-11-10 21:41 ` Trond Myklebust 2016-11-10 21:41 ` [PATCH 2/5] NFSv4: Don't ask for the change attribute " Trond Myklebust ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Trond Myklebust @ 2016-11-10 21:41 UTC (permalink / raw) To: linux-nfs If we're reclaiming state after a reboot, or as part of returning a delegation, we don't need to check access modes again. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> --- fs/nfs/nfs4proc.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6a1d650e0419..4eead738da8e 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1221,6 +1221,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, atomic_inc(&sp->so_count); p->o_arg.open_flags = flags; p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE); + p->o_arg.claim = nfs4_map_atomic_open_claim(server, claim); p->o_arg.share_access = nfs4_map_atomic_open_share(server, fmode, flags); /* don't put an ACCESS op in OPEN compound if O_EXCL, because ACCESS @@ -1228,8 +1229,14 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, if (!(flags & O_EXCL)) { /* ask server to check for all possible rights as results * are cached */ - p->o_arg.access = NFS4_ACCESS_READ | NFS4_ACCESS_MODIFY | - NFS4_ACCESS_EXTEND | NFS4_ACCESS_EXECUTE; + switch (p->o_arg.claim) { + case NFS4_OPEN_CLAIM_NULL: + case NFS4_OPEN_CLAIM_FH: + p->o_arg.access = NFS4_ACCESS_READ | + NFS4_ACCESS_MODIFY | + NFS4_ACCESS_EXTEND | + NFS4_ACCESS_EXECUTE; + } } p->o_arg.clientid = server->nfs_client->cl_clientid; p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time); @@ -1239,7 +1246,6 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, p->o_arg.bitmask = nfs4_bitmask(server, label); p->o_arg.open_bitmap = &nfs4_fattr_bitmap[0]; p->o_arg.label = nfs4_label_copy(p->a_label, label); - p->o_arg.claim = nfs4_map_atomic_open_claim(server, claim); switch (p->o_arg.claim) { case NFS4_OPEN_CLAIM_NULL: case NFS4_OPEN_CLAIM_DELEGATE_CUR: -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/5] NFSv4: Don't ask for the change attribute when reclaiming state 2016-11-10 21:41 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state Trond Myklebust @ 2016-11-10 21:41 ` Trond Myklebust 2016-11-10 21:41 ` [PATCH 3/5] NFSv4: Don't request a GETATTR on open_downgrade Trond Myklebust 2016-11-10 22:18 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state kbuild test robot 2016-11-14 20:44 ` Anna Schumaker 2 siblings, 1 reply; 9+ messages in thread From: Trond Myklebust @ 2016-11-10 21:41 UTC (permalink / raw) To: linux-nfs We don't need to ask for the change attribute when returning a delegation or recovering from a server reboot, and it could actually cause us to obtain an incorrect value if we're using a pNFS flavour that requires LAYOUTCOMMIT. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> --- fs/nfs/nfs4proc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 4eead738da8e..1e7e0754a96d 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -226,7 +226,6 @@ static const u32 nfs4_pnfs_open_bitmap[3] = { static const u32 nfs4_open_noattr_bitmap[3] = { FATTR4_WORD0_TYPE - | FATTR4_WORD0_CHANGE | FATTR4_WORD0_FILEID, }; -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/5] NFSv4: Don't request a GETATTR on open_downgrade. 2016-11-10 21:41 ` [PATCH 2/5] NFSv4: Don't ask for the change attribute " Trond Myklebust @ 2016-11-10 21:41 ` Trond Myklebust 2016-11-10 21:41 ` [PATCH 4/5] NFSv4: Don't request close-to-open attribute when holding a delegation Trond Myklebust 0 siblings, 1 reply; 9+ messages in thread From: Trond Myklebust @ 2016-11-10 21:41 UTC (permalink / raw) To: linux-nfs If we're not closing the file completely, there is no need to request close-to-open attributes. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> --- fs/nfs/nfs4xdr.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index fc89e5ed07ee..43cc989b5c06 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -2328,7 +2328,6 @@ static void nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, args->fh, &hdr); encode_open_downgrade(xdr, args, &hdr); - encode_getfattr(xdr, args->bitmask, &hdr); encode_nops(&hdr); } @@ -6115,9 +6114,6 @@ static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, if (status) goto out; status = decode_open_downgrade(xdr, res); - if (status != 0) - goto out; - decode_getfattr(xdr, res->fattr, res->server); out: return status; } -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/5] NFSv4: Don't request close-to-open attribute when holding a delegation 2016-11-10 21:41 ` [PATCH 3/5] NFSv4: Don't request a GETATTR on open_downgrade Trond Myklebust @ 2016-11-10 21:41 ` Trond Myklebust 2016-11-10 21:41 ` [PATCH 5/5] NFSv4: Optimise away forced revalidation when we know the attributes are OK Trond Myklebust 0 siblings, 1 reply; 9+ messages in thread From: Trond Myklebust @ 2016-11-10 21:41 UTC (permalink / raw) To: linux-nfs If holding a delegation, we do not need to ask the server to return close-to-open cache consistency attributes as part of the CLOSE compound. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> --- fs/nfs/nfs4proc.c | 10 ++++++++-- fs/nfs/nfs4xdr.c | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 1e7e0754a96d..ded8854bc32f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3141,8 +3141,15 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) goto out_wait; } - if (calldata->arg.fmode == 0) + if (calldata->arg.fmode == 0) { task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CLOSE]; + + /* Close-to-open cache consistency revalidation */ + if (!nfs4_have_delegation(inode, FMODE_READ)) + calldata->arg.bitmask = NFS_SERVER(inode)->cache_consistency_bitmask; + else + calldata->arg.bitmask = NULL; + } if (calldata->roc) pnfs_roc_get_barrier(inode, &calldata->roc_barrier); @@ -3225,7 +3232,6 @@ int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait) if (IS_ERR(calldata->arg.seqid)) goto out_free_calldata; calldata->arg.fmode = 0; - calldata->arg.bitmask = server->cache_consistency_bitmask; calldata->res.fattr = &calldata->fattr; calldata->res.seqid = calldata->arg.seqid; calldata->res.server = server; diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 43cc989b5c06..a8bebb52df78 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -2250,7 +2250,8 @@ static void nfs4_xdr_enc_close(struct rpc_rqst *req, struct xdr_stream *xdr, encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, args->fh, &hdr); encode_close(xdr, args, &hdr); - encode_getfattr(xdr, args->bitmask, &hdr); + if (args->bitmask != NULL) + encode_getfattr(xdr, args->bitmask, &hdr); encode_nops(&hdr); } -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/5] NFSv4: Optimise away forced revalidation when we know the attributes are OK 2016-11-10 21:41 ` [PATCH 4/5] NFSv4: Don't request close-to-open attribute when holding a delegation Trond Myklebust @ 2016-11-10 21:41 ` Trond Myklebust 0 siblings, 0 replies; 9+ messages in thread From: Trond Myklebust @ 2016-11-10 21:41 UTC (permalink / raw) To: linux-nfs The NFS_INO_REVAL_FORCED flag needs to be set if we just got a delegation, and we see that there might still be some ambiguity as to whether or not our attribute or data cache are valid. In practice, this means that a call to nfs_check_inode_attributes() will have noticed a discrepancy between cached attributes and measured ones, so let's move the setting of NFS_INO_REVAL_FORCED to there. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> --- fs/nfs/delegation.c | 4 ---- fs/nfs/inode.c | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index dff600ae0d74..d7df5e67b0c1 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c @@ -391,10 +391,6 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct rcu_assign_pointer(nfsi->delegation, delegation); delegation = NULL; - /* Ensure we revalidate the attributes and page cache! */ - spin_lock(&inode->i_lock); - nfsi->cache_validity |= NFS_INO_REVAL_FORCED; - spin_unlock(&inode->i_lock); trace_nfs4_set_delegation(inode, res->delegation_type); out: diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index bf4ec5ecc97e..3575e3408bd7 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1317,7 +1317,7 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat invalid |= NFS_INO_INVALID_ATIME; if (invalid != 0) - nfs_set_cache_invalid(inode, invalid); + nfs_set_cache_invalid(inode, invalid | NFS_INO_REVAL_FORCED); nfsi->read_cache_jiffies = fattr->time_start; return 0; -- 2.7.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/5] NFSv4: Don't check file access when reclaiming state 2016-11-10 21:41 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state Trond Myklebust 2016-11-10 21:41 ` [PATCH 2/5] NFSv4: Don't ask for the change attribute " Trond Myklebust @ 2016-11-10 22:18 ` kbuild test robot 2016-11-14 20:44 ` Anna Schumaker 2 siblings, 0 replies; 9+ messages in thread From: kbuild test robot @ 2016-11-10 22:18 UTC (permalink / raw) To: Trond Myklebust; +Cc: kbuild-all, linux-nfs [-- Attachment #1: Type: text/plain, Size: 2528 bytes --] Hi Trond, [auto build test WARNING on nfs/linux-next] [also build test WARNING on v4.9-rc4 next-20161110] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Trond-Myklebust/Optimisations-for-state-management/20161111-054856 base: git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next config: x86_64-eywa-module (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): fs/nfs/nfs4proc.c: In function 'nfs4_opendata_alloc': >> fs/nfs/nfs4proc.c:1232:3: warning: enumeration value 'NFS4_OPEN_CLAIM_PREVIOUS' not handled in switch [-Wswitch] switch (p->o_arg.claim) { ^~~~~~ >> fs/nfs/nfs4proc.c:1232:3: warning: enumeration value 'NFS4_OPEN_CLAIM_DELEGATE_CUR' not handled in switch [-Wswitch] >> fs/nfs/nfs4proc.c:1232:3: warning: enumeration value 'NFS4_OPEN_CLAIM_DELEGATE_PREV' not handled in switch [-Wswitch] >> fs/nfs/nfs4proc.c:1232:3: warning: enumeration value 'NFS4_OPEN_CLAIM_DELEG_CUR_FH' not handled in switch [-Wswitch] >> fs/nfs/nfs4proc.c:1232:3: warning: enumeration value 'NFS4_OPEN_CLAIM_DELEG_PREV_FH' not handled in switch [-Wswitch] vim +/NFS4_OPEN_CLAIM_PREVIOUS +1232 fs/nfs/nfs4proc.c 1216 goto err_free_label; 1217 nfs_sb_active(dentry->d_sb); 1218 p->dentry = dget(dentry); 1219 p->dir = parent; 1220 p->owner = sp; 1221 atomic_inc(&sp->so_count); 1222 p->o_arg.open_flags = flags; 1223 p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE); 1224 p->o_arg.claim = nfs4_map_atomic_open_claim(server, claim); 1225 p->o_arg.share_access = nfs4_map_atomic_open_share(server, 1226 fmode, flags); 1227 /* don't put an ACCESS op in OPEN compound if O_EXCL, because ACCESS 1228 * will return permission denied for all bits until close */ 1229 if (!(flags & O_EXCL)) { 1230 /* ask server to check for all possible rights as results 1231 * are cached */ > 1232 switch (p->o_arg.claim) { 1233 case NFS4_OPEN_CLAIM_NULL: 1234 case NFS4_OPEN_CLAIM_FH: 1235 p->o_arg.access = NFS4_ACCESS_READ | 1236 NFS4_ACCESS_MODIFY | 1237 NFS4_ACCESS_EXTEND | 1238 NFS4_ACCESS_EXECUTE; 1239 } 1240 } --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 25516 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/5] NFSv4: Don't check file access when reclaiming state 2016-11-10 21:41 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state Trond Myklebust 2016-11-10 21:41 ` [PATCH 2/5] NFSv4: Don't ask for the change attribute " Trond Myklebust 2016-11-10 22:18 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state kbuild test robot @ 2016-11-14 20:44 ` Anna Schumaker 2 siblings, 0 replies; 9+ messages in thread From: Anna Schumaker @ 2016-11-14 20:44 UTC (permalink / raw) To: Trond Myklebust, linux-nfs Hi Trond, On 11/10/2016 04:41 PM, Trond Myklebust wrote: > If we're reclaiming state after a reboot, or as part of returning a > delegation, we don't need to check access modes again. > > Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> > --- > fs/nfs/nfs4proc.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c > index 6a1d650e0419..4eead738da8e 100644 > --- a/fs/nfs/nfs4proc.c > +++ b/fs/nfs/nfs4proc.c > @@ -1221,6 +1221,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, > atomic_inc(&sp->so_count); > p->o_arg.open_flags = flags; > p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE); > + p->o_arg.claim = nfs4_map_atomic_open_claim(server, claim); > p->o_arg.share_access = nfs4_map_atomic_open_share(server, > fmode, flags); > /* don't put an ACCESS op in OPEN compound if O_EXCL, because ACCESS > @@ -1228,8 +1229,14 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, > if (!(flags & O_EXCL)) { > /* ask server to check for all possible rights as results > * are cached */ > - p->o_arg.access = NFS4_ACCESS_READ | NFS4_ACCESS_MODIFY | > - NFS4_ACCESS_EXTEND | NFS4_ACCESS_EXECUTE; > + switch (p->o_arg.claim) { > + case NFS4_OPEN_CLAIM_NULL: > + case NFS4_OPEN_CLAIM_FH: > + p->o_arg.access = NFS4_ACCESS_READ | > + NFS4_ACCESS_MODIFY | > + NFS4_ACCESS_EXTEND | > + NFS4_ACCESS_EXECUTE; > + } This adds these warnings when I compile: fs/nfs/nfs4proc.c: In function 'nfs4_opendata_alloc': fs/nfs/nfs4proc.c:1232:3: error: enumeration value 'NFS4_OPEN_CLAIM_PREVIOUS' not handled in switch [-Werror=switch] switch (p->o_arg.claim) { ^~~~~~ fs/nfs/nfs4proc.c:1232:3: error: enumeration value 'NFS4_OPEN_CLAIM_DELEGATE_CUR' not handled in switch [-Werror=switch] fs/nfs/nfs4proc.c:1232:3: error: enumeration value 'NFS4_OPEN_CLAIM_DELEGATE_PREV' not handled in switch [-Werror=switch] fs/nfs/nfs4proc.c:1232:3: error: enumeration value 'NFS4_OPEN_CLAIM_DELEG_CUR_FH' not handled in switch [-Werror=switch] fs/nfs/nfs4proc.c:1232:3: error: enumeration value 'NFS4_OPEN_CLAIM_DELEG_PREV_FH' not handled in switch [-Werror=switch] Thanks, Anna > } > p->o_arg.clientid = server->nfs_client->cl_clientid; > p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time); > @@ -1239,7 +1246,6 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, > p->o_arg.bitmask = nfs4_bitmask(server, label); > p->o_arg.open_bitmap = &nfs4_fattr_bitmap[0]; > p->o_arg.label = nfs4_label_copy(p->a_label, label); > - p->o_arg.claim = nfs4_map_atomic_open_claim(server, claim); > switch (p->o_arg.claim) { > case NFS4_OPEN_CLAIM_NULL: > case NFS4_OPEN_CLAIM_DELEGATE_CUR: > ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 0/5] Performance optimsations for 4.10
@ 2016-12-01 22:06 Trond Myklebust
2016-12-01 22:06 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state Trond Myklebust
0 siblings, 1 reply; 9+ messages in thread
From: Trond Myklebust @ 2016-12-01 22:06 UTC (permalink / raw)
To: linux-nfs
This patch series contains a set of minor optimisations that are mainly
useful against pNFS systems that may incur a higher performance penalty
on unnecessary attribute requests by triggering an internal RPC call from
the MDS to the DS.
- Speed up state recovery after a server reboot by avoiding unnecessary
GETATTR and ACCESS checks.
- Avoid unnecessary attribute revalidations on operations such as
OPEN_DOWNGRADE, where we don't yet need to update close-to-open
cache consistency attributes.
- Avoid unnecessary attribute revalidations when we hold a delegation.
Trond Myklebust (5):
NFSv4: Don't check file access when reclaiming state
NFSv4: Don't ask for the change attribute when reclaiming state
NFSv4: Don't request a GETATTR on open_downgrade.
NFSv4: Don't request close-to-open attribute when holding a delegation
NFSv4: Optimise away forced revalidation when we know the attributes
are OK
fs/nfs/delegation.c | 4 ----
fs/nfs/inode.c | 2 +-
fs/nfs/nfs4proc.c | 25 +++++++++++++++++++------
fs/nfs/nfs4xdr.c | 13 ++++---------
4 files changed, 24 insertions(+), 20 deletions(-)
--
2.9.3
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/5] NFSv4: Don't check file access when reclaiming state 2016-12-01 22:06 [PATCH 0/5] Performance optimsations for 4.10 Trond Myklebust @ 2016-12-01 22:06 ` Trond Myklebust 2016-12-01 22:06 ` [PATCH 2/5] NFSv4: Don't ask for the change attribute " Trond Myklebust 0 siblings, 1 reply; 9+ messages in thread From: Trond Myklebust @ 2016-12-01 22:06 UTC (permalink / raw) To: linux-nfs If we're reclaiming state after a reboot, or as part of returning a delegation, we don't need to check access modes again. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> --- fs/nfs/nfs4proc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 241da19b7da4..b582df89c083 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1221,6 +1221,7 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, atomic_inc(&sp->so_count); p->o_arg.open_flags = flags; p->o_arg.fmode = fmode & (FMODE_READ|FMODE_WRITE); + p->o_arg.claim = nfs4_map_atomic_open_claim(server, claim); p->o_arg.share_access = nfs4_map_atomic_open_share(server, fmode, flags); /* don't put an ACCESS op in OPEN compound if O_EXCL, because ACCESS @@ -1228,8 +1229,16 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, if (!(flags & O_EXCL)) { /* ask server to check for all possible rights as results * are cached */ - p->o_arg.access = NFS4_ACCESS_READ | NFS4_ACCESS_MODIFY | - NFS4_ACCESS_EXTEND | NFS4_ACCESS_EXECUTE; + switch (p->o_arg.claim) { + default: + break; + case NFS4_OPEN_CLAIM_NULL: + case NFS4_OPEN_CLAIM_FH: + p->o_arg.access = NFS4_ACCESS_READ | + NFS4_ACCESS_MODIFY | + NFS4_ACCESS_EXTEND | + NFS4_ACCESS_EXECUTE; + } } p->o_arg.clientid = server->nfs_client->cl_clientid; p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time); @@ -1239,7 +1248,6 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, p->o_arg.bitmask = nfs4_bitmask(server, label); p->o_arg.open_bitmap = &nfs4_fattr_bitmap[0]; p->o_arg.label = nfs4_label_copy(p->a_label, label); - p->o_arg.claim = nfs4_map_atomic_open_claim(server, claim); switch (p->o_arg.claim) { case NFS4_OPEN_CLAIM_NULL: case NFS4_OPEN_CLAIM_DELEGATE_CUR: -- 2.9.3 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/5] NFSv4: Don't ask for the change attribute when reclaiming state 2016-12-01 22:06 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state Trond Myklebust @ 2016-12-01 22:06 ` Trond Myklebust 2016-12-01 22:06 ` [PATCH 3/5] NFSv4: Don't request a GETATTR on open_downgrade Trond Myklebust 0 siblings, 1 reply; 9+ messages in thread From: Trond Myklebust @ 2016-12-01 22:06 UTC (permalink / raw) To: linux-nfs We don't need to ask for the change attribute when returning a delegation or recovering from a server reboot, and it could actually cause us to obtain an incorrect value if we're using a pNFS flavour that requires LAYOUTCOMMIT. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> --- fs/nfs/nfs4proc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index b582df89c083..c0628f78ed98 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -226,7 +226,6 @@ static const u32 nfs4_pnfs_open_bitmap[3] = { static const u32 nfs4_open_noattr_bitmap[3] = { FATTR4_WORD0_TYPE - | FATTR4_WORD0_CHANGE | FATTR4_WORD0_FILEID, }; -- 2.9.3 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/5] NFSv4: Don't request a GETATTR on open_downgrade. 2016-12-01 22:06 ` [PATCH 2/5] NFSv4: Don't ask for the change attribute " Trond Myklebust @ 2016-12-01 22:06 ` Trond Myklebust 0 siblings, 0 replies; 9+ messages in thread From: Trond Myklebust @ 2016-12-01 22:06 UTC (permalink / raw) To: linux-nfs If we're not closing the file completely, there is no need to request close-to-open attributes. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> --- fs/nfs/nfs4xdr.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index fc89e5ed07ee..c37473721230 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -499,14 +499,12 @@ static int nfs4_stat_to_errno(int); (compound_encode_hdr_maxsz + \ encode_sequence_maxsz + \ encode_putfh_maxsz + \ - encode_open_downgrade_maxsz + \ - encode_getattr_maxsz) + encode_open_downgrade_maxsz) #define NFS4_dec_open_downgrade_sz \ (compound_decode_hdr_maxsz + \ decode_sequence_maxsz + \ decode_putfh_maxsz + \ - decode_open_downgrade_maxsz + \ - decode_getattr_maxsz) + decode_open_downgrade_maxsz) #define NFS4_enc_close_sz (compound_encode_hdr_maxsz + \ encode_sequence_maxsz + \ encode_putfh_maxsz + \ @@ -2328,7 +2326,6 @@ static void nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, args->fh, &hdr); encode_open_downgrade(xdr, args, &hdr); - encode_getfattr(xdr, args->bitmask, &hdr); encode_nops(&hdr); } @@ -6115,9 +6112,6 @@ static int nfs4_xdr_dec_open_downgrade(struct rpc_rqst *rqstp, if (status) goto out; status = decode_open_downgrade(xdr, res); - if (status != 0) - goto out; - decode_getfattr(xdr, res->fattr, res->server); out: return status; } -- 2.9.3 ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-12-01 22:06 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-11-10 21:41 [PATCH 0/5] Optimisations for state management Trond Myklebust 2016-11-10 21:41 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state Trond Myklebust 2016-11-10 21:41 ` [PATCH 2/5] NFSv4: Don't ask for the change attribute " Trond Myklebust 2016-11-10 21:41 ` [PATCH 3/5] NFSv4: Don't request a GETATTR on open_downgrade Trond Myklebust 2016-11-10 21:41 ` [PATCH 4/5] NFSv4: Don't request close-to-open attribute when holding a delegation Trond Myklebust 2016-11-10 21:41 ` [PATCH 5/5] NFSv4: Optimise away forced revalidation when we know the attributes are OK Trond Myklebust 2016-11-10 22:18 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state kbuild test robot 2016-11-14 20:44 ` Anna Schumaker -- strict thread matches above, loose matches on Subject: below -- 2016-12-01 22:06 [PATCH 0/5] Performance optimsations for 4.10 Trond Myklebust 2016-12-01 22:06 ` [PATCH 1/5] NFSv4: Don't check file access when reclaiming state Trond Myklebust 2016-12-01 22:06 ` [PATCH 2/5] NFSv4: Don't ask for the change attribute " Trond Myklebust 2016-12-01 22:06 ` [PATCH 3/5] NFSv4: Don't request a GETATTR on open_downgrade Trond Myklebust
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).