public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs/blocklayout: fput() needed for ENODEV error flow
@ 2024-06-19 13:52 cel
  2024-06-20  5:21 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: cel @ 2024-06-19 13:52 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: Ben Coddington, linux-nfs, Chuck Lever

From: Chuck Lever <chuck.lever@oracle.com>

A recently-added error flow needs to fput() the block device just
like the other error flows in this area; otherwise the device is
leaked.

Fixes: d76c769c8db4 ("pnfs/blocklayout: Don't add zero-length pnfs_block_dev")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfs/blocklayout/dev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/blocklayout/dev.c b/fs/nfs/blocklayout/dev.c
index 93ef7f864980..519c310c745d 100644
--- a/fs/nfs/blocklayout/dev.c
+++ b/fs/nfs/blocklayout/dev.c
@@ -351,8 +351,10 @@ bl_parse_scsi(struct nfs_server *server, struct pnfs_block_dev *d,
 	d->map = bl_map_simple;
 	d->pr_key = v->scsi.pr_key;
 
-	if (d->len == 0)
-		return -ENODEV;
+	if (d->len == 0) {
+		error = -ENODEV;
+		goto out_blkdev_put;
+	}
 
 	pr_info("pNFS: using block device %s (reservation key 0x%llx)\n",
 		file_bdev(d->bdev_file)->bd_disk->disk_name, d->pr_key);
-- 
2.45.1


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

* Re: [PATCH] nfs/blocklayout: fput() needed for ENODEV error flow
  2024-06-19 13:52 [PATCH] nfs/blocklayout: fput() needed for ENODEV error flow cel
@ 2024-06-20  5:21 ` Christoph Hellwig
  2024-06-20  9:34 ` Sagi Grimberg
  2024-06-20 11:32 ` Benjamin Coddington
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2024-06-20  5:21 UTC (permalink / raw)
  To: cel; +Cc: Trond Myklebust, Anna Schumaker, Ben Coddington, linux-nfs,
	Chuck Lever

On Wed, Jun 19, 2024 at 09:52:56AM -0400, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> A recently-added error flow needs to fput() the block device just
> like the other error flows in this area; otherwise the device is
> leaked.
> 
> Fixes: d76c769c8db4 ("pnfs/blocklayout: Don't add zero-length pnfs_block_dev")
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


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

* Re: [PATCH] nfs/blocklayout: fput() needed for ENODEV error flow
  2024-06-19 13:52 [PATCH] nfs/blocklayout: fput() needed for ENODEV error flow cel
  2024-06-20  5:21 ` Christoph Hellwig
@ 2024-06-20  9:34 ` Sagi Grimberg
  2024-06-20 11:32 ` Benjamin Coddington
  2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2024-06-20  9:34 UTC (permalink / raw)
  To: cel, Trond Myklebust, Anna Schumaker
  Cc: Ben Coddington, linux-nfs, Chuck Lever

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

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

* Re: [PATCH] nfs/blocklayout: fput() needed for ENODEV error flow
  2024-06-19 13:52 [PATCH] nfs/blocklayout: fput() needed for ENODEV error flow cel
  2024-06-20  5:21 ` Christoph Hellwig
  2024-06-20  9:34 ` Sagi Grimberg
@ 2024-06-20 11:32 ` Benjamin Coddington
  2 siblings, 0 replies; 4+ messages in thread
From: Benjamin Coddington @ 2024-06-20 11:32 UTC (permalink / raw)
  To: cel; +Cc: Trond Myklebust, Anna Schumaker, linux-nfs, Chuck Lever

On 19 Jun 2024, at 9:52, cel@kernel.org wrote:

> From: Chuck Lever <chuck.lever@oracle.com>
>
> A recently-added error flow needs to fput() the block device just
> like the other error flows in this area; otherwise the device is
> leaked.
>
> Fixes: d76c769c8db4 ("pnfs/blocklayout: Don't add zero-length pnfs_block_dev")
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

Mea Culpa,

Reviewed-by: Benjamin Coddington <bcodding@redhat.com>

Ben


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

end of thread, other threads:[~2024-06-20 11:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-19 13:52 [PATCH] nfs/blocklayout: fput() needed for ENODEV error flow cel
2024-06-20  5:21 ` Christoph Hellwig
2024-06-20  9:34 ` Sagi Grimberg
2024-06-20 11:32 ` Benjamin Coddington

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox