hfsplus: use atomic bitops for the superblock flags
The flags in the HFS+-specific superlock do get modified during runtime,
use atomic bitops to make the modifications SMP safe.
Signed-off-by: Christoph Hellwig <hch@tuxera.com>
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index b766c17..9a88d75 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -119,7 +119,7 @@
}
if (fork->total_size != cpu_to_be64(inode->i_size)) {
- sbi->flags |= HFSPLUS_SB_WRITEBACKUP;
+ set_bit(HFSPLUS_SB_WRITEBACKUP, &sbi->flags);
inode->i_sb->s_dirt = 1;
}
hfsplus_inode_write_fork(inode, fork);
@@ -170,7 +170,7 @@
vhdr->file_count = cpu_to_be32(sbi->file_count);
mark_buffer_dirty(sbi->s_vhbh);
- if (sbi->flags & HFSPLUS_SB_WRITEBACKUP) {
+ if (test_and_clear_bit(HFSPLUS_SB_WRITEBACKUP, &sbi->flags)) {
if (sbi->sect_count) {
struct buffer_head *bh;
u32 block, offset;
@@ -192,7 +192,6 @@
printk(KERN_WARNING "hfs: backup not found!\n");
}
}
- sbi->flags &= ~HFSPLUS_SB_WRITEBACKUP;
}
mutex_unlock(&sbi->alloc_mutex);
mutex_unlock(&sbi->vh_mutex);
@@ -276,7 +275,7 @@
"running fsck.hfsplus is recommended. leaving read-only.\n");
sb->s_flags |= MS_RDONLY;
*flags |= MS_RDONLY;
- } else if (sbi.flags & HFSPLUS_SB_FORCE) {
+ } else if (test_bit(HFSPLUS_SB_FORCE, &sbi.flags)) {
/* nothing */
} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
printk(KERN_WARNING "hfs: filesystem is marked locked, leaving read-only.\n");
@@ -376,7 +375,7 @@
printk(KERN_WARNING "hfs: Filesystem was not cleanly unmounted, "
"running fsck.hfsplus is recommended. mounting read-only.\n");
sb->s_flags |= MS_RDONLY;
- } else if (sbi->flags & HFSPLUS_SB_FORCE) {
+ } else if (test_and_clear_bit(HFSPLUS_SB_FORCE, &sbi->flags)) {
/* nothing */
} else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
printk(KERN_WARNING "hfs: Filesystem is marked locked, mounting read-only.\n");
@@ -386,7 +385,6 @@
"use the force option at your own risk, mounting read-only.\n");
sb->s_flags |= MS_RDONLY;
}
- sbi->flags &= ~HFSPLUS_SB_FORCE;
/* Load metadata objects (B*Trees) */
sbi->ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID);