| Submitter | Yongqiang Yang |
|---|---|
| Date | July 19, 2011, 4:02 a.m. |
| Message ID | <1311048137-16400-3-git-send-email-xiaoqiangnk@gmail.com> |
| Download | mbox | patch |
| Permalink | /patch/105379/ |
| State | Accepted |
| Headers | show |
Comments
On Tue, Jul 19, 2011 at 12:02:08PM +0800, Yongqiang Yang wrote: > 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> Thanks, added to the ext4 tree. - Ted -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Patch
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 0213f63..53d9795 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -23,6 +23,16 @@ int ext4_resize_begin(struct super_block *sb) if (!capable(CAP_SYS_RESOURCE)) return -EPERM; + /* + * We are not allowed to do online-resizing on a filesystem mounted + * with error, because it can destroy the filesystem easily. + */ + if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) { + ext4_warning(sb, "There are errors in the filesystem, " + "so online resizing is not allowed\n"); + return -EPERM; + } + if (test_and_set_bit_lock(EXT4_RESIZING, &EXT4_SB(sb)->s_resize_flags)) ret = -EBUSY;
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> --- fs/ext4/resize.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) v1->v2: nothing changed.