vfs: add path_put_init()

This one initializes the struct path to all zeroes so that multiple
path_put_init() on the path is safe.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
Miklos Szeredi 2017-11-09 10:23:28 +01:00
parent f30536f0f9
commit f121aadede
1 changed files with 6 additions and 0 deletions

View File

@ -18,4 +18,10 @@ static inline int path_equal(const struct path *path1, const struct path *path2)
return path1->mnt == path2->mnt && path1->dentry == path2->dentry; return path1->mnt == path2->mnt && path1->dentry == path2->dentry;
} }
static inline void path_put_init(struct path *path)
{
path_put(path);
*path = (struct path) { };
}
#endif /* _LINUX_PATH_H */ #endif /* _LINUX_PATH_H */