Pull ec into release branch
[powerpc.git] / fs / sysfs / inode.c
index dbd820f..4de5c6b 100644 (file)
@@ -29,10 +29,20 @@ static struct backing_dev_info sysfs_backing_dev_info = {
        .capabilities   = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK,
 };
 
-static struct inode_operations sysfs_inode_operations ={
+static const struct inode_operations sysfs_inode_operations ={
        .setattr        = sysfs_setattr,
 };
 
+void sysfs_delete_inode(struct inode *inode)
+{
+       /* Free the shadowed directory inode operations */
+       if (sysfs_is_shadowed_inode(inode)) {
+               kfree(inode->i_op);
+               inode->i_op = NULL;
+       }
+       return generic_delete_inode(inode);
+}
+
 int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
 {
        struct inode * inode = dentry->d_inode;
@@ -212,11 +222,12 @@ const unsigned char * sysfs_get_name(struct sysfs_dirent *sd)
 
 static inline void orphan_all_buffers(struct inode *node)
 {
-       struct sysfs_buffer_collection *set = node->i_private;
+       struct sysfs_buffer_collection *set;
        struct sysfs_buffer *buf;
 
        mutex_lock_nested(&node->i_mutex, I_MUTEX_CHILD);
-       if (node->i_private) {
+       set = node->i_private;
+       if (set) {
                list_for_each_entry(buf, &set->associates, associates) {
                        down(&buf->sem);
                        buf->orphaned = 1;