All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Amjad Alsharafi <amjadsharafi10@gmail.com>
Cc: qemu-devel@nongnu.org, Hanna Reitz <hreitz@redhat.com>,
	"open list:vvfat" <qemu-block@nongnu.org>
Subject: Re: [PATCH v5 3/5] vvfat: Fix wrong checks for cluster mappings invariant
Date: Thu, 18 Jul 2024 17:31:29 +0200	[thread overview]
Message-ID: <Zpk1UZGPquFum48s@redhat.com> (raw)
In-Reply-To: <cb635e58663b2dd02baa8e015dbc7fd57da89e46.1718195956.git.amjadsharafi10@gmail.com>

Am 12.06.2024 um 14:43 hat Amjad Alsharafi geschrieben:
> How this `abort` was intended to check for was:
> - if the `mapping->first_mapping_index` is not the same as
>   `first_mapping_index`, which **should** happen only in one case,
>   when we are handling the first mapping, in that case
>   `mapping->first_mapping_index == -1`, in all other cases, the other
>   mappings after the first should have the condition `true`.
> - From above, we know that this is the first mapping, so if the offset
>   is not `0`, then abort, since this is an invalid state.
> 
> The issue was that `first_mapping_index` is not set if we are
> checking from the middle, the variable `first_mapping_index` is
> only set if we passed through the check `cluster_was_modified` with the
> first mapping, and in the same function call we checked the other
> mappings.
> 
> One approach is to go into the loop even if `cluster_was_modified`
> is not true so that we will be able to set `first_mapping_index` for the
> first mapping, but since `first_mapping_index` is only used here,
> another approach is to just check manually for the
> `mapping->first_mapping_index != -1` since we know that this is the
> value for the only entry where `offset == 0` (i.e. first mapping).
> 
> Signed-off-by: Amjad Alsharafi <amjadsharafi10@gmail.com>

Reviewed-by: Kevin Wolf <kwolf@redhat.com>



  reply	other threads:[~2024-07-18 15:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-12 12:43 [PATCH v5 0/5] vvfat: Fix write bugs for large files and add iotests Amjad Alsharafi
2024-06-12 12:43 ` [PATCH v5 1/5] vvfat: Fix bug in writing to middle of file Amjad Alsharafi
2024-08-11  7:48   ` Michael Tokarev
2024-06-12 12:43 ` [PATCH v5 2/5] vvfat: Fix usage of `info.file.offset` Amjad Alsharafi
2024-07-18 15:30   ` Kevin Wolf
2024-06-12 12:43 ` [PATCH v5 3/5] vvfat: Fix wrong checks for cluster mappings invariant Amjad Alsharafi
2024-07-18 15:31   ` Kevin Wolf [this message]
2024-06-12 12:43 ` [PATCH v5 4/5] vvfat: Fix reading files with non-continuous clusters Amjad Alsharafi
2024-07-18 15:20   ` Kevin Wolf
2024-07-19  0:20     ` Amjad Alsharafi
2024-07-19  0:29       ` Amjad Alsharafi
2024-07-19  8:22         ` Kevin Wolf
2024-06-12 12:43 ` [PATCH v5 5/5] iotests: Add `vvfat` tests Amjad Alsharafi
2024-06-13 14:07   ` Amjad Alsharafi
2024-06-13 17:32     ` Kevin Wolf
2024-07-18 15:30   ` Kevin Wolf
2024-07-01 13:45 ` [PATCH v5 0/5] vvfat: Fix write bugs for large files and add iotests Amjad Alsharafi
2024-08-11  7:51 ` Michael Tokarev
2024-08-11  9:52   ` Amjad Alsharafi
2024-08-11 10:09     ` Michael Tokarev
2024-08-11 10:19       ` Amjad Alsharafi
2024-08-11 14:45         ` Michael Tokarev
2024-08-12  1:36           ` Amjad Alsharafi
2024-08-13  8:52   ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zpk1UZGPquFum48s@redhat.com \
    --to=kwolf@redhat.com \
    --cc=amjadsharafi10@gmail.com \
    --cc=hreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.