[f2fs-dev] [PATCH] f2fs: add REQ_TIME time update for some user behaviors

2024-03-12 Thread Zhiguo Niu
some user behaviors requested filesystem operations, which
will cause filesystem not idle.
Meanwhile adjust f2fs_update_time(REQ_TIME) of
f2fs_ioc_defragment to successful case.

Signed-off-by: Zhiguo Niu 
---
 fs/f2fs/file.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 4dfe38e..dac3836 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2784,7 +2784,6 @@ static int f2fs_ioc_defragment(struct file *filp, 
unsigned long arg)
err = f2fs_defragment_range(sbi, filp, );
mnt_drop_write_file(filp);
 
-   f2fs_update_time(sbi, REQ_TIME);
if (err < 0)
return err;
 
@@ -2792,6 +2791,7 @@ static int f2fs_ioc_defragment(struct file *filp, 
unsigned long arg)
sizeof(range)))
return -EFAULT;
 
+   f2fs_update_time(sbi, REQ_TIME);
return 0;
 }
 
@@ -3331,6 +3331,7 @@ static int f2fs_ioc_resize_fs(struct file *filp, unsigned 
long arg)
if (copy_from_user(_count, (void __user *)arg,
   sizeof(block_count)))
return -EFAULT;
+   f2fs_update_time(sbi, REQ_TIME);
 
return f2fs_resize_fs(filp, block_count);
 }
@@ -3424,6 +3425,7 @@ static int f2fs_ioc_setfslabel(struct file *filp, 
unsigned long arg)
f2fs_up_write(>sb_lock);
 
mnt_drop_write_file(filp);
+   f2fs_update_time(sbi, REQ_TIME);
 out:
kfree(vbuf);
return err;
@@ -3597,6 +3599,7 @@ static int f2fs_release_compress_blocks(struct file 
*filp, unsigned long arg)
 
filemap_invalidate_unlock(inode->i_mapping);
f2fs_up_write(_I(inode)->i_gc_rwsem[WRITE]);
+   f2fs_update_time(sbi, REQ_TIME);
 out:
inode_unlock(inode);
 
@@ -3766,6 +3769,7 @@ static int f2fs_reserve_compress_blocks(struct file 
*filp, unsigned long arg)
clear_inode_flag(inode, FI_COMPRESS_RELEASED);
inode_set_ctime_current(inode);
f2fs_mark_inode_dirty_sync(inode, true);
+   f2fs_update_time(sbi, REQ_TIME);
}
 unlock_inode:
inode_unlock(inode);
@@ -3964,6 +3968,7 @@ static int f2fs_sec_trim_file(struct file *filp, unsigned 
long arg)
if (len)
ret = f2fs_secure_erase(prev_bdev, inode, prev_index,
prev_block, len, range.flags);
+   f2fs_update_time(sbi, REQ_TIME);
 out:
filemap_invalidate_unlock(mapping);
f2fs_up_write(_I(inode)->i_gc_rwsem[WRITE]);
@@ -4173,6 +4178,7 @@ static int f2fs_ioc_decompress_file(struct file *filp)
if (ret)
f2fs_warn(sbi, "%s: The file might be partially decompressed 
(errno=%d). Please delete the file.",
  __func__, ret);
+   f2fs_update_time(sbi, REQ_TIME);
 out:
inode_unlock(inode);
file_end_write(filp);
@@ -4252,6 +4258,7 @@ static int f2fs_ioc_compress_file(struct file *filp)
if (ret)
f2fs_warn(sbi, "%s: The file might be partially compressed 
(errno=%d). Please delete the file.",
  __func__, ret);
+   f2fs_update_time(sbi, REQ_TIME);
 out:
inode_unlock(inode);
file_end_write(filp);
-- 
1.9.1



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


Re: [f2fs-dev] [PATCH v2] f2fs: prevent writing without fallocate() for pinned files

2024-03-12 Thread Chao Yu

