On Thu 29-03-12 12:19:43, Szeredi Miklos wrote: > On Thu, Mar 29, 2012 at 1:43 AM, Jan Kara <jack@xxxxxxx> wrote: > > Most of places where we want freeze protection coincides with the places where > > we also have remount-ro protection. So make mnt_want_write() and > > mnt_drop_write() (and their _file alternative) prevent freezing as well. > > For the few cases that are really interested only in remount-ro protection > > provide new function variants. > > The underlying mechanism of mnt_want_write() and sb_start_write() is > basically the same: > > - increment per-CPU counter > - mb > - check flag > - retry loop for races Well, __mnt_want_write() has the special handling of MNT_WRITE_HOLD. Otherwise yes, the locking logic is rather similar. > It is scalable but still there is a non-zero overhead, and duplicating > it doesn't seem to make a lot of sense. Why not instead try to use a > common abstraction for both? I'm not sure here. Are you concerned about performance - i.e. you would like to merge the remount-ro counter and topmost anti-freeze counter? That cannot work because in some cases you want remount-ro protection but not freezing protection. In particular when you have file open for writing, you want to refuse remount-ro but still allow freezing. If you are concerned about code / source size, the implementations of the protection mechanisms could be possibly merged but I'm not sure it's worth the hassle since we'd save like 50 LOC. MNT_WRITE_HOLD is one difference, how each of the implementation detects whether we have succeeded in taking our lock is another difference... Honza -- Jan Kara <jack@xxxxxxx> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html