2008-06-26 11:19:05

by Jan Kara

[permalink] [raw]
Subject: [PATCH] ext3: Add missing unlock to error path in ext3_quota_write()

When write in ext3_quota_write() fails, we have to properly release
i_mutex. One error path has been missing the unlock...

Signed-off-by: Jan Kara <[email protected]>
---
fs/ext3/super.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index fe3119a..2845425 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2875,8 +2875,10 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type,
blk++;
}
out:
- if (len == towrite)
+ if (len == towrite) {
+ mutex_unlock(&inode->i_mutex);
return err;
+ }
if (inode->i_size < off+len-towrite) {
i_size_write(inode, off+len-towrite);
EXT3_I(inode)->i_disksize = inode->i_size;
--
1.5.2.4



2008-06-26 11:19:05

by Jan Kara

[permalink] [raw]
Subject: [PATCH] ext4: Add missing unlock to an error path in ext4_quota_write()

When write in ext4_quota_write() fails, we have to properly release
i_mutex. One error path has been missing the unlock...

Signed-off-by: Jan Kara <[email protected]>
---
fs/ext4/super.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index cb96f12..02bf243 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3337,8 +3337,10 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
blk++;
}
out:
- if (len == towrite)
+ if (len == towrite) {
+ mutex_unlock(&inode->i_mutex);
return err;
+ }
if (inode->i_size < off+len-towrite) {
i_size_write(inode, off+len-towrite);
EXT4_I(inode)->i_disksize = inode->i_size;
--
1.5.2.4


2008-06-27 23:54:37

by Mingming Cao

[permalink] [raw]
Subject: Re: [PATCH] ext4: Add missing unlock to an error path in ext4_quota_write()


On Thu, 2008-06-26 at 13:19 +0200, Jan Kara wrote:
> When write in ext4_quota_write() fails, we have to properly release
> i_mutex. One error path has been missing the unlock...
>

Added to ext4 patch queue,

thanks
Mingming
> Signed-off-by: Jan Kara <[email protected]>
> ---
> fs/ext4/super.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index cb96f12..02bf243 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3337,8 +3337,10 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
> blk++;
> }
> out:
> - if (len == towrite)
> + if (len == towrite) {
> + mutex_unlock(&inode->i_mutex);
> return err;
> + }
> if (inode->i_size < off+len-towrite) {
> i_size_write(inode, off+len-towrite);
> EXT4_I(inode)->i_disksize = inode->i_size;