On 2024/3/13 4:49, Daeho Jeong wrote:

From: Daeho Jeong 

In a case writing without fallocate(), we can't guarantee it's allocated
in the conventional area for zoned stroage.

Signed-off-by: Daeho Jeong 
---
v2: covered the direct io case


Oh, one more missed case, mkwrite?

Thanks,


---
  fs/f2fs/data.c | 14 --
  fs/f2fs/file.c |  4 
  2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index c21b92f18463..d3e5ab2736a6 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1584,8 +1584,11 @@ int f2fs_map_blocks(struct inode *inode, struct 
f2fs_map_blocks *map, int flag)
  
  	/* use out-place-update for direct IO under LFS mode */

if (map->m_may_create &&
-   (is_hole || (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO))) {
-   if (unlikely(f2fs_cp_error(sbi))) {
+   (is_hole || (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO &&
+!f2fs_is_pinned_file(inode {
+   if (unlikely(f2fs_cp_error(sbi)) ||
+   (f2fs_is_pinned_file(inode) && is_hole &&
+flag != F2FS_GET_BLOCK_PRE_DIO)) {
err = -EIO;
goto sync_out;
}
@@ -3378,6 +3381,8 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi,
f2fs_map_lock(sbi, flag);
locked = true;
} else if ((pos & PAGE_MASK) >= i_size_read(inode)) {
+   if (f2fs_is_pinned_file(inode))
+   return -EIO;
f2fs_map_lock(sbi, flag);
locked = true;
}
@@ -3407,6 +3412,11 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi,
  
  	if (!f2fs_lookup_read_extent_cache_block(inode, index,

 _blkaddr)) {
+   if (f2fs_is_pinned_file(inode)) {
+   err = -EIO;
+   goto out;
+   }
+
if (locked) {
err = f2fs_reserve_block(, index);
goto out;
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 82277e95c88f..f98730932fc4 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -4611,6 +4611,10 @@ static int f2fs_preallocate_blocks(struct kiocb *iocb, 
struct iov_iter *iter,
return ret;
}
  
+	/* For pinned files, it should be fallocate()-ed in advance. */

+   if (f2fs_is_pinned_file(inode))
+   return 0;
+
/* Do not preallocate blocks that will be written partially in 4KB. */
map.m_lblk = F2FS_BLK_ALIGN(pos);
map.m_len = F2FS_BYTES_TO_BLK(pos + count);



___
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: fix to return EIO when reading after device removal

2024-03-12 Thread Jaegeuk Kim
So, I was wondering we can give data even in cp_error case.

On 03/12, Chao Yu wrote:
> Ping,
> 
> Jaegeuk, do you have any comments on this patch?
> 
> Thanks,
> 
> On 2024/2/26 16:00, Chao Yu wrote:
> > Any comments?
> > 
> > Thanks,
> > 
> > On 2024/2/19 11:13, Chao Yu wrote:
> > > On 2024/2/8 8:18, Jaegeuk Kim wrote:
> > > > On 02/06, Chao Yu wrote:
> > > > > generic/730 2s ... - output mismatch (see 
> > > > > /media/fstests/results//generic/730.out.bad)
> > > > >  --- tests/generic/730.out    2023-08-07 01:39:51.055568499 +
> > > > >  +++ /media/fstests/results//generic/730.out.bad    2024-02-06 
> > > > > 02:26:43.0 +
> > > > >  @@ -1,2 +1 @@
> > > > >   QA output created by 730
> > > > >  -cat: -: Input/output error
> > > > >  ...
> > > > >  (Run 'diff -u /media/fstests/tests/generic/730.out 
> > > > > /media/fstests/results//generic/730.out.bad'  to see the entire diff)
> > > > > Ran: generic/730
> > > > > Failures: generic/730
> > > > > Failed 1 of 1 tests
> > > > > 
> > > > > This patch adds a check condition in f2fs_file_read_iter() to
> > > > > detect cp_error status after device removal, and retrurn -EIO
> > > > > for such case.
> > > > 
> > > > Can we check device removal?
> > > 
> > > We can use blk_queue_dying() to detect device removal, but, IMO, device
> > > removal can almost not happen in Android, not sure for distros or server,
> > > do you want to add this check condition into f2fs_cp_error()?
> > > 
> > > Thanks,
> > > 
> > > > 
> > > > > 
> > > > > Signed-off-by: Chao Yu 
> > > > > ---
> > > > >   fs/f2fs/file.c | 3 +++
> > > > >   1 file changed, 3 insertions(+)
> > > > > 
> > > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> > > > > index 45b7e3610b0f..9e4386d4144c 100644
> > > > > --- a/fs/f2fs/file.c
> > > > > +++ b/fs/f2fs/file.c
> > > > > @@ -4462,6 +4462,9 @@ static ssize_t f2fs_file_read_iter(struct kiocb 
> > > > > *iocb, struct iov_iter *to)
> > > > >   const loff_t pos = iocb->ki_pos;
> > > > >   ssize_t ret;
> > > > > +    if (unlikely(f2fs_cp_error(F2FS_I_SB(inode
> > > > > +    return -EIO;
> > > > > +
> > > > >   if (!f2fs_is_compress_backend_ready(inode))
> > > > >   return -EOPNOTSUPP;
> > > > > -- 
> > > > > 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


___
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: support .shutdown in f2fs_sops

2024-03-12 Thread Jaegeuk Kim
Will check this after merge window.

On 03/12, Chao Yu wrote:
> Ping,
> 
> On 2024/2/29 22:38, Chao Yu wrote:
> > Support .shutdown callback in f2fs_sops, then, it can be called to
> > shut down the file system when underlying block device is marked dead.
> > 
> > Signed-off-by: Chao Yu 
> > ---
> >   fs/f2fs/f2fs.h  |  2 ++
> >   fs/f2fs/file.c  | 70 ++---
> >   fs/f2fs/super.c |  6 +
> >   3 files changed, 51 insertions(+), 27 deletions(-)
> > 
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > index 85eb9a8a5ed3..80789255bf68 100644
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > @@ -3506,6 +3506,8 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct 
> > dentry *dentry,
> >  struct iattr *attr);
> >   int f2fs_truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t 
> > pg_end);
> >   void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count);
> > +int f2fs_do_shutdown(struct f2fs_sb_info *sbi, unsigned int flag,
> > +   bool readonly);
> >   int f2fs_precache_extents(struct inode *inode);
> >   int f2fs_fileattr_get(struct dentry *dentry, struct fileattr *fa);
> >   int f2fs_fileattr_set(struct mnt_idmap *idmap,
> > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> > index 4ca6c693b33a..d223175b3d5c 100644
> > --- a/fs/f2fs/file.c
> > +++ b/fs/f2fs/file.c
> > @@ -2226,34 +2226,13 @@ static int f2fs_ioc_abort_atomic_write(struct file 
> > *filp)
> > return ret;
> >   }
> > -static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg)
> > +int f2fs_do_shutdown(struct f2fs_sb_info *sbi, unsigned int flag,
> > +   bool readonly)
> >   {
> > -   struct inode *inode = file_inode(filp);
> > -   struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> > struct super_block *sb = sbi->sb;
> > -   __u32 in;
> > int ret = 0;
> > -   if (!capable(CAP_SYS_ADMIN))
> > -   return -EPERM;
> > -
> > -   if (get_user(in, (__u32 __user *)arg))
> > -   return -EFAULT;
> > -
> > -   if (in != F2FS_GOING_DOWN_FULLSYNC) {
> > -   ret = mnt_want_write_file(filp);
> > -   if (ret) {
> > -   if (ret == -EROFS) {
> > -   ret = 0;
> > -   f2fs_stop_checkpoint(sbi, false,
> > -   STOP_CP_REASON_SHUTDOWN);
> > -   trace_f2fs_shutdown(sbi, in, ret);
> > -   }
> > -   return ret;
> > -   }
> > -   }
> > -
> > -   switch (in) {
> > +   switch (flag) {
> > case F2FS_GOING_DOWN_FULLSYNC:
> > ret = bdev_freeze(sb->s_bdev);
> > if (ret)
> > @@ -2292,6 +2271,9 @@ static int f2fs_ioc_shutdown(struct file *filp, 
> > unsigned long arg)
> > goto out;
> > }
> > +   if (readonly)
> > +   goto out;
> > +
> > f2fs_stop_gc_thread(sbi);
> > f2fs_stop_discard_thread(sbi);
> > @@ -2300,10 +2282,44 @@ static int f2fs_ioc_shutdown(struct file *filp, 
> > unsigned long arg)
> > f2fs_update_time(sbi, REQ_TIME);
> >   out:
> > -   if (in != F2FS_GOING_DOWN_FULLSYNC)
> > -   mnt_drop_write_file(filp);
> > -   trace_f2fs_shutdown(sbi, in, ret);
> > +   trace_f2fs_shutdown(sbi, flag, ret);
> > +
> > +   return ret;
> > +}
> > +
> > +static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg)
> > +{
> > +   struct inode *inode = file_inode(filp);
> > +   struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> > +   __u32 in;
> > +   int ret;
> > +   bool need_drop = false, readonly = false;
> > +
> > +   if (!capable(CAP_SYS_ADMIN))
> > +   return -EPERM;
> > +
> > +   if (get_user(in, (__u32 __user *)arg))
> > +   return -EFAULT;
> > +
> > +   if (in != F2FS_GOING_DOWN_FULLSYNC) {
> > +   ret = mnt_want_write_file(filp);
> > +   if (ret) {
> > +   if (ret != -EROFS)
> > +   return ret;
> > +
> > +   /* fallback to nosync shutdown for readonly fs */
> > +   in = F2FS_GOING_DOWN_NOSYNC;
> > +   readonly = true;
> > +   } else {
> > +   need_drop = true;
> > +   }
> > +   }
> > +
> > +   ret = f2fs_do_shutdown(sbi, in, readonly);
> > +
> > +   if (need_drop)
> > +   mnt_drop_write_file(filp);
> > return ret;
> >   }
> > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> > index 78a76583a4aa..0676c2dcbbf7 100644
> > --- a/fs/f2fs/super.c
> > +++ b/fs/f2fs/super.c
> > @@ -2547,6 +2547,11 @@ static int f2fs_remount(struct super_block *sb, int 
> > *flags, char *data)
> > return err;
> >   }
> > +static void f2fs_shutdown(struct super_block *sb)
> > +{
> > +   f2fs_do_shutdown(F2FS_SB(sb), F2FS_GOING_DOWN_NOSYNC, false);
> > +}
> > +
> >   #ifdef CONFIG_QUOTA
> >   static bool f2fs_need_recovery(struct f2fs_sb_info *sbi)
> >   {
> > @@ -3146,6 +3151,7 

Re: [f2fs-dev] [syzbot] [f2fs?] KASAN: slab-use-after-free Read in f2fs_filemap_fault

2024-03-12 Thread Jaegeuk Kim
On 03/12, Ed Tsai (蔡宗軒) wrote:
> On Mon, 2024-01-15 at 20:05 +0800, Hillf Danton wrote:
> > 
> > ...
> > 
> > --- x/fs/f2fs/file.c
> > +++ y/fs/f2fs/file.c
> > @@ -39,6 +39,7 @@
> >  static vm_fault_t f2fs_filemap_fault(struct vm_fault *vmf)
> >  {
> > struct inode *inode = file_inode(vmf->vma->vm_file);
> > +   vm_flags_t flags = vmf->vma->vm_flags;
> > vm_fault_t ret;
> >  
> > ret = filemap_fault(vmf);
> > @@ -46,7 +47,7 @@ static vm_fault_t f2fs_filemap_fault(str
> > f2fs_update_iostat(F2FS_I_SB(inode), inode,
> > APP_MAPPED_READ_IO,
> > F2FS_BLKSIZE);
> >  
> > -   trace_f2fs_filemap_fault(inode, vmf->pgoff, vmf->vma-
> > >vm_flags, ret);
> > +   trace_f2fs_filemap_fault(inode, vmf->pgoff, flags, ret);
> >  
> > return ret;
> >  }
> > --
> 
> Hi Jaegeuk,
> 
> We recently encountered this slabe-use-after-free issue in KASAN as
> well. Could you please review the patch above and merge it into f2fs?

Where is the patch?

> 
> Best,
> Ed
> 
> ==
> [29195.369964][T31720] BUG: KASAN: slab-use-after-free in
> f2fs_filemap_fault+0x50/0xe0
> [29195.370971][T31720] Read at addr f780454ebde0 by task AsyncTask
> #11/31720
> [29195.371881][T31720] Pointer tag: [f7], memory tag: [f1]
> [29195.372549][T31720] 
> [29195.372838][T31720] CPU: 2 PID: 31720 Comm: AsyncTask #11 Tainted:
> GW  OE  6.6.17-android15-0-gcb5ba718a525 #1
> [29195.374862][T31720] Call trace:
> [29195.375268][T31720]  dump_backtrace+0xec/0x138
> [29195.375848][T31720]  show_stack+0x18/0x24
> [29195.376365][T31720]  dump_stack_lvl+0x50/0x6c
> [29195.376943][T31720]  print_report+0x1b0/0x714
> [29195.377520][T31720]  kasan_report+0xc4/0x124
> [29195.378076][T31720]  __do_kernel_fault+0xb8/0x26c
> [29195.378694][T31720]  do_bad_area+0x30/0xdc
> [29195.379226][T31720]  do_tag_check_fault+0x20/0x34
> [29195.379834][T31720]  do_mem_abort+0x58/0x104
> [29195.380388][T31720]  el1_abort+0x3c/0x5c
> [29195.380899][T31720]  el1h_64_sync_handler+0x54/0x90
> [29195.381529][T31720]  el1h_64_sync+0x68/0x6c
> [29195.382069][T31720]  f2fs_filemap_fault+0x50/0xe0
> [29195.382678][T31720]  __do_fault+0xc8/0xfc
> [29195.383209][T31720]  handle_mm_fault+0xb44/0x10c4
> [29195.383816][T31720]  do_page_fault+0x294/0x48c
> [29195.384395][T31720]  do_translation_fault+0x38/0x54
> [29195.385023][T31720]  do_mem_abort+0x58/0x104
> [29195.385577][T31720]  el0_da+0x44/0x78
> [29195.386057][T31720]  el0t_64_sync_handler+0x98/0xbc
> [29195.386688][T31720]  el0t_64_sync+0x1a8/0x1ac
> [29195.387249][T31720] 
> [29195.387534][T31720] Allocated by task 14784:
> [29195.388085][T31720]  kasan_save_stack+0x40/0x70
> [29195.388672][T31720]  save_stack_info+0x34/0x128
> [29195.389259][T31720]  kasan_save_alloc_info+0x14/0x20
> [29195.389901][T31720]  __kasan_slab_alloc+0x168/0x174
> [29195.390530][T31720]  slab_post_alloc_hook+0x88/0x3a4
> [29195.391168][T31720]  kmem_cache_alloc+0x18c/0x2c8
> [29195.391771][T31720]  vm_area_alloc+0x2c/0xe8
> [29195.392327][T31720]  mmap_region+0x440/0xa94
> [29195.392888][T31720]  do_mmap+0x3d0/0x524
> [29195.393399][T31720]  vm_mmap_pgoff+0x1a0/0x1f8
> [29195.393980][T31720]  ksys_mmap_pgoff+0x78/0xf4
> [29195.394557][T31720]  __arm64_sys_mmap+0x34/0x44
> [29195.395138][T31720]  invoke_syscall+0x58/0x114
> [29195.395727][T31720]  el0_svc_common+0x80/0xe0
> [29195.396292][T31720]  do_el0_svc+0x1c/0x28
> [29195.396812][T31720]  el0_svc+0x38/0x68
> [29195.397302][T31720]  el0t_64_sync_handler+0x68/0xbc
> [29195.397932][T31720]  el0t_64_sync+0x1a8/0x1ac
> [29195.398492][T31720] 
> [29195.398778][T31720] Freed by task 0:
> [29195.399240][T31720]  kasan_save_stack+0x40/0x70
> [29195.399825][T31720]  save_stack_info+0x34/0x128
> [29195.400412][T31720]  kasan_save_free_info+0x18/0x28
> [29195.401043][T31720]  kasan_slab_free+0x254/0x25c
> [29195.401682][T31720]  __kasan_slab_free+0x10/0x20
> [29195.402278][T31720]  slab_free_freelist_hook+0x174/0x1e0
> [29195.402961][T31720]  kmem_cache_free+0xc4/0x348
> [29195.403544][T31720]  __vm_area_free+0x84/0xa4
> [29195.404103][T31720]  vm_area_free_rcu_cb+0x10/0x20
> [29195.404719][T31720]  rcu_do_batch+0x214/0x720
> [29195.405284][T31720]  rcu_core+0x1b0/0x408
> [29195.405800][T31720]  rcu_core_si+0x10/0x20
> [29195.406348][T31720]  __do_softirq+0x120/0x3f4
> [29195.406907][T31720] 
> [29195.407191][T31720] The buggy address belongs to the object at
> ff80454ebdc0
> [29195.407191][T31720]  which belongs to the cache vm_area_struct of
> size 176
> [29195.408978][T31720] The buggy address is located 32 bytes inside of
> [29195.408978][T31720]  176-byte region [ff80454ebdc0,
> ff80454ebe70)
> [29195.410625][T31720] 
> [29195.410911][T31720] The buggy address belongs to the physical page:
> [29195.411709][T31720] page:58f0f2f1 refcount:1 mapcount:0
> mapping: index:0x0 pfn:0xc54eb
> 

Re: [f2fs-dev] [PATCH 1/2] f2fs: prevent atomic write on pinned file

2024-03-12 Thread patchwork-bot+f2fs
Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Mon, 11 Mar 2024 16:59:19 -0700 you wrote:
> From: Daeho Jeong 
> 
> Since atomic write way was changed to out-place-update, we should
> prevent it on pinned files.
> 
> Signed-off-by: Daeho Jeong 
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,1/2] f2fs: prevent atomic write on pinned file
https://git.kernel.org/jaegeuk/f2fs/c/c644af133283
  - [f2fs-dev,2/2] f2fs: prevent writing without fallocate() for pinned files
(no matching commit)

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




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


Re: [f2fs-dev] [PATCH V2 2/2] f2fs: fix to handle error paths of {new, change}_curseg()

2024-03-12 Thread patchwork-bot+f2fs
Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Mon, 11 Mar 2024 15:48:54 +0800 you wrote:
> {new,change}_curseg() may return error in some special cases,
> error handling should be did in their callers, and this will also
> facilitate subsequent error path expansion in {new,change}_curseg().
> 
> Signed-off-by: Zhiguo Niu 
> Signed-off-by: Chao Yu 
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,V2,2/2] f2fs: fix to handle error paths of {new, change}_curseg()
https://git.kernel.org/jaegeuk/f2fs/c/245930617c9b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




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


Re: [f2fs-dev] [PATCH v2] f2fs: fix to truncate meta inode pages forcely

2024-03-12 Thread patchwork-bot+f2fs
Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Fri,  8 Mar 2024 09:08:34 +0800 you wrote:
> Below race case can cause data corruption:
> 
> Thread A  GC thread
>   - gc_data_segment
>- ra_data_block
> - locked meta_inode page
> - f2fs_inplace_write_data
>  - invalidate_mapping_pages
>  : fail to invalidate meta_inode page
>due to lock failure or dirty|writeback
>status
>  - f2fs_submit_page_bio
>  : write last dirty data to old blkaddr
>- move_data_block
> - load old data from meta_inode page
> - f2fs_submit_page_write
> : write old data to new blkaddr
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,v2] f2fs: fix to truncate meta inode pages forcely
https://git.kernel.org/jaegeuk/f2fs/c/9f0c4a46be1f

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




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


Re: [f2fs-dev] [PATCH V2 1/2] f2fs: compress: relocate some judgments in f2fs_reserve_compress_blocks

2024-03-12 Thread patchwork-bot+f2fs
Hello:

This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Wed, 6 Mar 2024 11:47:45 +0800 you wrote:
> The following f2fs_io test will get a "0" result instead of -EINVAL,
> unisoc # ./f2fs_io compress file
> unisoc # ./f2fs_io reserve_cblocks file
>  0
> it's not reasonable, so the judgement of
> atomic_read(_I(inode)->i_compr_blocks) should be placed after
> the judgement of is_inode_flag_set(inode, FI_COMPRESS_RELEASED).
> 
> [...]

Here is the summary with links:
  - [f2fs-dev,V2,1/2] f2fs: compress: relocate some judgments in 
f2fs_reserve_compress_blocks
https://git.kernel.org/jaegeuk/f2fs/c/b7d797d241c1
  - [f2fs-dev,V2,2/2] f2fs: compress: fix reserve_cblocks counting error when 
out of space
https://git.kernel.org/jaegeuk/f2fs/c/2f6d721e14b6

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




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


[f2fs-dev] Patchwork summary for: f2fs

2024-03-12 Thread patchwork-bot+f2fs
Hello:

The following patches were marked "accepted", because they were applied to
jaegeuk/f2fs.git (dev):

Series: [f2fs-dev,1/2] f2fs: prevent atomic write on pinned file
  Submitter: Daeho Jeong 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=834480
  Lore link: 
https://lore.kernel.org/r/20240311235921.1832684-1-daeh...@gmail.com
Patches: [f2fs-dev,1/2] f2fs: prevent atomic write on pinned file

Patch: [f2fs-dev] f2fs: zone: fix to remove pow2 check condition for zoned 
block device
  Submitter: Chao Yu 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=833648
  Lore link: https://lore.kernel.org/r/20240308035057.62660-1-c...@kernel.org

Patch: [f2fs-dev,v2] f2fs: fix to truncate meta inode pages forcely
  Submitter: Chao Yu 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=833630
  Lore link: https://lore.kernel.org/r/20240308010834.4023772-1-c...@kernel.org

Series: [f2fs-dev,V2,1/2] f2fs: compress: relocate some judgments in 
f2fs_reserve_compress_blocks
  Submitter: Xiuhong Wang 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=832808
  Lore link: 
https://lore.kernel.org/r/20240306034746.3722986-1-xiuhong.w...@unisoc.com
Patches: [f2fs-dev,V2,1/2] f2fs: compress: relocate some judgments in 
f2fs_reserve_compress_blocks
 [f2fs-dev,V2,2/2] f2fs: compress: fix reserve_cblocks counting 
error when out of space

Patch: None
  Submitter: Zhiguo Niu 
  Committer: Jaegeuk Kim 
  Patchwork: https://patchwork.kernel.org/project/f2fs/list/?series=834208
  Lore link: 
https://lore.kernel.org/r/1710143334-27653-1-git-send-email-zhiguo@unisoc.com


Total patches: 6

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




___
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: zone: fix to remove pow2 check condition for zoned block device

2024-03-12 Thread patchwork-bot+f2fs
Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim :

On Fri,  8 Mar 2024 11:50:57 +0800 you wrote:
> Commit 2e2c6e9b72ce ("f2fs: remove power-of-two limitation of zoned
> device") missed to remove pow2 check condition in init_blkz_info(),
> fix it.
> 
> Fixes: 2e2c6e9b72ce ("f2fs: remove power-of-two limitation of zoned device")
> Signed-off-by: Feng Song 
> Signed-off-by: Yongpeng Yang 
> Signed-off-by: Chao Yu 
> 
> [...]

Here is the summary with links:
  - [f2fs-dev] f2fs: zone: fix to remove pow2 check condition for zoned block 
device
https://git.kernel.org/jaegeuk/f2fs/c/11bec96afbfb

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




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


[f2fs-dev] [PATCH v2] f2fs: prevent writing without fallocate() for pinned files

2024-03-12 Thread Daeho Jeong
From: Daeho Jeong 

In a case writing without fallocate(), we can't guarantee it's allocated
in the conventional area for zoned stroage.

Signed-off-by: Daeho Jeong 
---
v2: covered the direct io case
---
 fs/f2fs/data.c | 14 --
 fs/f2fs/file.c |  4 
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index c21b92f18463..d3e5ab2736a6 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1584,8 +1584,11 @@ int f2fs_map_blocks(struct inode *inode, struct 
f2fs_map_blocks *map, int flag)
 
/* use out-place-update for direct IO under LFS mode */
if (map->m_may_create &&
-   (is_hole || (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO))) {
-   if (unlikely(f2fs_cp_error(sbi))) {
+   (is_hole || (f2fs_lfs_mode(sbi) && flag == F2FS_GET_BLOCK_DIO &&
+!f2fs_is_pinned_file(inode {
+   if (unlikely(f2fs_cp_error(sbi)) ||
+   (f2fs_is_pinned_file(inode) && is_hole &&
+flag != F2FS_GET_BLOCK_PRE_DIO)) {
err = -EIO;
goto sync_out;
}
@@ -3378,6 +3381,8 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi,
f2fs_map_lock(sbi, flag);
locked = true;
} else if ((pos & PAGE_MASK) >= i_size_read(inode)) {
+   if (f2fs_is_pinned_file(inode))
+   return -EIO;
f2fs_map_lock(sbi, flag);
locked = true;
}
@@ -3407,6 +3412,11 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi,
 
if (!f2fs_lookup_read_extent_cache_block(inode, index,
 _blkaddr)) {
+   if (f2fs_is_pinned_file(inode)) {
+   err = -EIO;
+   goto out;
+   }
+
if (locked) {
err = f2fs_reserve_block(, index);
goto out;
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 82277e95c88f..f98730932fc4 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -4611,6 +4611,10 @@ static int f2fs_preallocate_blocks(struct kiocb *iocb, 
struct iov_iter *iter,
return ret;
}
 
+   /* For pinned files, it should be fallocate()-ed in advance. */
+   if (f2fs_is_pinned_file(inode))
+   return 0;
+
/* Do not preallocate blocks that will be written partially in 4KB. */
map.m_lblk = F2FS_BLK_ALIGN(pos);
map.m_len = F2FS_BYTES_TO_BLK(pos + count);
-- 
2.44.0.278.ge034bb2e1d-goog



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


Re: [f2fs-dev] [bug report]WARNING: CPU: 22 PID: 44011 at fs/iomap/iter.c:51 iomap_iter+0x32b observed with blktests zbd/010

2024-03-12 Thread Shinichiro Kawasaki via Linux-f2fs-devel
On Mar 12, 2024 / 12:57, Yi Zhang wrote:
...
> Sorry, please use this one.

Thanks. I have succeeded to recreate the issue. Will take a look tomorrow.


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