diff options
Diffstat (limited to 'fs/hfs/super.c')
-rw-r--r-- | fs/hfs/super.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index a36bb749926d..6f833dc8e910 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -49,11 +49,23 @@ MODULE_LICENSE("GPL"); | |||
49 | */ | 49 | */ |
50 | static void hfs_write_super(struct super_block *sb) | 50 | static void hfs_write_super(struct super_block *sb) |
51 | { | 51 | { |
52 | lock_super(sb); | ||
52 | sb->s_dirt = 0; | 53 | sb->s_dirt = 0; |
53 | if (sb->s_flags & MS_RDONLY) | 54 | |
54 | return; | ||
55 | /* sync everything to the buffers */ | 55 | /* sync everything to the buffers */ |
56 | if (!(sb->s_flags & MS_RDONLY)) | ||
57 | hfs_mdb_commit(sb); | ||
58 | unlock_super(sb); | ||
59 | } | ||
60 | |||
61 | static int hfs_sync_fs(struct super_block *sb, int wait) | ||
62 | { | ||
63 | lock_super(sb); | ||
56 | hfs_mdb_commit(sb); | 64 | hfs_mdb_commit(sb); |
65 | sb->s_dirt = 0; | ||
66 | unlock_super(sb); | ||
67 | |||
68 | return 0; | ||
57 | } | 69 | } |
58 | 70 | ||
59 | /* | 71 | /* |
@@ -65,9 +77,15 @@ static void hfs_write_super(struct super_block *sb) | |||
65 | */ | 77 | */ |
66 | static void hfs_put_super(struct super_block *sb) | 78 | static void hfs_put_super(struct super_block *sb) |
67 | { | 79 | { |
80 | lock_kernel(); | ||
81 | |||
82 | if (sb->s_dirt) | ||
83 | hfs_write_super(sb); | ||
68 | hfs_mdb_close(sb); | 84 | hfs_mdb_close(sb); |
69 | /* release the MDB's resources */ | 85 | /* release the MDB's resources */ |
70 | hfs_mdb_put(sb); | 86 | hfs_mdb_put(sb); |
87 | |||
88 | unlock_kernel(); | ||
71 | } | 89 | } |
72 | 90 | ||
73 | /* | 91 | /* |
@@ -164,6 +182,7 @@ static const struct super_operations hfs_super_operations = { | |||
164 | .clear_inode = hfs_clear_inode, | 182 | .clear_inode = hfs_clear_inode, |
165 | .put_super = hfs_put_super, | 183 | .put_super = hfs_put_super, |
166 | .write_super = hfs_write_super, | 184 | .write_super = hfs_write_super, |
185 | .sync_fs = hfs_sync_fs, | ||
167 | .statfs = hfs_statfs, | 186 | .statfs = hfs_statfs, |
168 | .remount_fs = hfs_remount, | 187 | .remount_fs = hfs_remount, |
169 | .show_options = hfs_show_options, | 188 | .show_options = hfs_show_options, |