]> 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)
commit47521843d5b91b72ddee62340123eb3a099d6e35
treeb4ab96fd8300dd73a398a7d587f8839fa052c03b
parent8e78a6af4d06623d8befb5724191fb4ed9f3e250
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