Message ID | cd746c88-fcfd-12c0-8d57-29881ec4c96c@redhat.com (mailing list archive) |
---|---|
State | Accepted, archived |
Delegated to: | Mikulas Patocka |
Headers | show |
Series | dm-ebs: fix prefetch-vs-suspend race | expand |
On 3/28/25 8:19 AM, Mikulas Patocka wrote: > +static void ebs_postsuspend(struct dm_target *ti) > +{ > + struct ebs_c *ec = ti->private; > + dm_bufio_client_reset(ec->bufio); > +} Isn't it expected to leave a blank line between the declaration block and statements in Linux kernel code? Same comment for the dm-verity patch. Thanks, Bart.
Index: linux-2.6/drivers/md/dm-ebs-target.c =================================================================== --- linux-2.6.orig/drivers/md/dm-ebs-target.c 2025-02-24 12:41:49.000000000 +0100 +++ linux-2.6/drivers/md/dm-ebs-target.c 2025-03-28 15:41:13.000000000 +0100 @@ -390,6 +390,12 @@ static int ebs_map(struct dm_target *ti, return DM_MAPIO_REMAPPED; } +static void ebs_postsuspend(struct dm_target *ti) +{ + struct ebs_c *ec = ti->private; + dm_bufio_client_reset(ec->bufio); +} + static void ebs_status(struct dm_target *ti, status_type_t type, unsigned int status_flags, char *result, unsigned int maxlen) { @@ -447,6 +453,7 @@ static struct target_type ebs_target = { .ctr = ebs_ctr, .dtr = ebs_dtr, .map = ebs_map, + .postsuspend = ebs_postsuspend, .status = ebs_status, .io_hints = ebs_io_hints, .prepare_ioctl = ebs_prepare_ioctl,
There's a possible race condition in dm-ebs - dm bufio prefetch may be in progress while the device is suspended. Fix this by calling dm_bufio_client_reset in the postsuspend hook. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Cc: stable@vger.kernel.org --- drivers/md/dm-ebs-target.c | 7 +++++++ 1 file changed, 7 insertions(+)