Commit a5231a38 authored by Scott Murray's avatar Scott Murray

[PATCH] Small pcihpfs dnotify fix

I've been working on a userspace daemon to go with my CompactPCI driver,
and yesterday I discovered an oversight in pci_hp_change_slot_info - it
doesn't call dnotify_parent, so dnotify based clients basically don't
work against pcihpfs.  The following patch (against 2.5 BK) reworks
things to just update the mtime (since we're modifying the file after
all), and then call dnotify_parent.
parent 461a50a3
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/namei.h> #include <linux/namei.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dnotify.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "pci_hotplug.h" #include "pci_hotplug.h"
...@@ -1012,10 +1013,13 @@ int pci_hp_deregister (struct hotplug_slot *slot) ...@@ -1012,10 +1013,13 @@ int pci_hp_deregister (struct hotplug_slot *slot)
return 0; return 0;
} }
static inline void update_inode_time (struct inode *inode) static inline void update_dentry_inode_time (struct dentry *dentry)
{ {
if (inode) struct inode *inode = dentry->d_inode;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; if (inode) {
inode->i_mtime = CURRENT_TIME;
dnotify_parent(dentry, DN_MODIFY);
}
} }
/** /**
...@@ -1050,16 +1054,16 @@ int pci_hp_change_slot_info (const char *name, struct hotplug_slot_info *info) ...@@ -1050,16 +1054,16 @@ int pci_hp_change_slot_info (const char *name, struct hotplug_slot_info *info)
core = temp->core_priv; core = temp->core_priv;
if ((core->power_dentry) && if ((core->power_dentry) &&
(temp->info->power_status != info->power_status)) (temp->info->power_status != info->power_status))
update_inode_time (core->power_dentry->d_inode); update_dentry_inode_time (core->power_dentry);
if ((core->attention_dentry) && if ((core->attention_dentry) &&
(temp->info->attention_status != info->attention_status)) (temp->info->attention_status != info->attention_status))
update_inode_time (core->attention_dentry->d_inode); update_dentry_inode_time (core->attention_dentry);
if ((core->latch_dentry) && if ((core->latch_dentry) &&
(temp->info->latch_status != info->latch_status)) (temp->info->latch_status != info->latch_status))
update_inode_time (core->latch_dentry->d_inode); update_dentry_inode_time (core->latch_dentry);
if ((core->adapter_dentry) && if ((core->adapter_dentry) &&
(temp->info->adapter_status != info->adapter_status)) (temp->info->adapter_status != info->adapter_status))
update_inode_time (core->adapter_dentry->d_inode); update_dentry_inode_time (core->adapter_dentry);
memcpy (temp->info, info, sizeof (struct hotplug_slot_info)); memcpy (temp->info, info, sizeof (struct hotplug_slot_info));
spin_unlock (&list_lock); spin_unlock (&list_lock);
......
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