mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-23 18:14:24 +08:00
fix: unlink may failed with I/O error
This commit is contained in:
parent
c38e349117
commit
6bbb912bca
@ -1503,7 +1503,7 @@ search:
|
|||||||
*/
|
*/
|
||||||
if (ni->mrec->link_count) {
|
if (ni->mrec->link_count) {
|
||||||
ntfs_inode_update_times(ni, NTFS_UPDATE_CTIME);
|
ntfs_inode_update_times(ni, NTFS_UPDATE_CTIME);
|
||||||
goto out;
|
goto ok;
|
||||||
}
|
}
|
||||||
ntfs_attr_reinit_search_ctx(actx);
|
ntfs_attr_reinit_search_ctx(actx);
|
||||||
while (!ntfs_attrs_walk(actx)) {
|
while (!ntfs_attrs_walk(actx)) {
|
||||||
@ -1545,12 +1545,16 @@ search:
|
|||||||
"Leaving inconsistent metadata.\n");
|
"Leaving inconsistent metadata.\n");
|
||||||
}
|
}
|
||||||
ni = NULL;
|
ni = NULL;
|
||||||
|
ok:
|
||||||
|
ntfs_inode_update_times(dir_ni, NTFS_UPDATE_MCTIME);
|
||||||
out:
|
out:
|
||||||
if (actx)
|
if (actx)
|
||||||
ntfs_attr_put_search_ctx(actx);
|
ntfs_attr_put_search_ctx(actx);
|
||||||
if (ictx)
|
if (ictx)
|
||||||
ntfs_index_ctx_put(ictx);
|
ntfs_index_ctx_put(ictx);
|
||||||
if (ni && ntfs_inode_close(ni) && !err)
|
if (ntfs_inode_close(dir_ni) && !err)
|
||||||
|
err = errno;
|
||||||
|
if (ntfs_inode_close(ni) && !err)
|
||||||
err = errno;
|
err = errno;
|
||||||
if (err) {
|
if (err) {
|
||||||
errno = err;
|
errno = err;
|
||||||
|
@ -1276,27 +1276,23 @@ static int ntfs_fuse_rm(const char *org_path)
|
|||||||
res = -errno;
|
res = -errno;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
/* JPA deny unlinking if directory is not writable and executable */
|
/* JPA deny unlinking if directory is not writable and executable */
|
||||||
if (!ntfs_fuse_fill_security_context(&security)
|
if (!ntfs_fuse_fill_security_context(&security)
|
||||||
|| ntfs_allowed_access(&security, path, dir_ni,
|
|| ntfs_allowed_access(&security, path, dir_ni,
|
||||||
S_IEXEC + S_IWRITE + S_ISVTX)) {
|
S_IEXEC + S_IWRITE + S_ISVTX)) {
|
||||||
|
|
||||||
if (ntfs_delete(ni, dir_ni, uname, uname_len))
|
if (ntfs_delete(ni, dir_ni, uname, uname_len))
|
||||||
res = -errno;
|
res = -errno;
|
||||||
else {
|
/* ntfs_delete() always closes ni and dir_ni */
|
||||||
/* Inode ctime is updated in ntfs_delete() for hard links. */
|
ni = dir_ni = NULL;
|
||||||
ntfs_fuse_update_times(dir_ni, NTFS_UPDATE_MCTIME);
|
|
||||||
}
|
|
||||||
} else
|
} else
|
||||||
res = -EACCES;
|
res = -EACCES;
|
||||||
/* ntfs_delete() always closes ni */
|
|
||||||
ni = NULL;
|
|
||||||
exit:
|
exit:
|
||||||
if (ni && ntfs_inode_close(ni))
|
if (ntfs_inode_close(dir_ni))
|
||||||
|
set_fuse_error(&res);
|
||||||
|
if (ntfs_inode_close(ni))
|
||||||
set_fuse_error(&res);
|
set_fuse_error(&res);
|
||||||
free(uname);
|
free(uname);
|
||||||
if (dir_ni && ntfs_inode_close(dir_ni))
|
|
||||||
set_fuse_error(&res);
|
|
||||||
free(path);
|
free(path);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user