4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-31 15:10:23 +08:00

Fix the problem that when dfs_v2 transmits fd, dentry or vnode does not exist (#8089)

This commit is contained in:
zmq810150896 2023-10-12 08:22:46 +08:00 committed by GitHub
parent 19bfdac891
commit e6eddfa711
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -407,19 +407,26 @@ static int _ipc_msg_fd_new(void *file)
return -1;
}
#ifdef RT_USING_DFS_V2
d->fops = df->fops;
d->mode = df->mode;
d->dentry = df->dentry;
d->dentry->ref_count ++;
#endif
d->vnode = df->vnode;
d->flags = df->flags;
d->data = df->data;
d->magic = df->magic;
d->vnode->ref_count ++;
#ifdef RT_USING_DFS_V2
d->fops = df->fops;
d->mode = df->mode;
d->dentry = df->dentry;
if (d->dentry)
rt_atomic_add(&(d->dentry->ref_count), 1);
if (d->vnode)
rt_atomic_add(&(d->vnode->ref_count), 1);
#else
if (d->vnode)
d->vnode->ref_count ++;
#endif
return fd;
}