Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfsd: don't advertise a SCSI layout for an unsupported request_queue

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>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

authored by

Benjamin Coddington and committed by
J. Bruce Fields
8163496e 5b7b15ae

+2 -9
+2 -9
fs/nfsd/nfs4layouts.c
··· 133 133 if (!(exp->ex_flags & NFSEXP_PNFS)) 134 134 return; 135 135 136 - /* 137 - * If flex file is configured, use it by default. Otherwise 138 - * check if the file system supports exporting a block-like layout. 139 - * If the block device supports reservations prefer the SCSI layout, 140 - * otherwise advertise the block layout. 141 - */ 142 136 #ifdef CONFIG_NFSD_FLEXFILELAYOUT 143 137 exp->ex_layout_types |= 1 << LAYOUT_FLEX_FILES; 144 138 #endif 145 139 #ifdef CONFIG_NFSD_BLOCKLAYOUT 146 - /* overwrite flex file layout selection if needed */ 147 140 if (sb->s_export_op->get_uuid && 148 141 sb->s_export_op->map_blocks && 149 142 sb->s_export_op->commit_blocks) 150 143 exp->ex_layout_types |= 1 << LAYOUT_BLOCK_VOLUME; 151 144 #endif 152 145 #ifdef CONFIG_NFSD_SCSILAYOUT 153 - /* overwrite block layout selection if needed */ 154 146 if (sb->s_export_op->map_blocks && 155 147 sb->s_export_op->commit_blocks && 156 - sb->s_bdev && sb->s_bdev->bd_disk->fops->pr_ops) 148 + sb->s_bdev && sb->s_bdev->bd_disk->fops->pr_ops && 149 + blk_queue_scsi_passthrough(sb->s_bdev->bd_disk->queue)) 157 150 exp->ex_layout_types |= 1 << LAYOUT_SCSI; 158 151 #endif 159 152 }