diff options
author | Yongqiang Yang <xiaoqiangnk@gmail.com> | 2011-07-26 21:39:09 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-07-26 21:39:09 -0400 |
commit | ce723c31b58f54fb865036805475ee7a8c5dc173 (patch) | |
tree | d84f2de76ce1acc4072ce512636d686046066ee6 /fs/ext4 | |
parent | 8f82f840ec6ab873f520364d443ff6fa1b3f8e22 (diff) |
ext4: prevent a fs with errors from being resized
A filesystem with errors is not allowed to being resized, otherwise,
it is easy to destroy the filesystem.
Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/resize.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 0213f631271f..53d979541b31 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -23,6 +23,16 @@ int ext4_resize_begin(struct super_block *sb) | |||
23 | if (!capable(CAP_SYS_RESOURCE)) | 23 | if (!capable(CAP_SYS_RESOURCE)) |
24 | return -EPERM; | 24 | return -EPERM; |
25 | 25 | ||
26 | /* | ||
27 | * We are not allowed to do online-resizing on a filesystem mounted | ||
28 | * with error, because it can destroy the filesystem easily. | ||
29 | */ | ||
30 | if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) { | ||
31 | ext4_warning(sb, "There are errors in the filesystem, " | ||
32 | "so online resizing is not allowed\n"); | ||
33 | return -EPERM; | ||
34 | } | ||
35 | |||
26 | if (test_and_set_bit_lock(EXT4_RESIZING, &EXT4_SB(sb)->s_resize_flags)) | 36 | if (test_and_set_bit_lock(EXT4_RESIZING, &EXT4_SB(sb)->s_resize_flags)) |
27 | ret = -EBUSY; | 37 | ret = -EBUSY; |
28 | 38 | ||