NFSD: remove dead code in nfs4_open_delegation
Subsystems (2)
Dai Ngo
reviewerPATCH 1/1 NFSD: remove dead code in nfs4_open_delegation
The intention of this code is to tell the client to return the granted delegation immediately for whatever reason in the case of OPEN with NFS4_OPEN_CLAIM_PREVIOUS. However this was already handled above in the cases of switch(open->op_claim_type).
--- fs/nfsd/nfs4state.c | 5 ----- 1 file changed, 5 deletions(-)
fs/nfsd/nfs4state.c +0 -5
@@ -5632,11 +5632,6 @@ nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,return ; out_no_deleg: open->op_delegate_type =NFS4_OPEN_DELEGATE_NONE ; -if (open->op_claim_type ==NFS4_OPEN_CLAIM_PREVIOUS && - open->op_delegate_type !=NFS4_OPEN_DELEGATE_NONE ) { -dprintk ("NFSD: WARNING: refusing delegation reclaim\n" ); - open->op_recall =1 ; - }/* 4.1 client asking for a delegation? */ if (open->op_deleg_want)
Signature · 1 line
2.9.5
Chuck Lever
maintainerQuoted 15 lines · Dai Ngo
The intention of this code is to tell the client to return the granted delegation immediately for whatever reason in the case of OPEN with
NFS4_OPEN_CLAIM_PREVIOUS. However this was already handled above in the cases ofswitch(open->op_claim_type).Signed-off-by Dai Ngo <[email protected]>--- fs/nfsd/nfs4state.c | 5 ----- 1 file changed, 5 deletions(-)fs/nfsd/nfs4state.c +0
-0
fs/nfsd/nfs4state.c nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp, · line 5639
Quoted 8 lines
fs/nfsd/nfs4state.c +0
-5@@ -5632,11 +5632,6 @@ nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,return ; out_no_deleg: open->op_delegate_type =NFS4_OPEN_DELEGATE_NONE ; -if (open->op_claim_type ==NFS4_OPEN_CLAIM_PREVIOUS && - open->op_delegate_type !=NFS4_OPEN_DELEGATE_NONE ) { -dprintk ("NFSD: WARNING: refusing delegation reclaim\n" ); - open->op_recall =1 ; - }
This is dead code because it's broken. Look carefully at it: it sets open->op_delegate_type to NONE, then prints a warning if it isn't NONE. The warning will never occur, and neither will the recall.
This code came from 99c415156c49 ("nfsd4: clean up nfs4_open_delegation"). Can you have a look at that old commit and make sure nfs4_open_delegation is working as it was originally intended before it was cleaned up by that commit?
Even if you decide not to change the diff, the patch description is confusing. out_no_deleg: can be invoked /after/ the switch statement, so I'm not seeing how the OPEN/CLAIM_PREVIOUS case is handled in that instance. The description also needs to at least mention that the removed code never worked properly.
Quoted 5 lines
fs/nfsd/nfs4state.c +0
-0/* 4.1 client asking for a delegation? */ if (open->op_deleg_want)Signature · 1 line
2.9.5
[email protected]
reviewerQuoted 11 lines · Chuck Lever
Quoted 10 lines · Dai Ngo
The intention of this code is to tell the client to return the granted delegation immediately for whatever reason in the case of OPEN with
NFS4_OPEN_CLAIM_PREVIOUS. However this was already handled above in the cases ofswitch(open->op_claim_type).Signed-off-by Dai Ngo <[email protected]>--- fs/nfsd/nfs4state.c | 5 ----- 1 file changed, 5 deletions(-)
Quoted 16 lines
fs/nfsd/nfs4state.c nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp, · line 5639
Quoted 13 lines
fs/nfsd/nfs4state.c +0
-5@@ -5632,11 +5632,6 @@ nfs4_open_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp,return ; out_no_deleg: open->op_delegate_type =NFS4_OPEN_DELEGATE_NONE ; -if (open->op_claim_type ==NFS4_OPEN_CLAIM_PREVIOUS && - open->op_delegate_type !=NFS4_OPEN_DELEGATE_NONE ) { -dprintk ("NFSD: WARNING: refusing delegation reclaim\n" ); - open->op_recall =1 ; - }This is dead code because it's broken. Look carefully at it: it sets
open->op_delegate_typeto NONE, then prints a warning if it isn't NONE. The warning will never occur, and neither will the recall.
This is why the name of the patch is 'removing dead code'. I can be more explicit and add the description you have here.
Quoted 5 lines
This code came from
99c415156c49("nfsd4: clean upnfs4_open_delegation"). Can you have a look at that old commit and make surenfs4_open_delegationis working as it was originally intended before it was cleaned up by that commit?
I don't see any functional differences before and after 99c415156c49 other than explicitly denying write delegation by 99c415156c49.
Quoted 5 lines
Even if you decide not to change the diff, the patch description is confusing.
out_no_deleg: can be invoked /after/ the switch statement, so I'm not seeing how the OPEN/CLAIM_PREVIOUS case is handled in that instance.
In the case of OPEN/CLAIM_PREVIOUS, if the back channel is not up then op_recall is set to 1 and it continues on to call nfs4_set_delegation to see if the delegation can be granted. If the delegation is granted then the result of the OPEN is delegation granted but op_recall is set to true, causing the client to return the delegation immediately.
Quoted 2 lines
The description also needs to at
least mention that the removed code never worked properly.
I will describe why it's dead code as mentioned above.
-Dai
Quoted 7 lines
Quoted 7 lines
fs/nfsd/nfs4state.c +0
-0/* 4.1 client asking for a delegation? */ if (open->op_deleg_want)Signature · 1 line
2.9.5