The commit is pushed to "branch-rh9-5.14.0-70.13.1.vz9.16.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-70.13.1.vz9.16.3
------>
commit f3b6dad5517b7b632e874d0dd2dc13e315524ac8
Author: Alexander Mikhalitsyn <alexander.mikhalit...@virtuozzo.com>
Date:   Wed Jun 8 01:14:43 2022 +0300

    dm-ploop: Refactor dm target status callback
    
    After ms commit 91ccbbac17 ("dm ima: measure data on table load")
    a new STATUSTYPE_IMA has been introduced.
    
    This change has triggered compile time warning for dm-qcow2 driver:
      warning: drivers/md/dm-qcow2-target.c:897:9: warning: enumeration value 
‘STATUSTYPE_IMA’ not handled in switch [-Wswitch]
    
    but no warning has been triggered for dm-ploop driver.
    
    That's because we have no switch operator in status callback
    implementation there. That's not perfect, it's better to have all
    status_type_t enum cases handled explicitly.
    
    This patch changes the behavior of handling the ioctl with
    STATUSTYPE_INFO type: previously we returned same data as for
    STATUSTYPE_TABLE ioctl type and now we return nothing (as for
    STATUSTYPE_IMA ioctl as well).
    
    This behavior change breaks nothing because we have no usage of this
    ioctl(DM_IOCTL) in our userspace.
    
    Data provided upon STATUSTYPE_TABLE type ioctl remains the same.
    
    https://jira.sw.ru/browse/PSBM-140279
    
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalit...@virtuozzo.com>
    Feature: dm-ploop: ploop target driver
---
 drivers/md/dm-ploop-target.c | 41 ++++++++++++++++++++++++++---------------
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index b4607d2bab65..d7cc2fbba537 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -452,22 +452,33 @@ static void ploop_status(struct dm_target *ti, 
status_type_t type,
        char stat[32], *p = stat;
        ssize_t sz = 0;
 
-       down_read(&ploop->ctl_rwsem);
-       if (ploop->falloc_new_clu)
-               *p++ = 'f';
-       if (READ_ONCE(ploop->noresume))
-               *p++ = 'n';
-       if (READ_ONCE(ploop->event_enospc))
-               *p++ = 's';
-       if (p == stat)
-               *p++ = 'o';
-       if (ploop->skip_off)
-               p += sprintf(p, " off=%llu", ploop->skip_off);
-       *p++ = '\0';
-       up_read(&ploop->ctl_rwsem);
+       switch (type) {
+       case STATUSTYPE_INFO:
+               result[0] = '\0';
+               break;
+       case STATUSTYPE_TABLE:
+               down_read(&ploop->ctl_rwsem);
+               if (ploop->falloc_new_clu)
+                       *p++ = 'f';
+               if (READ_ONCE(ploop->noresume))
+                       *p++ = 'n';
+               if (READ_ONCE(ploop->event_enospc))
+                       *p++ = 's';
+               if (p == stat)
+                       *p++ = 'o';
+               if (ploop->skip_off)
+                       p += sprintf(p, " off=%llu", ploop->skip_off);
+               *p++ = '\0';
+               up_read(&ploop->ctl_rwsem);
+
+               BUG_ON(p - stat >= sizeof(stat));
+               DMEMIT("%u v2 %u %s", ploop->nr_deltas, (u32)CLU_TO_SEC(ploop, 
1), stat);
 
-       BUG_ON(p - stat >= sizeof(stat));
-       DMEMIT("%u v2 %u %s", ploop->nr_deltas, (u32)CLU_TO_SEC(ploop, 1), 
stat);
+               break;
+       case STATUSTYPE_IMA:
+               result[0] = '\0';
+               break;
+       }
 }
 
 static void ploop_set_wants_suspend(struct dm_target *ti, bool wants)
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to