diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index b53f3428b..f62bee40e 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -263,8 +263,8 @@ static void vdisk_exec_mode_select(struct scst_cmd *cmd); static void vdisk_exec_log(struct scst_cmd *cmd); static void vdisk_exec_read_toc(struct scst_cmd *cmd); static void vdisk_exec_prevent_allow_medium_removal(struct scst_cmd *cmd); -static int vdisk_fsync(struct scst_vdisk_thr *thr, - loff_t loff, loff_t len, struct scst_cmd *cmd); +static int vdisk_fsync(struct scst_vdisk_thr *thr, loff_t loff, + loff_t len, struct scst_cmd *cmd, struct scst_device *dev); static int vdisk_read_proc(struct seq_file *seq, struct scst_dev_type *dev_type); static int vdisk_write_proc(char *buffer, char **start, off_t offset, @@ -908,7 +908,7 @@ static int vdisk_do_job(struct scst_cmd *cmd) (long long unsigned int)loff, (long long unsigned int)data_len); do_fsync = 1; - if (vdisk_fsync(thr, 0, 0, cmd) != 0) + if (vdisk_fsync(thr, 0, 0, cmd, dev) != 0) goto out_compl; } if (virt_dev->blockio) { @@ -918,7 +918,7 @@ static int vdisk_do_job(struct scst_cmd *cmd) vdisk_exec_write(cmd, thr, loff); /* O_SYNC flag is used for WT devices */ if (do_fsync || fua) - vdisk_fsync(thr, loff, data_len, cmd); + vdisk_fsync(thr, loff, data_len, cmd, dev); } else { PRINT_WARNING("Attempt of write access to read-only " "device %s: initiator %s, op %x", @@ -947,7 +947,7 @@ static int vdisk_do_job(struct scst_cmd *cmd) (long long unsigned int)loff, (long long unsigned int)data_len); do_fsync = 1; - if (vdisk_fsync(thr, 0, 0, cmd) != 0) + if (vdisk_fsync(thr, 0, 0, cmd, dev) != 0) goto out_compl; } /* ToDo: BLOCKIO VERIFY */ @@ -956,7 +956,7 @@ static int vdisk_do_job(struct scst_cmd *cmd) if (scsi_status_is_good(cmd->status)) vdisk_exec_verify(cmd, thr, loff); else if (do_fsync) - vdisk_fsync(thr, loff, data_len, cmd); + vdisk_fsync(thr, loff, data_len, cmd, dev); } else { PRINT_WARNING("Attempt of write access to read-only " "device %s: initiator %s, op %x", @@ -974,16 +974,16 @@ static int vdisk_do_job(struct scst_cmd *cmd) (long long unsigned int)loff, (long long unsigned int)data_len, immed); if (immed) { - scst_cmd_get(cmd); + scst_cmd_get(cmd); /* to protect dev */ cmd->completed = 1; cmd->scst_cmd_done(cmd, SCST_CMD_STATE_DEFAULT, SCST_CONTEXT_SAME); - vdisk_fsync(thr, loff, data_len, NULL); + vdisk_fsync(thr, loff, data_len, NULL, dev); /* ToDo: vdisk_fsync() error processing */ scst_cmd_put(cmd); goto out_thr; } else { - vdisk_fsync(thr, loff, data_len, cmd); + vdisk_fsync(thr, loff, data_len, cmd, dev); break; } } @@ -1012,7 +1012,7 @@ static int vdisk_do_job(struct scst_cmd *cmd) vdisk_exec_read_toc(cmd); break; case START_STOP: - vdisk_fsync(thr, 0, virt_dev->file_size, cmd); + vdisk_fsync(thr, 0, virt_dev->file_size, cmd, dev); break; case RESERVE: case RESERVE_10: @@ -2050,12 +2050,12 @@ static void vdisk_exec_prevent_allow_medium_removal(struct scst_cmd *cmd) return; } -static int vdisk_fsync(struct scst_vdisk_thr *thr, - loff_t loff, loff_t len, struct scst_cmd *cmd) +static int vdisk_fsync(struct scst_vdisk_thr *thr, loff_t loff, + loff_t len, struct scst_cmd *cmd, struct scst_device *dev) { int res = 0; struct scst_vdisk_dev *virt_dev = - (struct scst_vdisk_dev *)cmd->dev->dh_priv; + (struct scst_vdisk_dev *)dev->dh_priv; struct file *file = thr->fd; struct inode *inode; struct address_space *mapping; @@ -2569,7 +2569,7 @@ static void vdisk_exec_verify(struct scst_cmd *cmd, TRACE_ENTRY(); - if (vdisk_fsync(thr, loff, cmd->bufflen, cmd) != 0) + if (vdisk_fsync(thr, loff, cmd->bufflen, cmd, cmd->dev) != 0) goto out; /*