linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Enabling quota may not correctly rescan on 4.17
@ 2018-06-26  6:00 Misono Tomohiro
  2018-06-26  6:54 ` Nikolay Borisov
                   ` (3 more replies)
  0 siblings, 4 replies; 23+ messages in thread
From: Misono Tomohiro @ 2018-06-26  6:00 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

Hello Nikolay,

I noticed that commit 5d23515be669 ("btrfs: Move qgroup rescan
on quota enable to btrfs_quota_enable") in 4.17 sometimes causes
to fail correctly rescanning quota when quota is enabled.

Simple reproducer:

$ mkfs.btrfs -f $DEV
$ mount $DEV /mnt
$ dd if=/dev/urandom of=/mnt/file bs=1000 count=1000
$ btrfs quota enbale /mnt
$ umount /mnt
$ btrfs check $DEV
...
checking quota groups
Counts for qgroup id: 0/5 are different
our:            referenced 1019904 referenced compressed 1019904
disk:           referenced 16384 referenced compressed 16384
diff:           referenced 1003520 referenced compressed 1003520
our:            exclusive 1019904 exclusive compressed 1019904
disk:           exclusive 16384 exclusive compressed 16384
diff:           exclusive 1003520 exclusive compressed 1003520
found 1413120 bytes used, error(s) found
...

This can be also observed in btrfs/114. \v(Note that progs < 4.17
returns error code 0 even if quota is not consistency and therefore
test will incorrectly pass.)

My observation is that this commit changed to call initial quota rescan
when quota is enabeld instead of first comit transaction after enabling
quota, and therefore if there is something not commited at that time,
their usage will not be accounted.

Actually this can be simply fixed by calling "btrfs rescan" again or
calling "btrfs fi sync" before "btrfs quota enable".

I think the commit itself makes the code much easier to read, so it may
be better to fix the problem in progs (i.e. calling sync before quota enable).

Do you have any thoughts?

Thanks,
Tomohiro Misono



^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2018-07-02  8:17 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-26  6:00 Enabling quota may not correctly rescan on 4.17 Misono Tomohiro
2018-06-26  6:54 ` Nikolay Borisov
2018-06-26  7:09 ` [PATCH] btrfs: qgroups: Move transaction managed inside btrfs_quota_enable Nikolay Borisov
2018-06-26  8:46   ` Misono Tomohiro
2018-06-26  8:58     ` Nikolay Borisov
2018-06-27  8:09     ` Qu Wenruo
2018-06-27  7:40 ` Enabling quota may not correctly rescan on 4.17 Nikolay Borisov
2018-06-27  7:55   ` Misono Tomohiro
2018-06-27  8:04     ` Nikolay Borisov
2018-06-27  8:20       ` Misono Tomohiro
2018-06-27  8:22         ` Nikolay Borisov
2018-06-27  8:29           ` Misono Tomohiro
2018-06-27  8:10 ` Qu Wenruo
2018-06-27  8:25   ` Misono Tomohiro
2018-06-27  8:34     ` Qu Wenruo
2018-06-27  8:38       ` Qu Wenruo
2018-06-27  8:47         ` Nikolay Borisov
2018-06-27  8:57           ` Qu Wenruo
2018-06-27 10:12             ` Qu Wenruo
2018-06-28  7:12     ` Qu Wenruo
2018-06-28  8:10       ` Misono Tomohiro
2018-06-28  8:32         ` Nikolay Borisov
2018-07-02  8:15           ` Misono Tomohiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).