diff mbox series

[4/5] nfsd: clean up if statement in nfsd4_close_open_stateid()

Message ID 20250303-nfsd-cleanup-v1-4-14068e8f59c5@kernel.org (mailing list archive)
State Rejected
Delegated to: Chuck Lever
Headers show
Series nfsd: some small cleanup patches | expand

Commit Message

Jeff Layton March 3, 2025, 5:26 p.m. UTC
Just set unhashed to false in the one case where we return that
explicitly, and drop the else.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/nfsd/nfs4state.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Jeff Layton March 4, 2025, 3:24 p.m. UTC | #1
On Mon, 2025-03-03 at 12:26 -0500, Jeff Layton wrote:
> Just set unhashed to false in the one case where we return that
> explicitly, and drop the else.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/nfsd/nfs4state.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index a7bac93445e2fdbe743b77e66238d652094907cb..1f3e9d42fcd784ea8d101ad3549702a30dfe9058 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -7644,12 +7644,11 @@ static bool nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)
>  		list_for_each_entry(stp, &reaplist, st_locks)
>  			nfs4_free_cpntf_statelist(clp->net, &stp->st_stid);
>  		free_ol_stateid_reaplist(&reaplist);
> -		return false;
> -	} else {
> -		spin_unlock(&clp->cl_lock);
> -		free_ol_stateid_reaplist(&reaplist);
> -		return unhashed;
> +		unhashed = false;
>  	}
> +	spin_unlock(&clp->cl_lock);
> +	free_ol_stateid_reaplist(&reaplist);
> +	return unhashed;
>  }
>  
>  /*
> 

My apologies, Chuck. This patch has a bug in it. Can you drop it from
nfsd-testing? I may or may not send a replacement.

Thanks,
Chuck Lever March 4, 2025, 3:29 p.m. UTC | #2
On 3/4/25 10:24 AM, Jeff Layton wrote:
> On Mon, 2025-03-03 at 12:26 -0500, Jeff Layton wrote:
>> Just set unhashed to false in the one case where we return that
>> explicitly, and drop the else.
>>
>> Signed-off-by: Jeff Layton <jlayton@kernel.org>
>> ---
>>  fs/nfsd/nfs4state.c | 9 ++++-----
>>  1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
>> index a7bac93445e2fdbe743b77e66238d652094907cb..1f3e9d42fcd784ea8d101ad3549702a30dfe9058 100644
>> --- a/fs/nfsd/nfs4state.c
>> +++ b/fs/nfsd/nfs4state.c
>> @@ -7644,12 +7644,11 @@ static bool nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)
>>  		list_for_each_entry(stp, &reaplist, st_locks)
>>  			nfs4_free_cpntf_statelist(clp->net, &stp->st_stid);
>>  		free_ol_stateid_reaplist(&reaplist);
>> -		return false;
>> -	} else {
>> -		spin_unlock(&clp->cl_lock);
>> -		free_ol_stateid_reaplist(&reaplist);
>> -		return unhashed;
>> +		unhashed = false;
>>  	}
>> +	spin_unlock(&clp->cl_lock);
>> +	free_ol_stateid_reaplist(&reaplist);
>> +	return unhashed;
>>  }
>>  
>>  /*
>>
> 
> My apologies, Chuck. This patch has a bug in it. Can you drop it from
> nfsd-testing? I may or may not send a replacement.

Done.
diff mbox series

Patch

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index a7bac93445e2fdbe743b77e66238d652094907cb..1f3e9d42fcd784ea8d101ad3549702a30dfe9058 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -7644,12 +7644,11 @@  static bool nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)
 		list_for_each_entry(stp, &reaplist, st_locks)
 			nfs4_free_cpntf_statelist(clp->net, &stp->st_stid);
 		free_ol_stateid_reaplist(&reaplist);
-		return false;
-	} else {
-		spin_unlock(&clp->cl_lock);
-		free_ol_stateid_reaplist(&reaplist);
-		return unhashed;
+		unhashed = false;
 	}
+	spin_unlock(&clp->cl_lock);
+	free_ol_stateid_reaplist(&reaplist);
+	return unhashed;
 }
 
 /*