Re: [f2fs-dev] [PATCH v15 7/9] f2fs: Log error when lookup of encoded dentry fails

2024-04-04 Thread Gabriel Krisman Bertazi
Eugen Hristev  writes:

> On 4/3/24 07:25, Eric Biggers wrote:
>> On Tue, Apr 02, 2024 at 06:48:40PM +0300, Eugen Hristev via Linux-f2fs-devel 
>> wrote:
>>> If the volume is in strict mode, generi c_ci_compare can report a broken
>>> encoding name.  This will not trigger on a bad lookup, which is caught
>>> earlier, only if the actual disk name is bad.
>>>
>>> Suggested-by: Gabriel Krisman Bertazi 
>>> Signed-off-by: Eugen Hristev 
>>> ---
>>>  fs/f2fs/dir.c | 15 ++-
>>>  1 file changed, 10 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
>>> index 88b0045d0c4f..64286d80dd30 100644
>>> --- a/fs/f2fs/dir.c
>>> +++ b/fs/f2fs/dir.c
>>> @@ -192,11 +192,16 @@ static inline int f2fs_match_name(const struct inode 
>>> *dir,
>>> struct fscrypt_name f;
>>>  
>>>  #if IS_ENABLED(CONFIG_UNICODE)
>>> -   if (fname->cf_name.name)
>>> -   return generic_ci_match(dir, fname->usr_fname,
>>> -   &fname->cf_name,
>>> -   de_name, de_name_len);
>>> -
>>> +   if (fname->cf_name.name) {
>>> +   int ret = generic_ci_match(dir, fname->usr_fname,
>>> +  &fname->cf_name,
>>> +  de_name, de_name_len);
>>> +   if (ret == -EINVAL)
>>> +   f2fs_warn(F2FS_SB(dir->i_sb),
>>> +   "Directory contains filename that is invalid 
>>> UTF-8");
>>> +
>> 
>> Shouldn't this use f2fs_warn_ratelimited?
>
> f2fs_warn_ratelimited appears to be very new in the kernel,
>
> Krisman do you think you can rebase your for-next on top of latest such that 
> this
> function is available ? I am basing the series on your for-next
> branch.

I try to make unicode/for-next a non-rebase branch, and I don't want to
pollute the tree with an unecessary backmerge.  Instead, why not base
your work on a more recent branch, since it has no dependencies on
anything from unicode/for-next?

-- 
Gabriel Krisman Bertazi


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] 回覆: 回覆: [PATCH] f2fs: avoid the deadlock case when stopping discard thread

2024-04-04 Thread Jaegeuk Kim
On 04/03, Light Hsieh (謝明燈) wrote:
> Our log shows that thaw_super_locked() find that sb is readonly, so 
> sb_freeze_unlock() is not invoked.
> 
> static int thaw_super_locked(struct super_block *sb, enum freeze_holder who)
> {
>   ...
>   if (sb_rdonly(sb)) {
> sb->s_writers.freeze_holders &= ~who;
> sb->s_writers.frozen = SB_UNFROZEN;
> wake_up_var(&sb->s_writers.frozen);
> goto out;
>   }
>                ...
>   sb_freeze_unlock(sb, SB_FREEZE_FS);
> out:
>   deactivate_locked_super(sb);
>   return 0;
> }

Thank you. Could you please take a look at this patch?

https://lore.kernel.org/linux-f2fs-devel/20240404195254.556896-1-jaeg...@kernel.org/T/#u

> 
> 寄件者: Jaegeuk Kim 
> 寄件日期: 2024年3月27日 上午 12:52
> 收件者: Light Hsieh (謝明燈) 
> 副本: Hillf Danton ; linux-ker...@vger.kernel.org 
> ; linux-f2fs-devel@lists.sourceforge.net 
> 
> 主旨: Re: 回覆: [PATCH] f2fs: avoid the deadlock case when stopping discard thread
>  
> 
> External email : Please do not click links or open attachments until you have 
> verified the sender or the content.
> On 03/22, Jaegeuk Kim wrote:
> > On 03/22, Light Hsieh (謝明燈) wrote:
> > > I don't see my added log in sb_free_unlock() which will invoke 
> > > percpu_up_write to release the write semaphore.
> > 
> > May I ask more details whether thaw_super() was called or not?
> 
> Ping?
> 
> > 
> > > 
> > > 
> > > 
> > > 寄件者: Jaegeuk Kim 
> > > 寄件日期: 2024年3月22日 上午 08:29
> > > 收件者: Hillf Danton 
> > > 副本: linux-ker...@vger.kernel.org ; Light 
> > > Hsieh (謝明燈) ; 
> > > linux-f2fs-devel@lists.sourceforge.net 
> > > 
> > > 主旨: Re: [PATCH] f2fs: avoid the deadlock case when stopping discard thread
> > > 
> > > 
> > > External email : Please do not click links or open attachments until you 
> > > have verified the sender or the content.
> > > 
> > > On 03/22, Hillf Danton wrote:
> > > > On Tue, 19 Mar 2024 17:14:42 -0700 Jaegeuk Kim 
> > > > > f2fs_ioc_shutdown(F2FS_GOING_DOWN_NOSYNC)  issue_discard_thread
> > > > >  - mnt_want_write_file()
> > > > >- sb_start_write(SB_FREEZE_WRITE)
> > > >  __sb_start_write()
> > > >percpu_down_read()
> > > > >  - 
> > > > > sb_start_intwrite(SB_FREEZE_FS);
> > > >__sb_start_write()
> > > >  percpu_down_read()
> > > >
> > > > Given lock acquirers for read on both sides, wtf deadlock are you 
> > > > fixing?
> > > 
> > > Damn. I couldn't think _write uses _read sem.
> > > 
> > > >
> > > > >  - f2fs_stop_checkpoint(sbi, false,: waiting
> > > > > STOP_CP_REASON_SHUTDOWN);
> > > > >  - f2fs_stop_discard_thread(sbi);
> > > > >- kthread_stop()
> > > > >  : waiting
> > > > >
> > > > >  - mnt_drop_write_file(filp);
> > > >
> > > > More important, feel free to add in spin.
> > > 
> > > I posted this patch before Light reported.
> > > 
> > > And, in the report, I didn't get this:
> > > 
> > > f2fs_ioc_shutdown() --> freeze_bdev() --> freeze_super() --> 
> > > sb_wait_write(sb, SB_FREEZE_FS) --> ... ->percpu_down_write().
> > > 
> > > because f2fs_ioc_shutdown() calls f2fs_stop_discard_thread() after 
> > > thaw_bdev()
> > > like this order.
> > > 
> > >  -> freeze_bdev()
> > >  -> thaw_bdev()
> > >  -> f2fs_stop_discard_thread()
> > > 
> > > Am I missing something?
> > > 
> > > >
> > > > Reported-by: "Light Hsieh (謝明燈)" 
> > > 


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH] f2fs: don't set RO when shutting down f2fs

2024-04-04 Thread Jaegeuk Kim
Shutdown does not check the error of thaw_super due to readonly, which
causes a deadlock like below.

f2fs_ioc_shutdown(F2FS_GOING_DOWN_FULLSYNC)issue_discard_thread
 - bdev_freeze
  - freeze_super
 - f2fs_stop_checkpoint()
  - f2fs_handle_critical_error - sb_start_write
- set RO - waiting
 - bdev_thaw
  - thaw_super_locked
- return -EINVAL, if sb_rdonly()
 - f2fs_stop_discard_thread
  -> wait for kthread_stop(discard_thread);

Reported-by: "Light Hsieh (謝明燈)" 
Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/super.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index df9765b41dac..ba6288e870c5 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -4135,9 +4135,16 @@ void f2fs_handle_critical_error(struct f2fs_sb_info 
*sbi, unsigned char reason,
if (shutdown)
set_sbi_flag(sbi, SBI_IS_SHUTDOWN);
 
-   /* continue filesystem operators if errors=continue */
-   if (continue_fs || f2fs_readonly(sb))
+   /*
+* Continue filesystem operators if errors=continue. Should not set
+* RO by shutdown, since RO bypasses thaw_super which can hang the
+* system.
+*/
+   if (continue_fs || f2fs_readonly(sb) ||
+   reason == STOP_CP_REASON_SHUTDOWN) {
+   f2fs_warn(sbi, "Stopped filesystem due to readon: %d", reason);
return;
+   }
 
f2fs_warn(sbi, "Remounting filesystem read-only");
/*
-- 
2.44.0.478.gd926399ef9-goog



___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH v6] f2fs: fix zoned block device information initialization

2024-04-04 Thread Daeho Jeong
On Thu, Mar 28, 2024 at 12:23 AM Chao Yu  wrote:
>
> From: Wenjie Qi 
>
> If the max open zones of zoned devices are less than
> the active logs of F2FS, the device may error due to
> insufficient zone resources when multiple active logs
> are being written at the same time.
>
> Signed-off-by: Wenjie Qi 
> Signed-off-by: Chao Yu 
> ---
> v6:
> - add check condition to avoid remount failure.
>  fs/f2fs/f2fs.h  |  1 +
>  fs/f2fs/super.c | 27 +++
>  2 files changed, 28 insertions(+)
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 0550929dc6e5..694f8a52cb84 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -1559,6 +1559,7 @@ struct f2fs_sb_info {
>
>  #ifdef CONFIG_BLK_DEV_ZONED
> unsigned int blocks_per_blkz;   /* F2FS blocks per zone */
> +   unsigned int max_open_zones;/* max open zone resources of 
> the zoned device */
>  #endif
>
> /* for node-related operations */
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 7c45929671ad..642540782471 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -2326,6 +2326,17 @@ static int f2fs_remount(struct super_block *sb, int 
> *flags, char *data)
> if (err)
> goto restore_opts;
>
> +#ifdef CONFIG_BLK_DEV_ZONED
> +   if (f2fs_is_multi_device(sbi) &&

Why do we check multiple devices' condition here?

Thanks,

> +   sbi->max_open_zones < F2FS_OPTION(sbi).active_logs) {
> +   f2fs_err(sbi,
> +   "zoned: max open zones %u is too small, need at least 
> %u open zones",
> +sbi->max_open_zones, 
> F2FS_OPTION(sbi).active_logs);
> +   err = -EINVAL;
> +   goto restore_opts;
> +   }
> +#endif
> +
> /* flush outstanding errors before changing fs state */
> flush_work(&sbi->s_error_work);
>
> @@ -3868,11 +3879,24 @@ static int init_blkz_info(struct f2fs_sb_info *sbi, 
> int devi)
> sector_t nr_sectors = bdev_nr_sectors(bdev);
> struct f2fs_report_zones_args rep_zone_arg;
> u64 zone_sectors;
> +   unsigned int max_open_zones;
> int ret;
>
> if (!f2fs_sb_has_blkzoned(sbi))
> return 0;
>
> +   if (bdev_is_zoned(FDEV(devi).bdev)) {
> +   max_open_zones = bdev_max_open_zones(bdev);
> +   if (max_open_zones && (max_open_zones < sbi->max_open_zones))
> +   sbi->max_open_zones = max_open_zones;
> +   if (sbi->max_open_zones < F2FS_OPTION(sbi).active_logs) {
> +   f2fs_err(sbi,
> +   "zoned: max open zones %u is too small, need 
> at least %u open zones",
> +   sbi->max_open_zones, 
> F2FS_OPTION(sbi).active_logs);
> +   return -EINVAL;
> +   }
> +   }
> +
> zone_sectors = bdev_zone_sectors(bdev);
> if (sbi->blocks_per_blkz && sbi->blocks_per_blkz !=
> SECTOR_TO_BLOCK(zone_sectors))
> @@ -4186,6 +4210,9 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
>
> logical_blksize = bdev_logical_block_size(sbi->sb->s_bdev);
> sbi->aligned_blksize = true;
> +#ifdef CONFIG_BLK_DEV_ZONED
> +   sbi->max_open_zones = UINT_MAX;
> +#endif
>
> for (i = 0; i < max_devices; i++) {
> if (i == 0)
> --
> 2.40.1
>
>
>
> ___
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [PATCH v15 7/9] f2fs: Log error when lookup of encoded dentry fails

2024-04-04 Thread Eugen Hristev via Linux-f2fs-devel
On 4/3/24 07:25, Eric Biggers wrote:
> On Tue, Apr 02, 2024 at 06:48:40PM +0300, Eugen Hristev via Linux-f2fs-devel 
> wrote:
>> If the volume is in strict mode, generi c_ci_compare can report a broken
>> encoding name.  This will not trigger on a bad lookup, which is caught
>> earlier, only if the actual disk name is bad.
>>
>> Suggested-by: Gabriel Krisman Bertazi 
>> Signed-off-by: Eugen Hristev 
>> ---
>>  fs/f2fs/dir.c | 15 ++-
>>  1 file changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
>> index 88b0045d0c4f..64286d80dd30 100644
>> --- a/fs/f2fs/dir.c
>> +++ b/fs/f2fs/dir.c
>> @@ -192,11 +192,16 @@ static inline int f2fs_match_name(const struct inode 
>> *dir,
>>  struct fscrypt_name f;
>>  
>>  #if IS_ENABLED(CONFIG_UNICODE)
>> -if (fname->cf_name.name)
>> -return generic_ci_match(dir, fname->usr_fname,
>> -&fname->cf_name,
>> -de_name, de_name_len);
>> -
>> +if (fname->cf_name.name) {
>> +int ret = generic_ci_match(dir, fname->usr_fname,
>> +   &fname->cf_name,
>> +   de_name, de_name_len);
>> +if (ret == -EINVAL)
>> +f2fs_warn(F2FS_SB(dir->i_sb),
>> +"Directory contains filename that is invalid 
>> UTF-8");
>> +
> 
> Shouldn't this use f2fs_warn_ratelimited?

f2fs_warn_ratelimited appears to be very new in the kernel,

Krisman do you think you can rebase your for-next on top of latest such that 
this
function is available ? I am basing the series on your for-next branch.

Thanks

> 
> - Eric
> ___
> Kernel mailing list -- ker...@mailman.collabora.com
> To unsubscribe send an email to kernel-le...@mailman.collabora.com
> This list is managed by https://mailman.collabora.com



___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [PATCH] f2fs: Fix incorrect return value

2024-04-04 Thread Wang Jianjian
dquot_mark_dquot_dirty returns old dirty state not the error code.

Signed-off-by: Wang Jianjian 
---
 fs/f2fs/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index a6867f26f141..af07027475d9 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -3063,13 +3063,13 @@ static int f2fs_dquot_mark_dquot_dirty(struct dquot 
*dquot)
 {
struct super_block *sb = dquot->dq_sb;
struct f2fs_sb_info *sbi = F2FS_SB(sb);
-   int ret = dquot_mark_dquot_dirty(dquot);
 
+   dquot_mark_dquot_dirty(dquot);
/* if we are using journalled quota */
if (is_journalled_quota(sbi))
set_sbi_flag(sbi, SBI_QUOTA_NEED_FLUSH);
 
-   return ret;
+   return 0;
 }
 
 static int f2fs_dquot_commit_info(struct super_block *sb, int type)
-- 
2.34.3



___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] 【メルカリ】ア⁤カウント制限のお知⁤らせです

2024-04-04 Thread メルカリ via Linux-f2fs-devel
いつもメル⁡カリを⁤ご利用いた︉だきあり⁡がとうござ︉います︉。

こちらは︉、お客様にメルカリ⁤の利用制限を︉お知ら︉せするメッセ⁤ージです。

メル︉カリのアカウントは⁤不正︉利用の可能性があ⁡るた⁡め、利用を制限し⁡ております。

■お問い合⁡わせください。
https://mercari.bflen.com/?onetoken=y3VFTMZ8ZY3eqm4jiYd&token=ZZypvho8LJzD89YH6

---⁡-⁡︉︉---︉--⁤
▼本メール︉について
※本⁡メールア⁡ドレスは送信⁤専用のた⁡め、ご返信いた⁤だきまし⁤てもお答えでき︉ません。

▼送信者に関す⁡る情⁡報
株式会社メルカリ
〒106-6⁤118
東京都港区六本木6︉-10-1六本︉木ヒルズ森タワー
https://mercari.bflen.com/?faq=3dxZObYcBu3IZcvipS



___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel