On Thu 03-09-20 16:04:12, Gabriel Krisman Bertazi wrote: > In preparation to resort DIO checks, reduce code duplication of error > handling in do_blockdev_direct_IO. > > Signed-off-by: Gabriel Krisman Bertazi <krisman@xxxxxxxxxxxxx> Two comments below: > @@ -1368,7 +1360,15 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, > } else > BUG_ON(retval != -EIOCBQUEUED); > > -out: > + return retval; > + > +fail_dio: > + if (dio->flags & DIO_LOCKING) { > + inode_unlock(inode); > + } No need for braces here. Also please add '&& iov_iter_rw(iter) == READ' to the condition for unlocking to make fail_dio safe also for writes. Currently you jump to fail_dio only for reads but in 3/3 you can jump to it also for writes and that is a bug. Honza > +fail_dio_unlocked: > + kmem_cache_free(dio_cache, dio); > + > return retval; > } > > -- > 2.28.0 > -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR