summaryrefslogtreecommitdiff
path: root/fs/hfsplus/super.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@tuxera.com>2010-10-01 05:45:08 +0200
committerChristoph Hellwig <hch@lst.de>2010-10-01 05:45:08 +0200
commit7ac9fb9c2a50963b699b3548e6f00698c1554dc6 (patch)
tree3660bfb2985c65838b5969694e54043ae6639b3a /fs/hfsplus/super.c
parent58a818f532e83f337689358c102ba2048d1b37f5 (diff)
hfsplus: add per-superblock lock for volume header updates
Lock updates to the mutal fields in the volume header, and document the locing in the hfsplus_sb_info structure. Signed-off-by: Christoph Hellwig <hch@tuxera.com>
Diffstat (limited to 'fs/hfsplus/super.c')
-rw-r--r--fs/hfsplus/super.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 923f385b32ca..b766c170e4d8 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -160,6 +160,7 @@ int hfsplus_sync_fs(struct super_block *sb, int wait)
dprint(DBG_SUPER, "hfsplus_write_super\n");
+ mutex_lock(&sbi->vh_mutex);
mutex_lock(&sbi->alloc_mutex);
sb->s_dirt = 0;
@@ -194,6 +195,7 @@ int hfsplus_sync_fs(struct super_block *sb, int wait)
sbi->flags &= ~HFSPLUS_SB_WRITEBACKUP;
}
mutex_unlock(&sbi->alloc_mutex);
+ mutex_unlock(&sbi->vh_mutex);
return 0;
}
@@ -319,6 +321,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
sb->s_fs_info = sbi;
mutex_init(&sbi->alloc_mutex);
+ mutex_init(&sbi->vh_mutex);
hfsplus_fill_defaults(sbi);
if (!hfsplus_parse_options(data, sbi)) {
printk(KERN_ERR "hfs: unable to parse mount options\n");
@@ -453,9 +456,13 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
if (!sbi->hidden_dir) {
printk(KERN_DEBUG "hfs: create hidden dir...\n");
+
+ mutex_lock(&sbi->vh_mutex);
sbi->hidden_dir = hfsplus_new_inode(sb, S_IFDIR);
hfsplus_create_cat(sbi->hidden_dir->i_ino, sb->s_root->d_inode,
&str, sbi->hidden_dir);
+ mutex_unlock(&sbi->vh_mutex);
+
mark_inode_dirty(sbi->hidden_dir);
}
out: