Re: [PATCH v3 RESEND] f2fs: support journalled quota
Hi Jaegeuk, Thank you for providing the info. BTW, I just notice that my personal email address has been junked from f2fs mailing list, anyway, I will resubscribe the list. But before that, I'd like to ask, could you please Cc to c...@kernel.org when you send the patch to mailing list? :) Thanks,
Re: [PATCH v3 RESEND] f2fs: support journalled quota
On 08/11, Chao Yu wrote: > Hi Jaegeuk, > > On 2017/8/11 9:51, Jaegeuk Kim wrote: > > Hi Chao, > > > > Do we have to add .get_inode_usage ? > > > > I hit a kernel panic on __dquot_transfer() -> check_idq() saying > > "BUG: unable to handle kernel paging request at 0xfff..." > > Could you provider whole kernel dump info, mount option, test method? mkfs -O extra_attr -O project_quota -O inode_checksum loop of: # mount -o usrquota,grpquota,prjquota,discard # quotacheck -u -g /dir # quotaon -u -g /dir # echo 511 > /sys/fs/f2fs/dev/inject_type # echo (random 3000~5000) > /sys/fs/f2fs/dev/inject_rate # ltp/fsstress -x "echo 3 > /proc/sys/vm/drop_caches" -X 10 -r -f fsync=0 -f sync=0 -f write=1 -f dwrite=1 -f truncate=6 -f allocsp=0 -f bulkstat=0 -f bulkstat1=0 -f freesp=0 -f zero=1 -f collapse=1 -f insert=1 -f resvsp=0 -f unresvsp=0 -S t -p 20 -n 20 -d /dir/test & # sleep 10 # src/gowodn # umount [ 886.628389] BUG: unable to handle kernel paging request at d9c01f9d [ 886.655169] IP: check_idq+0x5/0x180 [ 886.665391] PGD 21e0c067 [ 886.665393] P4D 21e0c067 [ 886.671572] PUD 21e0e067 [ 886.675062] PMD 0 [ 886.685069] [ 886.753302] Oops: [#1] SMP [ 886.851212] Modules linked in: quota_v2 quota_tree f2fs(O) ppdev snd_intel8x0 sb_edac snd_ac97_codec ac97_bus snd_pcm joydev input_leds snd_timer snd parport_pc parport i2c_piix4 mac_hid serio_raw soundcore ib_iser rdma_cm iw_cm ib_cm ib_core configfs iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi autofs4 btrfs raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear hid_generic crct10dif_pclmul crc32_pclmul usbhid ghash_clmulni_intel pcbc hid aesni_intel aes_x86_64 crypto_simd glue_helper cryptd ahci libahci psmouse pata_acpi e1000 video [ 888.738972] CPU: 3 PID: 2678 Comm: fsstress Tainted: G O 4.13.0-rc2+ #9 [ 888.776776] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 [ 888.785881] task: 9597390d5a00 task.stack: bb6401208000 [ 888.793283] RIP: 0010:check_idq+0x5/0x180 [ 888.801156] RSP: 0018:bb640120bc20 EFLAGS: 00010246 [ 888.878306] RAX: 9596fd8a3d00 RBX: bb640120bd88 RCX: [ 888.990955] RDX: bb640120bc68 RSI: 0001 RDI: d9c01f11 [ 889.011385] RBP: bb640120bd78 R08: 0001 R09: [ 889.018383] R10: R11: R12: [ 889.060570] R13: R14: 9596fd89b4f0 R15: bb640120bc68 [ 889.541140] FS: 7fe4706c4700() GS:95973fd8() knlGS: [ 890.021093] CS: 0010 DS: ES: CR0: 80050033 [ 890.411148] CR2: d9c01f9d CR3: 5d1c8000 CR4: 000406e0 [ 890.841158] DR0: DR1: DR2: [ 891.305554] DR3: DR6: fffe0ff0 DR7: 0400 [ 891.638985] Call Trace: [ 891.69] ? __dquot_transfer+0x1d6/0x490 [ 891.945967] ? __mutex_unlock_slowpath.isra.11+0xcb/0x130 [ 892.091555] ? mutex_unlock+0x26/0x30 [ 892.112444] ? dquot_acquire+0x74/0x120 [ 892.351151] ? dqget+0x345/0x4a0 [ 892.591885] dquot_transfer+0xce/0x130 [ 892.751686] f2fs_setattr+0x8b/0x3c0 [f2fs] [ 892.773699] notify_change+0x2db/0x410 [ 892.791540] chown_common+0x18b/0x1e0 [ 892.800299] SyS_lchown+0x98/0xe0 [ 892.933985] entry_SYSCALL_64_fastpath+0x1e/0xa9 [ 893.059419] RIP: 0033:0x7fe46fdb9327 > > Thanks, > > > > > Thanks, > > > > On 08/08, Chao Yu wrote: > >> This patch supports to enable f2fs to accept quota information through > >> mount option: > >> - {usr,grp,prj}jquota= > >> - jqfmt= > >> > >> Then, in ->mount flow, we can recover quota file during log replaying, > >> by this, journelled quota can be supported. > >> > >> Signed-off-by: Chao Yu > >> Signed-off-by: Jaegeuk Kim > >> --- > >> Documentation/filesystems/f2fs.txt | 9 + > >> fs/f2fs/checkpoint.c | 26 ++- > >> fs/f2fs/f2fs.h | 9 + > >> fs/f2fs/recovery.c | 72 +++- > >> fs/f2fs/super.c| 327 > >> ++--- > >> 5 files changed, 413 insertions(+), 30 deletions(-) > >> > >> diff --git a/Documentation/filesystems/f2fs.txt > >> b/Documentation/filesystems/f2fs.txt > >> index b8f495a8b67d..deafeff7795b 100644 > >> --- a/Documentation/filesystems/f2fs.txt > >> +++ b/Documentation/filesystems/f2fs.txt > >> @@ -165,6 +165,15 @@ io_bits=%u Set the bit size of write IO > >> requests. It should be set > >> usrquota Enable plain user disk quota accounting. > >> grpquota Enable plain group disk quota accounting. > >> prjquota Enable plain project quota accounting. > >> +usrjquota= Appoint specified file and type during mount, so > >> that quota > >> +grpjquota= information can b
Re: [PATCH v3 RESEND] f2fs: support journalled quota
Hi Jaegeuk, On 2017/8/11 9:51, Jaegeuk Kim wrote: > Hi Chao, > > Do we have to add .get_inode_usage ? > > I hit a kernel panic on __dquot_transfer() -> check_idq() saying > "BUG: unable to handle kernel paging request at 0xfff..." Could you provider whole kernel dump info, mount option, test method? Thanks, > > Thanks, > > On 08/08, Chao Yu wrote: >> This patch supports to enable f2fs to accept quota information through >> mount option: >> - {usr,grp,prj}jquota= >> - jqfmt= >> >> Then, in ->mount flow, we can recover quota file during log replaying, >> by this, journelled quota can be supported. >> >> Signed-off-by: Chao Yu >> Signed-off-by: Jaegeuk Kim >> --- >> Documentation/filesystems/f2fs.txt | 9 + >> fs/f2fs/checkpoint.c | 26 ++- >> fs/f2fs/f2fs.h | 9 + >> fs/f2fs/recovery.c | 72 +++- >> fs/f2fs/super.c| 327 >> ++--- >> 5 files changed, 413 insertions(+), 30 deletions(-) >> >> diff --git a/Documentation/filesystems/f2fs.txt >> b/Documentation/filesystems/f2fs.txt >> index b8f495a8b67d..deafeff7795b 100644 >> --- a/Documentation/filesystems/f2fs.txt >> +++ b/Documentation/filesystems/f2fs.txt >> @@ -165,6 +165,15 @@ io_bits=%u Set the bit size of write IO >> requests. It should be set >> usrquota Enable plain user disk quota accounting. >> grpquota Enable plain group disk quota accounting. >> prjquota Enable plain project quota accounting. >> +usrjquota= Appoint specified file and type during mount, so >> that quota >> +grpjquota= information can be properly updated during recovery >> flow, >> +prjjquota= : must be in root directory; >> +jqfmt= : [vfsold,vfsv0,vfsv1]. >> +offusrjquota Turn off user journelled quota. >> +offgrpjquota Turn off group journelled quota. >> +offprjjquota Turn off project journelled quota. >> +quota Enable plain user disk quota accounting. >> +noquotaDisable all plain disk quota option. >> >> >> >> DEBUGFS ENTRIES >> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c >> index da5b49183e09..04fe1df052b2 100644 >> --- a/fs/f2fs/checkpoint.c >> +++ b/fs/f2fs/checkpoint.c >> @@ -588,11 +588,24 @@ static int recover_orphan_inode(struct f2fs_sb_info >> *sbi, nid_t ino) >> int recover_orphan_inodes(struct f2fs_sb_info *sbi) >> { >> block_t start_blk, orphan_blocks, i, j; >> -int err; >> +unsigned int s_flags = sbi->sb->s_flags; >> +int err = 0; >> >> if (!is_set_ckpt_flags(sbi, CP_ORPHAN_PRESENT_FLAG)) >> return 0; >> >> +if (s_flags & MS_RDONLY) { >> +f2fs_msg(sbi->sb, KERN_INFO, "orphan cleanup on readonly fs"); >> +sbi->sb->s_flags &= ~MS_RDONLY; >> +} >> + >> +#ifdef CONFIG_QUOTA >> +/* Needed for iput() to work correctly and not trash data */ >> +sbi->sb->s_flags |= MS_ACTIVE; >> +/* Turn on quotas so that they are updated correctly */ >> +f2fs_enable_quota_files(sbi); >> +#endif >> + >> start_blk = __start_cp_addr(sbi) + 1 + __cp_payload(sbi); >> orphan_blocks = __start_sum_addr(sbi) - 1 - __cp_payload(sbi); >> >> @@ -608,14 +621,21 @@ int recover_orphan_inodes(struct f2fs_sb_info *sbi) >> err = recover_orphan_inode(sbi, ino); >> if (err) { >> f2fs_put_page(page, 1); >> -return err; >> +goto out; >> } >> } >> f2fs_put_page(page, 1); >> } >> /* clear Orphan Flag */ >> clear_ckpt_flags(sbi, CP_ORPHAN_PRESENT_FLAG); >> -return 0; >> +out: >> +#ifdef CONFIG_QUOTA >> +/* Turn quotas off */ >> +f2fs_quota_off_umount(sbi->sb); >> +#endif >> +sbi->sb->s_flags = s_flags; /* Restore MS_RDONLY status */ >> + >> +return err; >> } >> >> static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk) >> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h >> index 1bcaa93bfed7..cea329f75068 100644 >> --- a/fs/f2fs/f2fs.h >> +++ b/fs/f2fs/f2fs.h >> @@ -92,6 +92,7 @@ extern char *fault_name[FAULT_MAX]; >> #define F2FS_MOUNT_USRQUOTA 0x0008 >> #define F2FS_MOUNT_GRPQUOTA 0x0010 >> #define F2FS_MOUNT_PRJQUOTA 0x0020 >> +#define F2FS_MOUNT_QUOTA0x0040 >> >> #define clear_opt(sbi, option) ((sbi)->mount_opt.opt &= >> ~F2FS_MOUNT_##option) >> #define set_opt(sbi, option)((sbi)->mount_opt.opt |= >> F2FS_MOUNT_##option) >> @@ -1121,6 +1122,12 @@ struct f2fs_sb_info { >> #ifdef CONFIG_F2FS_FAULT_INJECTION >> struct f2fs_fault_info fault_info; >> #endif >> + >> +#ifdef CONFIG_QUOTA >> +/* Names of quota files with journalled quota */ >> +ch
Re: [PATCH v3 RESEND] f2fs: support journalled quota
Hi Chao, Do we have to add .get_inode_usage ? I hit a kernel panic on __dquot_transfer() -> check_idq() saying "BUG: unable to handle kernel paging request at 0xfff..." Thanks, On 08/08, Chao Yu wrote: > This patch supports to enable f2fs to accept quota information through > mount option: > - {usr,grp,prj}jquota= > - jqfmt= > > Then, in ->mount flow, we can recover quota file during log replaying, > by this, journelled quota can be supported. > > Signed-off-by: Chao Yu > Signed-off-by: Jaegeuk Kim > --- > Documentation/filesystems/f2fs.txt | 9 + > fs/f2fs/checkpoint.c | 26 ++- > fs/f2fs/f2fs.h | 9 + > fs/f2fs/recovery.c | 72 +++- > fs/f2fs/super.c| 327 > ++--- > 5 files changed, 413 insertions(+), 30 deletions(-) > > diff --git a/Documentation/filesystems/f2fs.txt > b/Documentation/filesystems/f2fs.txt > index b8f495a8b67d..deafeff7795b 100644 > --- a/Documentation/filesystems/f2fs.txt > +++ b/Documentation/filesystems/f2fs.txt > @@ -165,6 +165,15 @@ io_bits=%u Set the bit size of write IO > requests. It should be set > usrquota Enable plain user disk quota accounting. > grpquota Enable plain group disk quota accounting. > prjquota Enable plain project quota accounting. > +usrjquota= Appoint specified file and type during mount, so that > quota > +grpjquota= information can be properly updated during recovery > flow, > +prjjquota= : must be in root directory; > +jqfmt= : [vfsold,vfsv0,vfsv1]. > +offusrjquota Turn off user journelled quota. > +offgrpjquota Turn off group journelled quota. > +offprjjquota Turn off project journelled quota. > +quota Enable plain user disk quota accounting. > +noquotaDisable all plain disk quota option. > > > > DEBUGFS ENTRIES > diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c > index da5b49183e09..04fe1df052b2 100644 > --- a/fs/f2fs/checkpoint.c > +++ b/fs/f2fs/checkpoint.c > @@ -588,11 +588,24 @@ static int recover_orphan_inode(struct f2fs_sb_info > *sbi, nid_t ino) > int recover_orphan_inodes(struct f2fs_sb_info *sbi) > { > block_t start_blk, orphan_blocks, i, j; > - int err; > + unsigned int s_flags = sbi->sb->s_flags; > + int err = 0; > > if (!is_set_ckpt_flags(sbi, CP_ORPHAN_PRESENT_FLAG)) > return 0; > > + if (s_flags & MS_RDONLY) { > + f2fs_msg(sbi->sb, KERN_INFO, "orphan cleanup on readonly fs"); > + sbi->sb->s_flags &= ~MS_RDONLY; > + } > + > +#ifdef CONFIG_QUOTA > + /* Needed for iput() to work correctly and not trash data */ > + sbi->sb->s_flags |= MS_ACTIVE; > + /* Turn on quotas so that they are updated correctly */ > + f2fs_enable_quota_files(sbi); > +#endif > + > start_blk = __start_cp_addr(sbi) + 1 + __cp_payload(sbi); > orphan_blocks = __start_sum_addr(sbi) - 1 - __cp_payload(sbi); > > @@ -608,14 +621,21 @@ int recover_orphan_inodes(struct f2fs_sb_info *sbi) > err = recover_orphan_inode(sbi, ino); > if (err) { > f2fs_put_page(page, 1); > - return err; > + goto out; > } > } > f2fs_put_page(page, 1); > } > /* clear Orphan Flag */ > clear_ckpt_flags(sbi, CP_ORPHAN_PRESENT_FLAG); > - return 0; > +out: > +#ifdef CONFIG_QUOTA > + /* Turn quotas off */ > + f2fs_quota_off_umount(sbi->sb); > +#endif > + sbi->sb->s_flags = s_flags; /* Restore MS_RDONLY status */ > + > + return err; > } > > static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk) > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index 1bcaa93bfed7..cea329f75068 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -92,6 +92,7 @@ extern char *fault_name[FAULT_MAX]; > #define F2FS_MOUNT_USRQUOTA 0x0008 > #define F2FS_MOUNT_GRPQUOTA 0x0010 > #define F2FS_MOUNT_PRJQUOTA 0x0020 > +#define F2FS_MOUNT_QUOTA 0x0040 > > #define clear_opt(sbi, option) ((sbi)->mount_opt.opt &= > ~F2FS_MOUNT_##option) > #define set_opt(sbi, option) ((sbi)->mount_opt.opt |= F2FS_MOUNT_##option) > @@ -1121,6 +1122,12 @@ struct f2fs_sb_info { > #ifdef CONFIG_F2FS_FAULT_INJECTION > struct f2fs_fault_info fault_info; > #endif > + > +#ifdef CONFIG_QUOTA > + /* Names of quota files with journalled quota */ > + char *s_qf_names[MAXQUOTAS]; > + int s_jquota_fmt; /* Format of quota to use */ > +#endif > }; > > #ifdef CONFIG_F2FS_FAULT_INJECTION > @@ -2433,6 +2440,8 @@ static inline int f2fs_add_link(struct dentry *dentry,