As Andreas said, we need to use 'X' to keep compatibility with
XFS's freeze ioctl.
bd_freeze_sem protects the following two sequences.
1. freeze_bdev()
- Test of bd_freeze_count
- Increment of bd_freeze_count
- s_op->write_super_lockfs
- Set unfreeze timer
2. thaw_bdev()
- Test of bd_freeze_count
- Decrement of bd_freeze_count
- s_op->unlockfs
- Unset unfreeze timer
Because the journal sync in ext3's write_super_lockfs might
need a long time, we should use the mutex (not atomic_t).
If bd_freeze_sem protects only the modification and
testing of bd_freeze_count, freeze_bdev() and thaw_bdev() will
run simultaneously and unexpected problem will occur.
(For example, after we run the freeze ioctl with timeout period,
the filesystem is frozen, but the unfreeze timer isn't set.)
Cheers, Takashi
--