>From 6cf5cfc5db6c792c76c68bdbc765b733b5ad5488 Mon Sep 17 00:00:00 2001 From: Dmitry Monakhov Date: Mon, 1 Oct 2012 07:09:49 +0400 Subject: [PATCH] ext4: ext4_ext_punch_hole put i_mutex on error Fix mistypo introduced in 'ext4: punch_hole should wait for DIO writers' patch. Signed-off-by: Dmitry Monakhov --- fs/ext4/extents.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index f02ffce..0a720d4 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4811,10 +4811,14 @@ int ext4_ext_punch_hole(struct file *file, loff_t offset, loff_t length) mutex_lock(&inode->i_mutex); /* Need recheck file flags under mutex */ /* It's not possible punch hole on append only file */ - if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) - return -EPERM; - if (IS_SWAPFILE(inode)) - return -ETXTBSY; + if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) { + err = -EPERM; + goto out_mutex; + } + if (IS_SWAPFILE(inode)) { + err = -ETXTBSY; + goto out_mutex; + } /* No need to punch hole beyond i_size */ if (offset >= inode->i_size) -- 1.7.7.6