Bug 84201

Summary: mount doesn't clear usrjquota / grpjqouta options
Product: File System Reporter: Robin (robinedgar)
Component: ext4Assignee: fs_ext4 (fs_ext4)
Status: RESOLVED CODE_FIX    
Severity: low CC: jack, tytso
Priority: P1    
Hardware: i386   
OS: Linux   
Kernel Version: 3.2.0-4-amd64 Subsystem:
Regression: No Bisected commit-id:
Attachments: [PATCH] ext4: Don't check quota format when there are no quota files

Description Robin 2014-09-09 14:28:52 UTC
Hi, After changing the group quota file name in after the first run of
remount -o remount /
gives a
mount: / not mounted or bad option
error.
If you remove the usrjquota and groupjquota options from the fstab and remount, mount runs. dmesg gives
EXT4-fs (vda1): re-mounted. Opts: (null)
but when you
mount
it still shows the old usrjquota and groupjquota values in the output.

/dev/disk/by-uuid/2ceaad1e-7ca8-42f9-b657-ce689beba638 on / type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered,jqfmt=vfsv1,usrjquota=aquota.user,grpjquota=aquota.user)

The same if you specify the noquota option in fstab or options. dmesg then gives
EXT4-fs (vda1): re-mounted. Opts: noquota
If you remove all from the fstab and try
mount -o remount,usrjquota=aquota.user,grpjquota=aquota.otherfilename,jqfmt=vfsv1 /
You get the bad option error again. In dmesg you get
EXT4-fs (vda1): group quota file already specified
I have deleted the old files and made sure that quotas are off using
quotaoff -afugpv

How do you clear the options completely?
Comment 1 Theodore Tso 2014-09-10 13:48:21 UTC
"mount -o remount,userjquota=,grpjquota= /"

should do the trick.
Comment 2 Robin 2014-09-11 06:00:01 UTC
Unfortunately

# mount -o remount,userjquota=,grpjquota= /
mount: / not mounted or bad option

# mount
/dev/disk/by-uuid/2ceaad1e-7ca8-42f9-b657-ce689beba638 on / type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered,jqfmt=vfsv1,usrjquota=aquota.user,grpjquota=aquota.user)
Comment 3 Jan Kara 2014-09-11 12:56:16 UTC
Ted had a typo there. It should have been:
mount -o remount,usrjquota=,grpjquota= /

I.e. 'usrjquota' not 'userjquota'. And what Ted suggested works for me...
Comment 4 Robin 2014-09-11 13:10:39 UTC
Thanks, that's worked partially.

a space between the following the = and , worked to clear the usrjquota:
# mount -o remount,usrjquota= ,grpjquota= /

but doesn't clear the grpjquota.
I tried:

# mount  -o remount,grpjquota= ,usrjquota= /
mount: you must specify the filesystem type

# mount -t ext4 -o remount,grpjquota= ,usrjquota= /
# mount -t ext4 -o remount,grpjquota=,usrjquota= /dev/disk/by-uuid/2ceaad1e-7ca8-42f9-b657-ce689beba638 /
# mount  -o remount,grpjquota= /
# mount  -o remount,grpjquota=" " /
# mount  -o remount,grpjquota=" ",usrjquota=" " /
# mount  -o remount,grpjquota="",usrjquota="" /
all lead to
mount: / not mounted or bad option

# mount -o remount,usrjquota= ,grpjquota=" " /
(no error, but doesn't clear)

so it's cleared the usrjquota, but not the grpjquota

/dev/disk/by-uuid/2ceaad1e-7ca8-42f9-b657-ce689beba638 on / type ext4 (rw,relatime,errors=remount-ro,user_xattr,barrier=1,data=ordered,jqfmt=vfsv1,grpjquota=aquota.user)
Comment 5 Jan Kara 2014-09-12 16:45:54 UTC
With the space in the arguments, you make shell pass the ",grpjquota=" as another argument and thus it ends up being used a s device name for the remount. The device is ignored by remount so nothing happens.

I would be interested in what kernel message does kernel spit out when you try:
mount -o remount,grpjquota= /

Because that's what's working for me. When kernel version do you use?
Comment 6 Jan Kara 2014-09-12 16:47:32 UTC
Blah. I meant: *What* kernel version do you use...
Comment 7 Robin 2014-09-16 12:18:17 UTC
Hi Jan, thanks. I'm using kernel:

3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64

dmesg gave:

EXT4-fs (vda1): journaled quota format specified with no journaling enabled

which is strange because:

# tune2fs -l /dev/disk/by-uuid/2ceaad1e-7ca8-42f9-b657-ce689beba638 | grep -i journal
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Journal inode:            8
Journal backup:           inode blocks

(and just to make sure)

# tune2fs -l /dev/vda1 | grep -i journal                        
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Journal inode:            8
Journal backup:           inode blocks
Comment 8 Jan Kara 2014-09-16 20:23:55 UTC
Ah, OK. I've checked the code again and now I see the problem. The message is about jqfmt being specified but no quota file name. But there's no way to zero out jqfmt on remount. So the only way to get rid of quota options is to unmount the filesystem (= reboot for you since this is your root filesystem).

Attached patch should fix your problem.
Comment 9 Jan Kara 2014-09-16 20:25:12 UTC
Created attachment 150581 [details]
[PATCH] ext4: Don't check quota format when there are no quota files
Comment 10 Jan Kara 2014-09-18 10:04:05 UTC
Ted has merged the patch so I'm closing the bug.