diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-05-05 16:54:33 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-05-05 16:54:33 +0200 |
commit | 59991da498122f779434c4e0beac8a69e0322938 (patch) | |
tree | 23e46bc7f355c6d65f3246f756cd8ef84cfc3030 /fs/kernfs/inode.c | |
parent | ALSA: fm801: introduce fm801_ac97_is_ready()/fm801_ac97_is_valid() helpers (diff) | |
parent | ALSA: hda - hdmi: Set converter channel count even without sink (diff) | |
download | linux-59991da498122f779434c4e0beac8a69e0322938.tar.xz linux-59991da498122f779434c4e0beac8a69e0322938.zip |
Merge branch 'for-linus' into for-next
... for applying the further HDMI fixes.
Diffstat (limited to 'fs/kernfs/inode.c')
-rw-r--r-- | fs/kernfs/inode.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index abb0f1f53d93..985217626e66 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c @@ -48,14 +48,18 @@ void __init kernfs_inode_init(void) static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn) { + static DEFINE_MUTEX(iattr_mutex); + struct kernfs_iattrs *ret; struct iattr *iattrs; + mutex_lock(&iattr_mutex); + if (kn->iattr) - return kn->iattr; + goto out_unlock; kn->iattr = kzalloc(sizeof(struct kernfs_iattrs), GFP_KERNEL); if (!kn->iattr) - return NULL; + goto out_unlock; iattrs = &kn->iattr->ia_iattr; /* assign default attributes */ @@ -65,8 +69,10 @@ static struct kernfs_iattrs *kernfs_iattrs(struct kernfs_node *kn) iattrs->ia_atime = iattrs->ia_mtime = iattrs->ia_ctime = CURRENT_TIME; simple_xattrs_init(&kn->iattr->xattrs); - - return kn->iattr; +out_unlock: + ret = kn->iattr; + mutex_unlock(&iattr_mutex); + return ret; } static int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) |