lkml.org 
[lkml]   [2009]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 3/4] Do not allow umounting of frozen filesystems
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@oss.ntt.co.jp>
---
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;
}


\
 
 \ /
  Last update: 2009-08-27 16:09    [from the cache]
©2003-2011 Jasper Spaans