VFS: change vfs_class::nothingisopen members

Do not free VFS before nested one.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2019-05-18 18:19:00 +03:00
parent 5b0f177e62
commit 94c0b79f37
4 changed files with 24 additions and 12 deletions

View File

@ -842,9 +842,7 @@ vfs_s_getid (const vfs_path_t * vpath)
static gboolean
vfs_s_nothingisopen (vfsid id)
{
(void) id;
/* Our data structures should survive free of superblock at any time */
return TRUE;
return (VFS_SUPER (id)->fd_usage <= 0);
}
/* --------------------------------------------------------------------------------------------- */

View File

@ -1373,14 +1373,6 @@ extfs_getid (const vfs_path_t * vpath)
/* --------------------------------------------------------------------------------------------- */
static gboolean
extfs_nothingisopen (vfsid id)
{
return (VFS_SUPER (id)->fd_usage <= 0);
}
/* --------------------------------------------------------------------------------------------- */
static vfs_path_t *
extfs_getlocalcopy (const vfs_path_t * vpath)
{
@ -1614,7 +1606,6 @@ vfs_init_extfs (void)
vfs_extfs_ops->ferrno = extfs_errno;
vfs_extfs_ops->lseek = extfs_lseek;
vfs_extfs_ops->getid = extfs_getid;
vfs_extfs_ops->nothingisopen = extfs_nothingisopen;
vfs_extfs_ops->getlocalcopy = extfs_getlocalcopy;
vfs_extfs_ops->ungetlocalcopy = extfs_ungetlocalcopy;
vfs_extfs_ops->mkdir = extfs_mkdir;

View File

@ -421,6 +421,16 @@ local_lseek (void *data, off_t offset, int whence)
/* --------------------------------------------------------------------------------------------- */
static gboolean
local_nothingisopen (vfsid id)
{
(void) id;
return TRUE;
}
/* --------------------------------------------------------------------------------------------- */
void
vfs_init_localfs (void)
{
@ -455,6 +465,7 @@ vfs_init_localfs (void)
vfs_local_ops->ungetlocalcopy = local_ungetlocalcopy;
vfs_local_ops->mkdir = local_mkdir;
vfs_local_ops->rmdir = local_rmdir;
vfs_local_ops->nothingisopen = local_nothingisopen;
vfs_register_class (vfs_local_ops);
}

View File

@ -2211,6 +2211,17 @@ smbfs_fstat (void *data, struct stat *buf)
return 0;
}
/* --------------------------------------------------------------------------------------------- */
static gboolean
smbfs_nothingisopen (vfsid id)
{
/* FIXME */
(void) id;
return TRUE;
}
/* --------------------------------------------------------------------------------------------- */
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
@ -2274,6 +2285,7 @@ vfs_init_smbfs (void)
vfs_smbfs_ops->mkdir = smbfs_mkdir;
vfs_smbfs_ops->rmdir = smbfs_rmdir;
vfs_smbfs_ops->setctl = smbfs_setctl;
vfs_smbfs_ops->nothingisopen = smbfs_nothingisopen;
vfs_register_class (vfs_smbfs_ops);
}