linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] f2fs: cover f2fs_lock_op in expand_inode_data case
@ 2019-12-18 19:53 Jaegeuk Kim
  2019-12-28  3:09 ` [f2fs-dev] " Chao Yu
  2020-01-03  6:49 ` Chao Yu
  0 siblings, 2 replies; 3+ messages in thread
From: Jaegeuk Kim @ 2019-12-18 19:53 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim

We were missing to cover f2fs_lock_op in this case.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/file.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 4ea9bf9e8701..0b74f94ac8ee 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1646,12 +1646,13 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
 			if (err && err != -ENODATA && err != -EAGAIN)
 				goto out_err;
 		}
-
+		f2fs_lock_op(sbi);
 		down_write(&sbi->pin_sem);
 		map.m_seg_type = CURSEG_COLD_DATA_PINNED;
 		f2fs_allocate_new_segments(sbi, CURSEG_COLD_DATA);
 		err = f2fs_map_blocks(inode, &map, 1, F2FS_GET_BLOCK_PRE_DIO);
 		up_write(&sbi->pin_sem);
+		f2fs_unlock_op(sbi);
 
 		done += map.m_len;
 		len -= map.m_len;
@@ -1661,7 +1662,9 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
 
 		map.m_len = done;
 	} else {
+		f2fs_lock_op(sbi);
 		err = f2fs_map_blocks(inode, &map, 1, F2FS_GET_BLOCK_PRE_AIO);
+		f2fs_unlock_op(sbi);
 	}
 out_err:
 	if (err) {
-- 
2.24.0.525.g8f36a354ae-goog


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

* Re: [f2fs-dev] [PATCH] f2fs: cover f2fs_lock_op in expand_inode_data case
  2019-12-18 19:53 [PATCH] f2fs: cover f2fs_lock_op in expand_inode_data case Jaegeuk Kim
@ 2019-12-28  3:09 ` Chao Yu
  2020-01-03  6:49 ` Chao Yu
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2019-12-28  3:09 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2019/12/19 3:53, Jaegeuk Kim wrote:
> We were missing to cover f2fs_lock_op in this case.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

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

* Re: [f2fs-dev] [PATCH] f2fs: cover f2fs_lock_op in expand_inode_data case
  2019-12-18 19:53 [PATCH] f2fs: cover f2fs_lock_op in expand_inode_data case Jaegeuk Kim
  2019-12-28  3:09 ` [f2fs-dev] " Chao Yu
@ 2020-01-03  6:49 ` Chao Yu
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2020-01-03  6:49 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2019/12/19 3:53, Jaegeuk Kim wrote:
> We were missing to cover f2fs_lock_op in this case.

Jaegeuk,

generic/269 will hang with this patch, and also bugzilla reports android
with last code will hang with the same stack.

Could you check this patch?

Thanks,

> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/file.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 4ea9bf9e8701..0b74f94ac8ee 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -1646,12 +1646,13 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
>  			if (err && err != -ENODATA && err != -EAGAIN)
>  				goto out_err;
>  		}
> -
> +		f2fs_lock_op(sbi);
>  		down_write(&sbi->pin_sem);
>  		map.m_seg_type = CURSEG_COLD_DATA_PINNED;
>  		f2fs_allocate_new_segments(sbi, CURSEG_COLD_DATA);
>  		err = f2fs_map_blocks(inode, &map, 1, F2FS_GET_BLOCK_PRE_DIO);
>  		up_write(&sbi->pin_sem);
> +		f2fs_unlock_op(sbi);
>  
>  		done += map.m_len;
>  		len -= map.m_len;
> @@ -1661,7 +1662,9 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
>  
>  		map.m_len = done;
>  	} else {
> +		f2fs_lock_op(sbi);
>  		err = f2fs_map_blocks(inode, &map, 1, F2FS_GET_BLOCK_PRE_AIO);
> +		f2fs_unlock_op(sbi);
>  	}
>  out_err:
>  	if (err) {
> 

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

end of thread, other threads:[~2020-01-03  6:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 19:53 [PATCH] f2fs: cover f2fs_lock_op in expand_inode_data case Jaegeuk Kim
2019-12-28  3:09 ` [f2fs-dev] " Chao Yu
2020-01-03  6:49 ` Chao Yu

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).