diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-03 14:36:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-03 14:36:55 -0400 |
commit | 41488202f1afac2e7425cc4d4a3b4208c3e2cc8c (patch) | |
tree | a5ccee1c7c95ec760b8abe3c6230a8adfee03c7f /fs | |
parent | 018c81b827563c4d64ad79f9b90ea985a65bff4d (diff) | |
parent | 17d0774f80681020eccc9638d925a23f1fc4f671 (diff) |
Merge tag 'driver-core-4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core fixes from Greg KH:
"Here are three small fixes for 4.8-rc5.
One for sysfs, one for kernfs, and one documentation fix, all for
reported issues. All of these have been in linux-next for a while"
* tag 'driver-core-4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
sysfs: correctly handle read offset on PREALLOC attrs
documentation: drivers/core/of: fix name of of_node symlink
kernfs: don't depend on d_find_any_alias() when generating notifications
Diffstat (limited to 'fs')
-rw-r--r-- | fs/kernfs/file.c | 28 | ||||
-rw-r--r-- | fs/sysfs/file.c | 8 |
2 files changed, 28 insertions, 8 deletions
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c index e1574008adc9..2bcb86e6e6ca 100644 --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c | |||
@@ -840,21 +840,35 @@ repeat: | |||
840 | mutex_lock(&kernfs_mutex); | 840 | mutex_lock(&kernfs_mutex); |
841 | 841 | ||
842 | list_for_each_entry(info, &kernfs_root(kn)->supers, node) { | 842 | list_for_each_entry(info, &kernfs_root(kn)->supers, node) { |
843 | struct kernfs_node *parent; | ||
843 | struct inode *inode; | 844 | struct inode *inode; |
844 | struct dentry *dentry; | ||
845 | 845 | ||
846 | /* | ||
847 | * We want fsnotify_modify() on @kn but as the | ||
848 | * modifications aren't originating from userland don't | ||
849 | * have the matching @file available. Look up the inodes | ||
850 | * and generate the events manually. | ||
851 | */ | ||
846 | inode = ilookup(info->sb, kn->ino); | 852 | inode = ilookup(info->sb, kn->ino); |
847 | if (!inode) | 853 | if (!inode) |
848 | continue; | 854 | continue; |
849 | 855 | ||
850 | dentry = d_find_any_alias(inode); | 856 | parent = kernfs_get_parent(kn); |
851 | if (dentry) { | 857 | if (parent) { |
852 | fsnotify_parent(NULL, dentry, FS_MODIFY); | 858 | struct inode *p_inode; |
853 | fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE, | 859 | |
854 | NULL, 0); | 860 | p_inode = ilookup(info->sb, parent->ino); |
855 | dput(dentry); | 861 | if (p_inode) { |
862 | fsnotify(p_inode, FS_MODIFY | FS_EVENT_ON_CHILD, | ||
863 | inode, FSNOTIFY_EVENT_INODE, kn->name, 0); | ||
864 | iput(p_inode); | ||
865 | } | ||
866 | |||
867 | kernfs_put(parent); | ||
856 | } | 868 | } |
857 | 869 | ||
870 | fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE, | ||
871 | kn->name, 0); | ||
858 | iput(inode); | 872 | iput(inode); |
859 | } | 873 | } |
860 | 874 | ||
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index f35523d4fa3a..b803213d1307 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -114,9 +114,15 @@ static ssize_t sysfs_kf_read(struct kernfs_open_file *of, char *buf, | |||
114 | * If buf != of->prealloc_buf, we don't know how | 114 | * If buf != of->prealloc_buf, we don't know how |
115 | * large it is, so cannot safely pass it to ->show | 115 | * large it is, so cannot safely pass it to ->show |
116 | */ | 116 | */ |
117 | if (pos || WARN_ON_ONCE(buf != of->prealloc_buf)) | 117 | if (WARN_ON_ONCE(buf != of->prealloc_buf)) |
118 | return 0; | 118 | return 0; |
119 | len = ops->show(kobj, of->kn->priv, buf); | 119 | len = ops->show(kobj, of->kn->priv, buf); |
120 | if (pos) { | ||
121 | if (len <= pos) | ||
122 | return 0; | ||
123 | len -= pos; | ||
124 | memmove(buf, buf + pos, len); | ||
125 | } | ||
120 | return min(count, len); | 126 | return min(count, len); |
121 | } | 127 | } |
122 | 128 | ||