linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfsd: don't advertise a SCSI layout for an unsupported request_queue
@ 2018-06-19  8:57 Benjamin Coddington
  2018-06-19 13:55 ` J. Bruce Fields
  2018-06-19 14:11 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Benjamin Coddington @ 2018-06-19  8:57 UTC (permalink / raw)
  To: bfields, Jeff Layton, Bart Van Assche; +Cc: Christoph Hellwig, linux-nfs

Commit 30181faae37f ("nfsd: Check queue type before submitting a SCSI
request") did the work of ensuring that we don't send SCSI requests to a
request queue that won't support them, but that check is in the
GETDEVICEINFO path.  Let's not set the SCSI layout in fs_layout_type in the
first place, and then we'll have less clients sending GETDEVICEINFO for
non-SCSI request queues and less unnecessary WARN_ONs.

While we're in here, remove some outdated comments that refer to
"overwriting" layout seletion because commit 8a4c3926889e ("nfsd: allow
nfsd to advertise multiple layout types") changed things to no longer
overwrite the layout type.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/nfsd/nfs4layouts.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
index 7d888369f85a..0ba7d3150213 100644
--- a/fs/nfsd/nfs4layouts.c
+++ b/fs/nfsd/nfs4layouts.c
@@ -133,27 +133,20 @@ void nfsd4_setup_layout_type(struct svc_export *exp)
 	if (!(exp->ex_flags & NFSEXP_PNFS))
 		return;
 
-	/*
-	 * If flex file is configured, use it by default. Otherwise
-	 * check if the file system supports exporting a block-like layout.
-	 * If the block device supports reservations prefer the SCSI layout,
-	 * otherwise advertise the block layout.
-	 */
 #ifdef CONFIG_NFSD_FLEXFILELAYOUT
 	exp->ex_layout_types |= 1 << LAYOUT_FLEX_FILES;
 #endif
 #ifdef CONFIG_NFSD_BLOCKLAYOUT
-	/* overwrite flex file layout selection if needed */
 	if (sb->s_export_op->get_uuid &&
 	    sb->s_export_op->map_blocks &&
 	    sb->s_export_op->commit_blocks)
 		exp->ex_layout_types |= 1 << LAYOUT_BLOCK_VOLUME;
 #endif
 #ifdef CONFIG_NFSD_SCSILAYOUT
-	/* overwrite block layout selection if needed */
 	if (sb->s_export_op->map_blocks &&
 	    sb->s_export_op->commit_blocks &&
-	    sb->s_bdev && sb->s_bdev->bd_disk->fops->pr_ops)
+	    sb->s_bdev && sb->s_bdev->bd_disk->fops->pr_ops &&
+		blk_queue_scsi_passthrough(sb->s_bdev->bd_disk->queue))
 		exp->ex_layout_types |= 1 << LAYOUT_SCSI;
 #endif
 }
-- 
2.14.3


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

* Re: [PATCH] nfsd: don't advertise a SCSI layout for an unsupported request_queue
  2018-06-19  8:57 [PATCH] nfsd: don't advertise a SCSI layout for an unsupported request_queue Benjamin Coddington
@ 2018-06-19 13:55 ` J. Bruce Fields
  2018-06-19 14:11 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: J. Bruce Fields @ 2018-06-19 13:55 UTC (permalink / raw)
  To: Benjamin Coddington
  Cc: Jeff Layton, Bart Van Assche, Christoph Hellwig, linux-nfs

Thanks, applying.--b.

