zdsfs: add online vtoc refresh

Enable zdsfs to access datasets that were created after zdsfs was
mounted without the need to remount zdsfs.
This is done by re-reading the VTOC with every readdir system call.
To ensure a consistent VTOC state the DASD device is reserved for
every VTOC read and released afterwards.

Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Stefan Haberland
2018-12-11 17:27:34 +01:00
committed by Jan Höppner
parent e9c030f202
commit bc053a975a
6 changed files with 280 additions and 131 deletions
+39
View File
@@ -261,3 +261,42 @@ int dasd_reread_partition_table(const char *device, int ntries)
return err;
}
/*
* Reserve DASD disk.
*
* @param[in] device node device node's name
*
* @retval 0 in case of success
* @retval errno in case of failure
*
*/
int dasd_disk_reserve(const char *device)
{
int fd;
fd = dasd_open_device(device, O_RDONLY);
RUN_IOCTL(fd, BIODASDRSRV, NULL);
dasd_close_device(fd);
return 0;
}
/*
* Release DASD disk
*
* @param[in] device node device node's name
*
* @retval 0 in case of success
* @retval errno in case of failure
*/
int dasd_disk_release(const char *device)
{
int fd;
fd = dasd_open_device(device, O_RDONLY);
RUN_IOCTL(fd, BIODASDRLSE, NULL);
dasd_close_device(fd);
return 0;
}