Declare the show function and let procfs open and free the seq_file of
/proc/scsi/<driver>/<host>. ->proc_open() only preallocates the buffer
now. Reading the file then no longer holds up its removal when the host
goes away.
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
---
drivers/scsi/scsi_proc.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 3e49c4c8704f..59229bf9938e 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -94,10 +94,10 @@ static int proc_scsi_show(struct seq_file *m, void *v)
return shost->hostt->show_info(m, shost);
}
+/* procfs opens the seq_file */
static int proc_scsi_host_open(struct inode *inode, struct file *file)
{
- return single_open_size(file, proc_scsi_show, pde_data(inode),
- 4 * PAGE_SIZE);
+ return seq_preallocate(file->private_data, 4 * PAGE_SIZE);
}
static struct scsi_proc_entry *@@ -140,10 +140,8 @@ scsi_template_proc_dir(const struct scsi_host_template *sht)
EXPORT_SYMBOL_GPL(scsi_template_proc_dir);
static const struct proc_ops proc_scsi_ops = {
+ .proc_show = proc_scsi_show,
.proc_open = proc_scsi_host_open,
- .proc_release = single_release,
- .proc_read = seq_read,
- .proc_lseek = seq_lseek,
.proc_write = proc_scsi_host_write
};
--
2.53.0