server: Unlink remaining children inodes when deleting the parent.
This commit is contained in:
parent
a4e8f4dcdd
commit
037afca5a5
|
@ -438,6 +438,7 @@ static void inode_set_name( struct inode *inode, const char *name )
|
||||||
static void free_inode( struct inode *inode )
|
static void free_inode( struct inode *inode )
|
||||||
{
|
{
|
||||||
int subtree = 0, watches = 0;
|
int subtree = 0, watches = 0;
|
||||||
|
struct inode *tmp, *next;
|
||||||
struct dir *dir;
|
struct dir *dir;
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY( dir, &inode->dirs, struct dir, in_entry )
|
LIST_FOR_EACH_ENTRY( dir, &inode->dirs, struct dir, in_entry )
|
||||||
|
@ -448,7 +449,6 @@ static void free_inode( struct inode *inode )
|
||||||
|
|
||||||
if (!subtree && !inode->parent)
|
if (!subtree && !inode->parent)
|
||||||
{
|
{
|
||||||
struct inode *tmp, *next;
|
|
||||||
LIST_FOR_EACH_ENTRY_SAFE( tmp, next, &inode->children,
|
LIST_FOR_EACH_ENTRY_SAFE( tmp, next, &inode->children,
|
||||||
struct inode, ch_entry )
|
struct inode, ch_entry )
|
||||||
{
|
{
|
||||||
|
@ -464,6 +464,13 @@ static void free_inode( struct inode *inode )
|
||||||
if (inode->parent)
|
if (inode->parent)
|
||||||
list_remove( &inode->ch_entry );
|
list_remove( &inode->ch_entry );
|
||||||
|
|
||||||
|
/* disconnect remaining children from the parent */
|
||||||
|
LIST_FOR_EACH_ENTRY_SAFE( tmp, next, &inode->children, struct inode, ch_entry )
|
||||||
|
{
|
||||||
|
list_remove( &tmp->ch_entry );
|
||||||
|
tmp->parent = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (inode->wd != -1)
|
if (inode->wd != -1)
|
||||||
{
|
{
|
||||||
inotify_remove_watch( get_unix_fd( inotify_fd ), inode->wd );
|
inotify_remove_watch( get_unix_fd( inotify_fd ), inode->wd );
|
||||||
|
|
Loading…
Reference in New Issue