]> git.karo-electronics.de Git - linux-beck.git/commitdiff
lightnvm: handle submit_io failure
authorMatias Bjørling <m@bjorling.me>
Fri, 6 May 2016 18:02:55 +0000 (20:02 +0200)
committerJens Axboe <axboe@fb.com>
Fri, 6 May 2016 18:51:10 +0000 (12:51 -0600)
The device ->submit_io() callback might fail to submit I/O to device.
In that case, the nvm_submit_ppa function should not wait for
completion. Instead return the ->submit_io() error.

Reviewed by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/lightnvm/core.c

index 0dc9a80adb9443407aca24836f756b12c6ab5569..c2ef53a0d7f8bca461a73c13356c8a288ddaf727 100644 (file)
@@ -351,6 +351,11 @@ int nvm_submit_ppa(struct nvm_dev *dev, struct ppa_addr *ppa, int nr_ppas,
        nvm_generic_to_addr_mode(dev, &rqd);
 
        ret = dev->ops->submit_io(dev, &rqd);
+       if (ret) {
+               nvm_free_rqd_ppalist(dev, &rqd);
+               bio_put(bio);
+               return ret;
+       }
 
        /* Prevent hang_check timer from firing at us during very long I/O */
        hang_check = sysctl_hung_task_timeout_secs;