From: Jan Kara OK, it's a problem with CIFS. Its cifs_hardlink() function doesn't call d_instantiate() and thus returns a dentry with d_inode set to NULL. I'm not sure if such behavior is really correct but anyway, attached is a new version of the patch which should handle it gracefully. Signed-off-by: Jan Kara Cc: Morten Welinder Cc: Robert Love Cc: John McCutchan Cc: Steven French Cc: Kamalesh Babulal Signed-off-by: Andrew Morton --- fs/namei.c | 2 +- include/linux/fsnotify.h | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff -puN fs/namei.c~inotify-send-in_attrib-events-when-link-count-changes-fix fs/namei.c --- a/fs/namei.c~inotify-send-in_attrib-events-when-link-count-changes-fix +++ a/fs/namei.c @@ -2362,7 +2362,7 @@ int vfs_link(struct dentry *old_dentry, error = dir->i_op->link(old_dentry, dir, new_dentry); mutex_unlock(&old_dentry->d_inode->i_mutex); if (!error) - fsnotify_link(dir, new_dentry); + fsnotify_link(dir, old_dentry->d_inode, new_dentry); return error; } diff -puN include/linux/fsnotify.h~inotify-send-in_attrib-events-when-link-count-changes-fix include/linux/fsnotify.h --- a/include/linux/fsnotify.h~inotify-send-in_attrib-events-when-link-count-changes-fix +++ a/include/linux/fsnotify.h @@ -112,14 +112,16 @@ static inline void fsnotify_create(struc /* * fsnotify_link - new hardlink in 'inode' directory + * Note: We have to pass also the linked inode ptr as some filesystems leave + * new_dentry->d_inode NULL and instantiate inode pointer later */ -static inline void fsnotify_link(struct inode *inode, struct dentry *new_dentry) +static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) { - inode_dir_notify(inode, DN_CREATE); - inotify_inode_queue_event(inode, IN_CREATE, 0, new_dentry->d_name.name, - new_dentry->d_inode); - fsnotify_link_count(new_dentry->d_inode); - audit_inode_child(new_dentry->d_name.name, new_dentry, inode); + inode_dir_notify(dir, DN_CREATE); + inotify_inode_queue_event(dir, IN_CREATE, 0, new_dentry->d_name.name, + inode); + fsnotify_link_count(inode); + audit_inode_child(new_dentry->d_name.name, new_dentry, dir); } /* _