Merge tag 'f2fs-for-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeu...
[linux-2.6-microblaze.git] / drivers / nvdimm / security.c
index 4cef69b..4b80150 100644 (file)
@@ -450,14 +450,19 @@ void __nvdimm_security_overwrite_query(struct nvdimm *nvdimm)
        else
                dev_dbg(&nvdimm->dev, "overwrite completed\n");
 
-       if (nvdimm->sec.overwrite_state)
-               sysfs_notify_dirent(nvdimm->sec.overwrite_state);
+       /*
+        * Mark the overwrite work done and update dimm security flags,
+        * then send a sysfs event notification to wake up userspace
+        * poll threads to picked up the changed state.
+        */
        nvdimm->sec.overwrite_tmo = 0;
        clear_bit(NDD_SECURITY_OVERWRITE, &nvdimm->flags);
        clear_bit(NDD_WORK_PENDING, &nvdimm->flags);
-       put_device(&nvdimm->dev);
        nvdimm->sec.flags = nvdimm_security_flags(nvdimm, NVDIMM_USER);
-       nvdimm->sec.flags = nvdimm_security_flags(nvdimm, NVDIMM_MASTER);
+       nvdimm->sec.ext_flags = nvdimm_security_flags(nvdimm, NVDIMM_MASTER);
+       if (nvdimm->sec.overwrite_state)
+               sysfs_notify_dirent(nvdimm->sec.overwrite_state);
+       put_device(&nvdimm->dev);
 }
 
 void nvdimm_security_overwrite_query(struct work_struct *work)