Commit d374176f authored by Zhang Jingwang's avatar Zhang Jingwang Committed by Dries Kimpe
Browse files

Fix file caching issue when file is deleted.

Release the dcache entry and close the file when it is deleted. So
that underlying resources could be released.
parent 2c72e8c7
......@@ -921,10 +921,20 @@ static int zoidfs_posix_remove(const zoidfs_handle_t *parent_handle,
char tmpbuf[ZOIDFS_PATH_MAX];
const char * path = zoidfs_simplify_path (parent_handle, component_name,
full_path, tmpbuf);
struct stat s;
if (!path)
return ZFSERR_STALE;
// release open fd from cache.
if (lstat (path, &s) < 0)
return errno2zfs (errno);
if (S_ISREG(s.st_mode)) {
zoidfs_handle_t handle;
filename2handle (&s, path, &handle);
dcache_removefd(dcache, &handle);
}
// ignore component_name
if (unlink (path)< 0)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment