All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iomap: return partial I/O count on error in direct I/O
@ 2020-02-13 19:25 Goldwyn Rodrigues
  2020-02-17 13:17 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Goldwyn Rodrigues @ 2020-02-13 19:25 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: hch, darrick.wong, Goldwyn Rodrigues

From: Goldwyn Rodrigues <rgoldwyn@suse.com>

In case of a block device error, iomap code returns 0 as opposed to
the amount of submitted I/O, which may have completed before the
error occurred. Return the count of submitted I/O for correct
accounting.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
---
 fs/iomap/direct-io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index 23837926c0c5..a980b7b7660f 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -260,7 +260,7 @@ iomap_dio_bio_actor(struct inode *inode, loff_t pos, loff_t length,
 		size_t n;
 		if (dio->error) {
 			iov_iter_revert(dio->submit.iter, copied);
-			copied = ret = 0;
+			ret = 0;
 			goto out;
 		}
 
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] iomap: return partial I/O count on error in direct I/O
  2020-02-13 19:25 [PATCH] iomap: return partial I/O count on error in direct I/O Goldwyn Rodrigues
@ 2020-02-17 13:17 ` Christoph Hellwig
  2020-02-17 13:44   ` Goldwyn Rodrigues
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2020-02-17 13:17 UTC (permalink / raw)
  To: Goldwyn Rodrigues; +Cc: linux-fsdevel, hch, darrick.wong, Goldwyn Rodrigues

On Thu, Feb 13, 2020 at 01:25:03PM -0600, Goldwyn Rodrigues wrote:
> From: Goldwyn Rodrigues <rgoldwyn@suse.com>
> 
> In case of a block device error, iomap code returns 0 as opposed to
> the amount of submitted I/O, which may have completed before the
> error occurred. Return the count of submitted I/O for correct
> accounting.

Haven't we traditionally failed direct I/O syscalls that don't fully
complete and never supported short writes (or reads)?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iomap: return partial I/O count on error in direct I/O
  2020-02-17 13:17 ` Christoph Hellwig
@ 2020-02-17 13:44   ` Goldwyn Rodrigues
  2020-02-17 14:02     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Goldwyn Rodrigues @ 2020-02-17 13:44 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-fsdevel, darrick.wong

On  5:17 17/02, Christoph Hellwig wrote:
> On Thu, Feb 13, 2020 at 01:25:03PM -0600, Goldwyn Rodrigues wrote:
> > From: Goldwyn Rodrigues <rgoldwyn@suse.com>
> > 
> > In case of a block device error, iomap code returns 0 as opposed to
> > the amount of submitted I/O, which may have completed before the
> > error occurred. Return the count of submitted I/O for correct
> > accounting.
> 
> Haven't we traditionally failed direct I/O syscalls that don't fully
> complete and never supported short writes (or reads)?

Yes, but I think that decision should be with the filesystem what to do
with it and not the iomap layer.

The reason we need this patch for btrfs is that we need to account for
updating the allocations. iomap_end() returns written as zero while
iomap_dio_rw loop has submitted part of the I/O. So btrfs has no idea
as to how much has been submitted before the failure and how much of
the allocation to update.

This was exhibited by generic/250 in some of the runs where it fails the
underlying storage.

-- 
Goldwyn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iomap: return partial I/O count on error in direct I/O
  2020-02-17 13:44   ` Goldwyn Rodrigues
@ 2020-02-17 14:02     ` Christoph Hellwig
  2020-02-19 20:31       ` Goldwyn Rodrigues
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2020-02-17 14:02 UTC (permalink / raw)
  To: Goldwyn Rodrigues; +Cc: Christoph Hellwig, linux-fsdevel, darrick.wong

On Mon, Feb 17, 2020 at 07:44:17AM -0600, Goldwyn Rodrigues wrote:
> > Haven't we traditionally failed direct I/O syscalls that don't fully
> > complete and never supported short writes (or reads)?
> 
> Yes, but I think that decision should be with the filesystem what to do
> with it and not the iomap layer.

But then you also need to fix up the existing callers to do the
conversion.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iomap: return partial I/O count on error in direct I/O
  2020-02-17 14:02     ` Christoph Hellwig
@ 2020-02-19 20:31       ` Goldwyn Rodrigues
  0 siblings, 0 replies; 5+ messages in thread
From: Goldwyn Rodrigues @ 2020-02-19 20:31 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-fsdevel, darrick.wong

On  6:02 17/02, Christoph Hellwig wrote:
> On Mon, Feb 17, 2020 at 07:44:17AM -0600, Goldwyn Rodrigues wrote:
> > > Haven't we traditionally failed direct I/O syscalls that don't fully
> > > complete and never supported short writes (or reads)?
> > 
> > Yes, but I think that decision should be with the filesystem what to do
> > with it and not the iomap layer.
> 
> But then you also need to fix up the existing callers to do the
> conversion.

The error returned is set in iomap_dio_complete() which happens after.
I checked all instances and the the only place which uses
written in direct I/O is ext4. I will put in the change.

Thanks!

-- 
Goldwyn

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-19 20:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13 19:25 [PATCH] iomap: return partial I/O count on error in direct I/O Goldwyn Rodrigues
2020-02-17 13:17 ` Christoph Hellwig
2020-02-17 13:44   ` Goldwyn Rodrigues
2020-02-17 14:02     ` Christoph Hellwig
2020-02-19 20:31       ` Goldwyn Rodrigues

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.