aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfs/mdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfs/mdb.c')
-rw-r--r--fs/hfs/mdb.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/hfs/mdb.c b/fs/hfs/mdb.c
index 1563d5ce5764..5fd51a5833ff 100644
--- a/fs/hfs/mdb.c
+++ b/fs/hfs/mdb.c
@@ -260,6 +260,10 @@ void hfs_mdb_commit(struct super_block *sb)
260{ 260{
261 struct hfs_mdb *mdb = HFS_SB(sb)->mdb; 261 struct hfs_mdb *mdb = HFS_SB(sb)->mdb;
262 262
263 if (sb->s_flags & MS_RDONLY)
264 return;
265
266 lock_buffer(HFS_SB(sb)->mdb_bh);
263 if (test_and_clear_bit(HFS_FLG_MDB_DIRTY, &HFS_SB(sb)->flags)) { 267 if (test_and_clear_bit(HFS_FLG_MDB_DIRTY, &HFS_SB(sb)->flags)) {
264 /* These parameters may have been modified, so write them back */ 268 /* These parameters may have been modified, so write them back */
265 mdb->drLsMod = hfs_mtime(); 269 mdb->drLsMod = hfs_mtime();
@@ -283,9 +287,13 @@ void hfs_mdb_commit(struct super_block *sb)
283 &mdb->drXTFlSize, NULL); 287 &mdb->drXTFlSize, NULL);
284 hfs_inode_write_fork(HFS_SB(sb)->cat_tree->inode, mdb->drCTExtRec, 288 hfs_inode_write_fork(HFS_SB(sb)->cat_tree->inode, mdb->drCTExtRec,
285 &mdb->drCTFlSize, NULL); 289 &mdb->drCTFlSize, NULL);
290
291 lock_buffer(HFS_SB(sb)->alt_mdb_bh);
286 memcpy(HFS_SB(sb)->alt_mdb, HFS_SB(sb)->mdb, HFS_SECTOR_SIZE); 292 memcpy(HFS_SB(sb)->alt_mdb, HFS_SB(sb)->mdb, HFS_SECTOR_SIZE);
287 HFS_SB(sb)->alt_mdb->drAtrb |= cpu_to_be16(HFS_SB_ATTRIB_UNMNT); 293 HFS_SB(sb)->alt_mdb->drAtrb |= cpu_to_be16(HFS_SB_ATTRIB_UNMNT);
288 HFS_SB(sb)->alt_mdb->drAtrb &= cpu_to_be16(~HFS_SB_ATTRIB_INCNSTNT); 294 HFS_SB(sb)->alt_mdb->drAtrb &= cpu_to_be16(~HFS_SB_ATTRIB_INCNSTNT);
295 unlock_buffer(HFS_SB(sb)->alt_mdb_bh);
296
289 mark_buffer_dirty(HFS_SB(sb)->alt_mdb_bh); 297 mark_buffer_dirty(HFS_SB(sb)->alt_mdb_bh);
290 sync_dirty_buffer(HFS_SB(sb)->alt_mdb_bh); 298 sync_dirty_buffer(HFS_SB(sb)->alt_mdb_bh);
291 } 299 }
@@ -308,7 +316,11 @@ void hfs_mdb_commit(struct super_block *sb)
308 break; 316 break;
309 } 317 }
310 len = min((int)sb->s_blocksize - off, size); 318 len = min((int)sb->s_blocksize - off, size);
319
320 lock_buffer(bh);
311 memcpy(bh->b_data + off, ptr, len); 321 memcpy(bh->b_data + off, ptr, len);
322 unlock_buffer(bh);
323
312 mark_buffer_dirty(bh); 324 mark_buffer_dirty(bh);
313 brelse(bh); 325 brelse(bh);
314 block++; 326 block++;
@@ -317,6 +329,7 @@ void hfs_mdb_commit(struct super_block *sb)
317 size -= len; 329 size -= len;
318 } 330 }
319 } 331 }
332 unlock_buffer(HFS_SB(sb)->mdb_bh);
320} 333}
321 334
322void hfs_mdb_close(struct super_block *sb) 335void hfs_mdb_close(struct super_block *sb)