Linux-NFS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] nfsd: remove unnecessary assertion in nfsd4_layout_setlease
@ 2019-12-26 20:37 Aditya Pakki
  2020-01-03 15:43 ` J. Bruce Fields
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-12-26 20:37 UTC (permalink / raw)
  To: pakki001; +Cc: kjlu, J. Bruce Fields, Chuck Lever, linux-nfs, linux-kernel

In nfsd4_layout_setlease, checking for a valid file lock is
redundant and can be removed. This patch eliminates such a
BUG_ON check.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 fs/nfsd/nfs4layouts.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
index 2681c70283ce..ef5f8e645f4f 100644
--- a/fs/nfsd/nfs4layouts.c
+++ b/fs/nfsd/nfs4layouts.c
@@ -204,7 +204,6 @@ nfsd4_layout_setlease(struct nfs4_layout_stateid *ls)
 		locks_free_lock(fl);
 		return status;
 	}
-	BUG_ON(fl != NULL);
 	return 0;
 }
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] nfsd: remove unnecessary assertion in nfsd4_layout_setlease
  2019-12-26 20:37 [PATCH] nfsd: remove unnecessary assertion in nfsd4_layout_setlease Aditya Pakki
@ 2020-01-03 15:43 ` J. Bruce Fields
  0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2020-01-03 15:43 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: kjlu, Chuck Lever, linux-nfs, linux-kernel, Christoph Hellwig

It took me a minute to see how fl can even fail to be NULL, since we
just accessed fields of fl.

OK, I see, &fl is passed to vfs_setlease, so it can change the value of
fl.

Looks like generic_addlease() clears flp on success, unless it finds an
existing non-conflicting lease?  I'm not clear why nfsd4_layout_setlease
knows it can't hit that case.

In any case, I don't see why this assertion is redundant; leaving it
there.

--b.

On Thu, Dec 26, 2019 at 02:37:33PM -0600, Aditya Pakki wrote:
> In nfsd4_layout_setlease, checking for a valid file lock is
> redundant and can be removed. This patch eliminates such a
> BUG_ON check.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
>  fs/nfsd/nfs4layouts.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
> index 2681c70283ce..ef5f8e645f4f 100644
> --- a/fs/nfsd/nfs4layouts.c
> +++ b/fs/nfsd/nfs4layouts.c
> @@ -204,7 +204,6 @@ nfsd4_layout_setlease(struct nfs4_layout_stateid *ls)
>  		locks_free_lock(fl);
>  		return status;
>  	}
> -	BUG_ON(fl != NULL);
>  	return 0;
>  }
>  
> -- 
> 2.20.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-26 20:37 [PATCH] nfsd: remove unnecessary assertion in nfsd4_layout_setlease Aditya Pakki
2020-01-03 15:43 ` J. Bruce Fields

Linux-NFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nfs/0 linux-nfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nfs linux-nfs/ https://lore.kernel.org/linux-nfs \
		linux-nfs@vger.kernel.org
	public-inbox-index linux-nfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-nfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git