dm thin: fail messages with EOPNOTSUPP when pool cannot handle messages
authorMike Snitzer <snitzer@redhat.com>
Tue, 9 Jun 2015 16:31:26 +0000 (12:31 -0400)
committerMike Snitzer <snitzer@redhat.com>
Thu, 11 Jun 2015 21:13:05 +0000 (17:13 -0400)
Use EOPNOTSUPP, rather than EINVAL, error code when user attempts to
send the pool a message.  Otherwise usespace is led to believe the
message failed due to invalid argument.

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-thin.c

index 99daf2e332f4a6f36183295109247b68d7932f42..c33f61a4cc28d8b772b9444b710e7f55fa6df2fb 100644 (file)
@@ -3656,7 +3656,7 @@ static int pool_message(struct dm_target *ti, unsigned argc, char **argv)
        if (get_pool_mode(pool) >= PM_READ_ONLY) {
                DMERR("%s: unable to service pool target messages in READ_ONLY or FAIL mode",
                      dm_device_name(pool->pool_md));
-               return -EINVAL;
+               return -EOPNOTSUPP;
        }
 
        if (!strcasecmp(argv[0], "create_thin"))