]> git.baikalelectronics.ru Git - kernel.git/commit
dentry name snapshots
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 7 Jul 2017 18:51:19 +0000 (14:51 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 8 Jul 2017 00:09:10 +0000 (20:09 -0400)
commita5b830517d26a68dd1a684b2c10e3275cb3f1ecf
treeb4ab96fd8300dd73a398a7d587f8839fa052c03b
parent5e48f5ac6ca3a890683efc7423d1049161f5a3f5
dentry name snapshots

take_dentry_name_snapshot() takes a safe snapshot of dentry name;
if the name is a short one, it gets copied into caller-supplied
structure, otherwise an extra reference to external name is grabbed
(those are never modified).  In either case the pointer to stable
string is stored into the same structure.

dentry must be held by the caller of take_dentry_name_snapshot(),
but may be freely dropped afterwards - the snapshot will stay
until destroyed by release_dentry_name_snapshot().

Intended use:
struct name_snapshot s;

take_dentry_name_snapshot(&s, dentry);
...
access s.name
...
release_dentry_name_snapshot(&s);

Replaces fsnotify_oldname_...(), gets used in fsnotify to obtain the name
to pass down with event.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/dcache.c
fs/debugfs/inode.c
fs/namei.c
fs/notify/fsnotify.c
include/linux/dcache.h
include/linux/fsnotify.h