Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Gabriel Krisman Bertazi <krisman@collabora.com>
Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
	jack@suse.cz, khazhy@google.com, kernel@collabora.com
Subject: Re: [PATCH v2 1/3] direct-io: clean up error paths of do_blockdev_direct_IO
Date: Fri, 4 Sep 2020 09:47:54 +0200	[thread overview]
Message-ID: <20200904074754.GA2867@quack2.suse.cz> (raw)
In-Reply-To: <20200903200414.673105-2-krisman@collabora.com>

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@collabora.com>

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@suse.com>
SUSE Labs, CR

  reply	other threads:[~2020-09-04  7:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 20:04 [PATCH v2 0/3] Unaligned DIO read error path fix and clean ups Gabriel Krisman Bertazi
2020-09-03 20:04 ` [PATCH v2 1/3] direct-io: clean up error paths of do_blockdev_direct_IO Gabriel Krisman Bertazi
2020-09-04  7:47   ` Jan Kara [this message]
2020-09-03 20:04 ` [PATCH v2 2/3] direct-io: don't force writeback for reads beyond EOF Gabriel Krisman Bertazi
2020-09-04  7:48   ` Jan Kara
2020-09-03 20:04 ` [PATCH v2 3/3] direct-io: defer alignment check until after the EOF check Gabriel Krisman Bertazi
2020-09-04  7:49   ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200904074754.GA2867@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=kernel@collabora.com \
    --cc=khazhy@google.com \
    --cc=krisman@collabora.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --subject='Re: [PATCH v2 1/3] direct-io: clean up error paths of do_blockdev_direct_IO' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).