diff mbox

[v2,21/35] ubifs: disable quota in ubifs_put_super

Message ID 1438235311-23788-22-git-send-email-yangds.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yang Dongsheng July 30, 2015, 5:48 a.m. UTC
We need to disable quota in umounting ubifs. So we have to
disable quota in ubifs_put_super(). But quota disable will
write quota file, and we have to budget for it.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 fs/ubifs/super.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Richard Weinberger Aug. 8, 2015, 9:08 p.m. UTC | #1
Am 30.07.2015 um 07:48 schrieb Dongsheng Yang:
> We need to disable quota in umounting ubifs. So we have to
> disable quota in ubifs_put_super(). But quota disable will
> write quota file, and we have to budget for it.
> 
> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
> ---
>  fs/ubifs/super.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index 3609d7b..7031c16 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -2027,6 +2027,8 @@ static void ubifs_put_super(struct super_block *sb)
>  
>  	ubifs_msg(c, "un-mount UBI device %d", c->vi.ubi_num);
>  
> +	if (!c->ro_mount)
> +		dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);

I fear this will explode in your face.
dquot_disable disables all inodes needed for quota support, once enabled
you have to shut down quota support.
IOW if someone remounts UBIFS read only or UBIFS does itself due to an error
you'll leak inodes.

Thanks,
//richard

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yang Dongsheng Aug. 10, 2015, 2:03 a.m. UTC | #2
On 08/09/2015 05:08 AM, Richard Weinberger wrote:
> Am 30.07.2015 um 07:48 schrieb Dongsheng Yang:
>> We need to disable quota in umounting ubifs. So we have to
>> disable quota in ubifs_put_super(). But quota disable will
>> write quota file, and we have to budget for it.
>>
>> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
>> ---
>>   fs/ubifs/super.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
>> index 3609d7b..7031c16 100644
>> --- a/fs/ubifs/super.c
>> +++ b/fs/ubifs/super.c
>> @@ -2027,6 +2027,8 @@ static void ubifs_put_super(struct super_block *sb)
>>
>>   	ubifs_msg(c, "un-mount UBI device %d", c->vi.ubi_num);
>>
>> +	if (!c->ro_mount)
>> +		dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
>
> I fear this will explode in your face.
> dquot_disable disables all inodes needed for quota support, once enabled
> you have to shut down quota support.
> IOW if someone remounts UBIFS read only or UBIFS does itself due to an error
> you'll leak inodes.

Yes, you are right. I filter the read-only for a bug in quota which
call sync_fs directly even in ro-mode. But I have addressed it in quota,
so I will update this patch in next version.

Thanx a lot, Richard.
Yang
>
> Thanks,
> //richard
>
> .
>

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 3609d7b..7031c16 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2027,6 +2027,8 @@  static void ubifs_put_super(struct super_block *sb)
 
 	ubifs_msg(c, "un-mount UBI device %d", c->vi.ubi_num);
 
+	if (!c->ro_mount)
+		dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
 	/*
 	 * The following asserts are only valid if there has not been a failure
 	 * of the media. For example, there will be dirty inodes if we failed