Commit 2b118bd4 authored by Sebastian Henschel's avatar Sebastian Henschel Committed by Greg Kroah-Hartman

[PATCH] sysfs: fs/sysfs/inode.c: modify parents ctime and mtime on creation

When a node is added to sysfs (e.g. a device plugged in via USB), the
filesystem fails to make this change visible in the parent directory's
ctime/mtime. This is in contrast to removing a device, because in that
case, sysfs makes use of the function simple_unlink from fs/libfs.c which
takes care of that. Instead of using simple_link from fs/libfs.c on
creation, sysfs implements its own mechanism. This patch hooks into the
function sysfs_create and sets the ctime and the mtime of the parent to
CURRENT_TIME.
Signed-off-by: default avatarSebastian Henschel <linux@kodeaffe.de>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 5b472ff2
......@@ -46,8 +46,13 @@ int sysfs_create(struct dentry * dentry, int mode, int (*init)(struct inode *))
struct inode * inode = NULL;
if (dentry) {
if (!dentry->d_inode) {
if ((inode = sysfs_new_inode(mode)))
if ((inode = sysfs_new_inode(mode))) {
if (dentry->d_parent && dentry->d_parent->d_inode) {
struct inode *p_inode = dentry->d_parent->d_inode;
p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME;
}
goto Proceed;
}
else
error = -ENOMEM;
} else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment