Reviewed-by: Daeho Jeong <daehoje...@google.com>

On Tue, Feb 13, 2024 at 3:42 PM Jaegeuk Kim <jaeg...@kernel.org> wrote:
>
> When we turn on sparse_mode, stat() will be failed, as the file will be
> created afterwards. Let's fix.
>
> Fixes: 14197d546b93 ("f2fs-tools: fix to check loop device")
> Signed-off-by: Jaegeuk Kim <jaeg...@kernel.org>
> ---
>  lib/libf2fs.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/libf2fs.c b/lib/libf2fs.c
> index 5c6c5b7bf8a7..d51e485361ee 100644
> --- a/lib/libf2fs.c
> +++ b/lib/libf2fs.c
> @@ -814,6 +814,9 @@ int f2fs_dev_is_umounted(char *path)
>          * the file system. In this case, we should not format.
>          */
>         if (stat(path, &st_buf)) {
> +               /* sparse file will be created after this. */
> +               if (c.sparse_mode)
> +                       return 0;
>                 MSG(0, "Info: stat failed errno:%d\n", errno);
>                 return -1;
>         }
> --
> 2.43.0.687.g38aa6559b0-goog
>
>
>
> _______________________________________________
> 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

Reply via email to