On Tue, Jun 19, 2018 at 04:57:24AM -0400, Benjamin Coddington wrote:
> Commit 30181faae37f ("nfsd: Check queue type before submitting a SCSI
> request") did the work of ensuring that we don't send SCSI requests to a
> request queue that won't support them, but that check is in the
> GETDEVICEINFO path.  Let's not set the SCSI layout in fs_layout_type in the
> first place, and then we'll have less clients sending GETDEVICEINFO for
> non-SCSI request queues and less unnecessary WARN_ONs.
> 
> While we're in here, remove some outdated comments that refer to
> "overwriting" layout seletion because commit 8a4c3926889e ("nfsd: allow
> nfsd to advertise multiple layout types") changed things to no longer
> overwrite the layout type.
> 
> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
> ---
>  fs/nfsd/nfs4layouts.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c
> index 7d888369f85a..0ba7d3150213 100644
> --- a/fs/nfsd/nfs4layouts.c
> +++ b/fs/nfsd/nfs4layouts.c
> @@ -133,27 +133,20 @@ void nfsd4_setup_layout_type(struct svc_export *exp)
>  	if (!(exp->ex_flags & NFSEXP_PNFS))
>  		return;
>  
> -	/*
> -	 * If flex file is configured, use it by default. Otherwise
> -	 * check if the file system supports exporting a block-like layout.
> -	 * If the block device supports reservations prefer the SCSI layout,
> -	 * otherwise advertise the block layout.
> -	 */
>  #ifdef CONFIG_NFSD_FLEXFILELAYOUT
>  	exp->ex_layout_types |= 1 << LAYOUT_FLEX_FILES;
>  #endif
>  #ifdef CONFIG_NFSD_BLOCKLAYOUT
> -	/* overwrite flex file layout selection if needed */
>  	if (sb->s_export_op->get_uuid &&
>  	    sb->s_export_op->map_blocks &&
>  	    sb->s_export_op->commit_blocks)
>  		exp->ex_layout_types |= 1 << LAYOUT_BLOCK_VOLUME;
>  #endif
>  #ifdef CONFIG_NFSD_SCSILAYOUT
> -	/* overwrite block layout selection if needed */
>  	if (sb->s_export_op->map_blocks &&
>  	    sb->s_export_op->commit_blocks &&
> -	    sb->s_bdev && sb->s_bdev->bd_disk->fops->pr_ops)
> +	    sb->s_bdev && sb->s_bdev->bd_disk->fops->pr_ops &&
> +		blk_queue_scsi_passthrough(sb->s_bdev->bd_disk->queue))
>  		exp->ex_layout_types |= 1 << LAYOUT_SCSI;
>  #endif
>  }
> -- 
> 2.14.3

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

* Re: [PATCH] nfsd: don't advertise a SCSI layout for an unsupported request_queue
  2018-06-19  8:57 [PATCH] nfsd: don't advertise a SCSI layout for an unsupported request_queue Benjamin Coddington
  2018-06-19 13:55 ` J. Bruce Fields
@ 2018-06-19 14:11 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2018-06-19 14:11 UTC (permalink / raw)
  To: Benjamin Coddington
  Cc: bfields, Jeff Layton, Bart Van Assche, Christoph Hellwig, linux-nfs

On Tue, Jun 19, 2018 at 04:57:24AM -0400, Benjamin Coddington wrote:
> Commit 30181faae37f ("nfsd: Check queue type before submitting a SCSI
> request") did the work of ensuring that we don't send SCSI requests to a
> request queue that won't support them, but that check is in the
> GETDEVICEINFO path.  Let's not set the SCSI layout in fs_layout_type in the
> first place, and then we'll have less clients sending GETDEVICEINFO for
> non-SCSI request queues and less unnecessary WARN_ONs.
> 
> While we're in here, remove some outdated comments that refer to
> "overwriting" layout seletion because commit 8a4c3926889e ("nfsd: allow
> nfsd to advertise multiple layout types") changed things to no longer
> overwrite the layout type.
> 
> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>

Looks good,

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

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

end of thread, other threads:[~2018-06-19 14:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19  8:57 [PATCH] nfsd: don't advertise a SCSI layout for an unsupported request_queue Benjamin Coddington
2018-06-19 13:55 ` J. Bruce Fields
2018-06-19 14:11 ` Christoph Hellwig

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).