diff options
| author | David S. Miller <davem@davemloft.net> | 2009-03-28 03:19:16 +0300 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2009-03-28 03:19:16 +0300 |
| commit | a83398570e17af6bb81eb94f4f5dd356bd2828d8 (patch) | |
| tree | 5b5c7c3a56898485479291b7c964a1f3887d469c /fs/sysfs/inode.c | |
| parent | f9384d41c02408dd404aa64d66d0ef38adcf6479 (diff) | |
| parent | 0b4d569de222452bcb55a4a536ade6cf4d8d1e30 (diff) | |
| download | linux-a83398570e17af6bb81eb94f4f5dd356bd2828d8.tar.xz | |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Diffstat (limited to 'fs/sysfs/inode.c')
| -rw-r--r-- | fs/sysfs/inode.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index dfa3d94cfc74..555f0ff988df 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c @@ -147,6 +147,7 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode) { struct bin_attribute *bin_attr; + inode->i_private = sysfs_get(sd); inode->i_mapping->a_ops = &sysfs_aops; inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; inode->i_op = &sysfs_inode_operations; @@ -214,6 +215,22 @@ struct inode * sysfs_get_inode(struct sysfs_dirent *sd) return inode; } +/* + * The sysfs_dirent serves as both an inode and a directory entry for sysfs. + * To prevent the sysfs inode numbers from being freed prematurely we take a + * reference to sysfs_dirent from the sysfs inode. A + * super_operations.delete_inode() implementation is needed to drop that + * reference upon inode destruction. + */ +void sysfs_delete_inode(struct inode *inode) +{ + struct sysfs_dirent *sd = inode->i_private; + + truncate_inode_pages(&inode->i_data, 0); + clear_inode(inode); + sysfs_put(sd); +} + int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name) { struct sysfs_addrm_cxt acxt; |
