Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-126731 / 24.04-RC.1 / scst_vdisk: Add active attributes support to vdisk_fileio (by bmeagherix) #28

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions scst/src/dev_handlers/scst_vdisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,12 @@ static void vdisk_blockio_check_flush_support(struct scst_vdisk_dev *virt_dev)
return;
}

static bool vdisk_supports_active(const struct scst_vdisk_dev *virt_dev)
{
/* Both blockio and fileio support active attribute */
return !virt_dev->nullio;
}

static void vdisk_check_tp_support(struct scst_vdisk_dev *virt_dev)
{
struct block_device *bdev = NULL;
Expand All @@ -550,7 +556,7 @@ static void vdisk_check_tp_support(struct scst_vdisk_dev *virt_dev)
res = PTR_ERR_OR_ZERO(fd);
}
if (res) {
if (res == -EMEDIUMTYPE && virt_dev->blockio)
if (res == -EMEDIUMTYPE && vdisk_supports_active(virt_dev))
TRACE(TRACE_MINOR,
"Unable to open %s with EMEDIUMTYPE, DRBD passive?",
virt_dev->filename);
Expand Down Expand Up @@ -666,7 +672,7 @@ static int vdisk_get_file_size(const struct scst_vdisk_dev *virt_dev,
}

res = scst_file_or_bdev_size(virt_dev->filename);
if (res == -EMEDIUMTYPE && virt_dev->blockio) {
if (res == -EMEDIUMTYPE && vdisk_supports_active(virt_dev)) {
TRACE(TRACE_MINOR,
"Unable to open %s with EMEDIUMTYPE, DRBD passive?",
virt_dev->filename);
Expand Down Expand Up @@ -1070,7 +1076,7 @@ static int vdisk_reexamine(struct scst_vdisk_dev *virt_dev)

res = vdisk_get_file_size(virt_dev, &file_size);
if (res < 0) {
if ((res == -EMEDIUMTYPE) && virt_dev->blockio) {
if ((res == -EMEDIUMTYPE) && vdisk_supports_active(virt_dev)) {
TRACE_DBG("Reexam pending (dev %s)", virt_dev->name);
virt_dev->reexam_pending = 1;
res = 0;
Expand Down Expand Up @@ -1442,7 +1448,7 @@ static int vdisk_attach_tgt(struct scst_tgt_dev *tgt_dev)
if (!virt_dev->nullio && !virt_dev->cdrom_empty) {
res = vdisk_open_fd(virt_dev, tgt_dev->dev->dev_rd_only);
if (res != 0) {
if ((res == -EMEDIUMTYPE) && virt_dev->blockio) {
if ((res == -EMEDIUMTYPE) && vdisk_supports_active(virt_dev)) {
/* It's OK, it will be reopen on exec */
res = 0;
} else {
Expand Down Expand Up @@ -9577,6 +9583,7 @@ static struct scst_trace_log vdisk_local_trace_tbl[] = {
#endif

static const struct attribute *vdisk_fileio_attrs[] = {
&vdev_active_attr.attr,
&vdev_size_ro_attr.attr,
&vdev_size_mb_ro_attr.attr,
&vdisk_blocksize_attr.attr,
Expand Down Expand Up @@ -9610,6 +9617,7 @@ static const struct attribute *vdisk_fileio_attrs[] = {
};

static const char *const fileio_add_dev_params[] = {
"active",
"async",
"blocksize",
"cluster_mode",
Expand Down
Loading