To keep the values of pi->historical_service_time,
pi->outstanding, and pi->stale_after consistent, get them while
holding a spin_lock in hst_status(), like all other accesses do.

Signed-off-by: Benjamin Marzinski <[email protected]>
---
 drivers/md/dm-ps-historical-service-time.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/dm-ps-historical-service-time.c 
b/drivers/md/dm-ps-historical-service-time.c
index e0103eefe28f..3ad40505ff46 100644
--- a/drivers/md/dm-ps-historical-service-time.c
+++ b/drivers/md/dm-ps-historical-service-time.c
@@ -202,6 +202,7 @@ static int hst_status(struct path_selector *ps, struct 
dm_path *path,
 {
        unsigned int sz = 0;
        struct path_info *pi;
+       unsigned long flags;
 
        if (!path) {
                struct selector *s = ps->context;
@@ -212,8 +213,10 @@ static int hst_status(struct path_selector *ps, struct 
dm_path *path,
 
                switch (type) {
                case STATUSTYPE_INFO:
+                       spin_lock_irqsave(&pi->lock, flags);
                        DMEMIT("%llu %llu %llu ", pi->historical_service_time,
                               pi->outstanding, pi->stale_after);
+                       spin_unlock_irqrestore(&pi->lock, flags);
                        break;
                case STATUSTYPE_TABLE:
                        DMEMIT("%u ", pi->repeat_count);
-- 
2.53.0


Reply via email to