block: Storaged needs to check repeated Add uevent 96/123596/1
authorpr.jung <pr.jung@samsung.com>
Thu, 6 Apr 2017 07:42:17 +0000 (16:42 +0900)
committerpr.jung <pr.jung@samsung.com>
Thu, 6 Apr 2017 07:42:17 +0000 (16:42 +0900)
Change-Id: Ia0f29e164ede7c5ad917e7c49145b9225f0c63c3
Signed-off-by: pr.jung <pr.jung@samsung.com>
src/block/block.c

index 813a42e..895ae7b 100644 (file)
@@ -2486,20 +2486,20 @@ static void uevent_block_handler(struct udev_device *dev)
        if (r <= 0)
                return;
 
-       r = check_already_handled(devnode);
-       if (r < 0) {
-               _I("%s is already handled", devnode);
-               return;
-       }
-
        action = udev_device_get_action(dev);
        if (!action)
                return;
 
        _I("%s device %s", devnode, action);
-       if (!strncmp(action, UDEV_ADD, sizeof(UDEV_ADD)))
+       if (!strncmp(action, UDEV_ADD, sizeof(UDEV_ADD))) {
+               r = check_already_handled(devnode);
+               if (r < 0) {
+                       _I("%s is already handled", devnode);
+                       return;
+               }
+
                add_block_device(dev, devnode);
-       else if (!strncmp(action, UDEV_REMOVE, sizeof(UDEV_REMOVE)))
+       else if (!strncmp(action, UDEV_REMOVE, sizeof(UDEV_REMOVE)))
                remove_block_device(dev, devnode);
 }