[PATCH 3/4] Do not allow umounting of frozen filesystems

From: Fernando Luis Vázquez Cao
Date: Thu Aug 27 2009 - 10:06:18 EST


Instead of making umount users wait until the filesystem is
unfreezed return EBUSY, which is very convenient in HA
configurations.

This could have been implemented at a lower level but it would
require considerable plumbing in functions such as release_mounts
which do not return errors.

Signed-off-by: Fernando Luis Vazquez Cao <fernando@xxxxxxxxxxxxx>
---

diff -urNp linux-2.6.31-rc7-orig/fs/namespace.c linux-2.6.31-rc7/fs/namespace.c
--- linux-2.6.31-rc7-orig/fs/namespace.c 2009-08-27 19:34:35.000000000 +0900
+++ linux-2.6.31-rc7/fs/namespace.c 2009-08-27 22:45:14.000000000 +0900
@@ -1086,6 +1086,14 @@ static int do_umount(struct vfsmount *mn
return retval;
}

+ if (sb->s_bdev != NULL) {
+ mutex_lock(&sb->s_bdev->bd_fsfreeze_mutex);
+ if (sb->s_frozen != SB_UNFROZEN) {
+ mutex_unlock(&sb->s_bdev->bd_fsfreeze_mutex);
+ return -EBUSY;
+ }
+ }
+
down_write(&namespace_sem);
spin_lock(&vfsmount_lock);
event++;
@@ -1104,6 +1112,10 @@ static int do_umount(struct vfsmount *mn
security_sb_umount_busy(mnt);
up_write(&namespace_sem);
release_mounts(&umount_list);
+
+ if (sb->s_bdev != NULL)
+ mutex_unlock(&sb->s_bdev->bd_fsfreeze_mutex);
+
return retval;
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/