nvmet: only check for filebacking on -ENOTBLK
authorHannes Reinecke <hare@suse.de>
Wed, 25 Jul 2018 06:34:45 +0000 (08:34 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 25 Jul 2018 11:14:04 +0000 (13:14 +0200)
We only need to check for a file-backed namespace if
nvmet_bdev_ns_enable() returns -ENOTBLK. For any other error
it's pointless as the open() error will remain the same.

Fixes: d5eff33e ("nvmet: add simple file backed ns support")
Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/core.c

index 74d4b785d2daac7d203108f06286221b5337f993..9838103f2d629b5490b12177693bed04c130e353 100644 (file)
@@ -339,7 +339,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns)
                goto out_unlock;
 
        ret = nvmet_bdev_ns_enable(ns);
-       if (ret)
+       if (ret == -ENOTBLK)
                ret = nvmet_file_ns_enable(ns);
        if (ret)
                goto out_unlock;